-
-
-
-
+
+ {renderLegend({
+ payload: [
+ ...(chartView === 'damph' || chartView === 'both'
+ ? [
+ {
+ dataKey: 'combinedDamph',
+ value: seriesLabels.combinedDamph.display,
+ color: CHART_COLORS.idealDamph,
+ payload: { opacity: 1 },
+ },
+ ]
+ : []),
+ ...(chartView === 'ldx' || chartView === 'both'
+ ? [
+ {
+ dataKey: 'combinedLdx',
+ value: seriesLabels.combinedLdx.display,
+ color: CHART_COLORS.idealLdx,
+ payload: { opacity: 1 },
+ },
+ ]
+ : []),
+ ...(templateProfile && daysWithDeviations.size > 0 && (chartView === 'damph' || chartView === 'both')
+ ? [
+ {
+ dataKey: 'templateDamph',
+ value: seriesLabels.templateDamph.display,
+ color: CHART_COLORS.idealDamph,
+ payload: { opacity: 0.5 },
+ },
+ ]
+ : []),
+ ...(templateProfile && daysWithDeviations.size > 0 && (chartView === 'ldx' || chartView === 'both')
+ ? [
+ {
+ dataKey: 'templateLdx',
+ value: seriesLabels.templateLdx.display,
+ color: CHART_COLORS.idealLdx,
+ payload: { opacity: 0.5 },
+ },
+ ]
+ : []),
+ ],
+ })}
{/* Chart */}
@@ -321,7 +395,7 @@ const SimulationChart = ({
const h = payload.value as number;
let label: string;
if (showDayTimeOnXAxis === '24h') {
- label = `${h % 24}h`;
+ label = `${h % 24}${t('unitHour')}`;
} else if (showDayTimeOnXAxis === '12h') {
const hour12 = h % 24;
if (hour12 === 12) {
@@ -365,7 +439,7 @@ const SimulationChart = ({
allowDecimals={false}
tickCount={20}
/>
-
{
if (!active || !payload || payload.length === 0) return null;
@@ -395,13 +469,18 @@ const SimulationChart = ({
{t('time')}: {timeLabel}
{payload.map((entry: any, index: number) => {
- const isTemplate = entry.name?.includes(t('regularPlanOverlay'));
+ const labelInfo = seriesLabels[entry.dataKey] || { display: entry.name, full: entry.name };
+ const isTemplate = entry.dataKey?.toString().includes('template');
const opacity = isTemplate ? 0.5 : 1;
const value = typeof entry.value === 'number' ? entry.value.toFixed(1) : entry.value;
return (
- -
- {entry.name}
+
-
+ {labelInfo.display}
:
{value} {t('unitNgml')}
@@ -486,7 +565,7 @@ const SimulationChart = ({