Merge branch 'fix/dashboard' into 'development'

[FIX/FE] Fixing Line Chart in Dashboard Page

See merge request mbugroup/lti-web-client!302
This commit is contained in:
Rivaldi A N S
2026-02-03 07:00:11 +00:00
2 changed files with 45 additions and 39 deletions
@@ -67,7 +67,7 @@ const lineColors: Record<string, string> = {
act_fcr: '#10B981', act_fcr: '#10B981',
std_fcr: '#10B981', std_fcr: '#10B981',
act_fcr_cum: '#F52419', act_fcr_cum: '#F52419',
std_fcr_cum: '#10B981', std_fcr_cum: '#F52419',
normal: '#10B981', normal: '#10B981',
abnormal: '#F52419', abnormal: '#F52419',
act_deplesi: '#10B981', act_deplesi: '#10B981',
@@ -659,44 +659,50 @@ const DashboardLineChart = ({
seriesData = comparisonChart?.series || []; seriesData = comparisonChart?.series || [];
} }
return seriesData return seriesData.map((series, originalIndex) => {
.filter((series) => visibleSeries.has(series.id)) // Skip rendering if series is not visible
.map((series, index) => { if (!visibleSeries.has(series.id)) {
const isStandard = series.id return null;
.toString() }
.toLowerCase()
.includes('std');
// Use series.id directly as dataKey to match dataset fields
const dataKey = series.id.toString();
return ( const isStandard = series.id
<Line .toString()
key={`${series.id}--${index}`} .toLowerCase()
type='monotone' .includes('std');
dataKey={dataKey} const dataKey = series.id.toString();
name={series.label}
stroke={getLineColor(series.id, index, analysisMode)} return (
opacity={isStandard ? 0.5 : 1} <Line
strokeWidth={2} key={`${series.id}--${originalIndex}`}
strokeDasharray={isStandard ? '5 5' : undefined} type='monotone'
dot={ dataKey={dataKey}
isStandard name={series.label}
? false stroke={getLineColor(
: { series.id,
r: 3, originalIndex,
fill: '#fff', analysisMode
stroke: getLineColor( )}
series.id, opacity={isStandard ? 0.5 : 1}
index, strokeWidth={2}
analysisMode strokeDasharray={isStandard ? '5 5' : undefined}
), dot={
strokeWidth: 2, isStandard
} ? false
} : {
activeDot={isStandard ? undefined : { r: 5 }} r: 3,
/> fill: '#fff',
); stroke: getLineColor(
}); series.id,
originalIndex,
analysisMode
),
strokeWidth: 2,
}
}
activeDot={isStandard ? undefined : { r: 5 }}
/>
);
});
})()} })()}
</LineChart> </LineChart>
</ResponsiveContainer> </ResponsiveContainer>
@@ -66,7 +66,7 @@ const lineColors: Record<string, string> = {
act_fcr: '#10B981', act_fcr: '#10B981',
std_fcr: '#10B981', std_fcr: '#10B981',
act_fcr_cum: '#F52419', act_fcr_cum: '#F52419',
std_fcr_cum: '#10B981', std_fcr_cum: '#F52419',
normal: '#10B981', normal: '#10B981',
abnormal: '#F52419', abnormal: '#F52419',
act_deplesi: '#10B981', act_deplesi: '#10B981',