Skip to content

Commit f834440

Browse files
committed
🐛 Update Freq Col Alignment in Timeline Event Availability Chart
1 parent 9573b27 commit f834440

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

src/pages/studyView/table/ClinicalEventTypeCountTable.tsx

+29-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
66
import { action, computed, makeObservable, observable } from 'mobx';
77
import _ from 'lodash';
88
import MobxPromise from 'mobxpromise';
9-
import React from 'react';
9+
import React, { CSSProperties } from 'react';
1010
import styles from 'pages/studyView/table/tables.module.scss';
1111
import {
1212
toNumericValue,
@@ -25,16 +25,26 @@ import {
2525
import autobind from 'autobind-decorator';
2626
import { SelectionOperatorEnum } from 'pages/studyView/TableUtils';
2727
import { MultiSelectionTableRow } from 'pages/studyView/table/MultiSelectionTable';
28-
import { getFrequencyStr } from 'pages/studyView/StudyViewUtils';
28+
import {
29+
correctMargin,
30+
getFixedHeaderNumberCellMargin,
31+
getFrequencyStr,
32+
} from 'pages/studyView/StudyViewUtils';
2933

3034
export interface IClinicalEventTypeDataColumnCellProp {
3135
data: string;
36+
style?: CSSProperties;
37+
className?: string;
3238
}
3339

3440
function ClinicalEventTypeColumnCell(
3541
props: IClinicalEventTypeDataColumnCellProp
3642
) {
37-
return <div>{props.data}</div>;
43+
return (
44+
<div className={props.className} style={props.style}>
45+
{props.data}
46+
</div>
47+
);
3848
}
3949

4050
export function filterClinicalEventTypeCountCell(
@@ -194,6 +204,8 @@ export default class ClinicalEventTypeCountTable extends React.Component<
194204
),
195205
render: (data: ClinicalEventTypeCount) => (
196206
<ClinicalEventTypeColumnCell
207+
className={styles.pullRight}
208+
style={{ marginLeft: cellMargin }}
197209
data={this.calculateClinicalEventTypeFreqString(
198210
data,
199211
this.selectedPatientCount
@@ -241,7 +253,20 @@ export default class ClinicalEventTypeCountTable extends React.Component<
241253
return {
242254
[ClinicalEventTypeCountColumnKey.CLINICAL_EVENT_TYPE]: 0,
243255
[ClinicalEventTypeCountColumnKey.COUNT]: 0,
244-
[ClinicalEventTypeCountColumnKey.FREQ]: 0,
256+
[ClinicalEventTypeCountColumnKey.FREQ]: correctMargin(
257+
getFixedHeaderNumberCellMargin(
258+
this.columnsWidth[ClinicalEventTypeCountColumnKey.FREQ],
259+
getFrequencyStr(
260+
_.max(
261+
this.tableData.map(
262+
item =>
263+
(item.count! / this.selectedPatientCount!) *
264+
100
265+
)
266+
)!
267+
)
268+
)
269+
),
245270
};
246271
}
247272

0 commit comments

Comments
 (0)