Update translations, special formating for x-axis tick label 'Noon'
This commit is contained in:
@@ -169,7 +169,7 @@ const SimulationChart = ({
|
|||||||
{templateProfile && (chartView === 'damph' || chartView === 'both') && (
|
{templateProfile && (chartView === 'damph' || chartView === 'both') && (
|
||||||
<Line
|
<Line
|
||||||
dataKey="templateDamph"
|
dataKey="templateDamph"
|
||||||
name={`${t('dAmphetamine')} (${t('regularPlan')} ${t('continuation')})`}
|
name={`${t('dAmphetamine')} (${t('regularPlanOverlay')})`}
|
||||||
stroke={CHART_COLORS.idealDamph}
|
stroke={CHART_COLORS.idealDamph}
|
||||||
strokeWidth={2}
|
strokeWidth={2}
|
||||||
strokeDasharray="3 3"
|
strokeDasharray="3 3"
|
||||||
@@ -180,7 +180,7 @@ const SimulationChart = ({
|
|||||||
{templateProfile && (chartView === 'ldx' || chartView === 'both') && (
|
{templateProfile && (chartView === 'ldx' || chartView === 'both') && (
|
||||||
<Line
|
<Line
|
||||||
dataKey="templateLdx"
|
dataKey="templateLdx"
|
||||||
name={`${t('lisdexamfetamine')} (${t('regularPlan')} ${t('continuation')})`}
|
name={`${t('lisdexamfetamine')} (${t('regularPlanOverlay')})`}
|
||||||
stroke={CHART_COLORS.idealLdx}
|
stroke={CHART_COLORS.idealLdx}
|
||||||
strokeWidth={1.5}
|
strokeWidth={1.5}
|
||||||
strokeDasharray="3 3"
|
strokeDasharray="3 3"
|
||||||
@@ -203,32 +203,49 @@ const SimulationChart = ({
|
|||||||
margin={{ top: 0, right: 20, left: 0, bottom: 5 }}
|
margin={{ top: 0, right: 20, left: 0, bottom: 5 }}
|
||||||
syncId="medPlanChart"
|
syncId="medPlanChart"
|
||||||
>
|
>
|
||||||
<XAxis
|
{/** Custom tick renderer to italicize 'Noon' only in 12h mode */}
|
||||||
xAxisId="hours"
|
{(() => {
|
||||||
label={{ value: showDayTimeOnXAxis === 'continuous' ? t('axisLabelHours') : t('axisLabelTimeOfDay'), position: 'insideBottom', offset: -10, style: { fontStyle: 'italic', color: '#666' } }}
|
const CustomTick = (props: any) => {
|
||||||
dataKey="timeHours"
|
const { x, y, payload } = props;
|
||||||
type="number"
|
const h = payload.value as number;
|
||||||
domain={[0, totalHours]}
|
let label: string;
|
||||||
ticks={chartTicks}
|
|
||||||
tickCount={chartTicks.length}
|
|
||||||
interval={0}
|
|
||||||
tickFormatter={(h) => {
|
|
||||||
if (showDayTimeOnXAxis === '24h') {
|
if (showDayTimeOnXAxis === '24h') {
|
||||||
// Show 24h repeating format (0-23h)
|
label = `${h % 24}h`;
|
||||||
return `${h % 24}${t('hour')}`;
|
|
||||||
} else if (showDayTimeOnXAxis === '12h') {
|
} else if (showDayTimeOnXAxis === '12h') {
|
||||||
// Show 12h AM/PM format
|
|
||||||
const hour12 = h % 24;
|
const hour12 = h % 24;
|
||||||
if (hour12 === 12) return t('tickNoon');
|
if (hour12 === 12) {
|
||||||
|
label = t('tickNoon');
|
||||||
|
return (
|
||||||
|
<text x={x} y={y + 12} textAnchor="middle" fontStyle="italic" fill="#666">
|
||||||
|
{label}
|
||||||
|
</text>
|
||||||
|
);
|
||||||
|
}
|
||||||
const displayHour = hour12 === 0 ? 12 : hour12 > 12 ? hour12 - 12 : hour12;
|
const displayHour = hour12 === 0 ? 12 : hour12 > 12 ? hour12 - 12 : hour12;
|
||||||
const period = hour12 < 12 ? 'a' : 'p';
|
const period = hour12 < 12 ? 'a' : 'p';
|
||||||
return `${displayHour}${period}`;
|
label = `${displayHour}${period}`;
|
||||||
} else {
|
} else {
|
||||||
// Show continuous time (0, 6, 12, 18, 24, 30, 36, ...)
|
label = `${h}`;
|
||||||
return `${h}`;
|
|
||||||
}
|
}
|
||||||
}}
|
return (
|
||||||
/>
|
<text x={x} y={y + 12} textAnchor="middle" fill="#666">
|
||||||
|
{label}
|
||||||
|
</text>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
return <XAxis
|
||||||
|
xAxisId="hours"
|
||||||
|
label={{ value: showDayTimeOnXAxis === 'continuous' ? t('axisLabelHours') : t('axisLabelTimeOfDay'), position: 'insideBottom', offset: -10, style: { fontStyle: 'italic', color: '#666' } }}
|
||||||
|
dataKey="timeHours"
|
||||||
|
type="number"
|
||||||
|
domain={[0, totalHours]}
|
||||||
|
ticks={chartTicks}
|
||||||
|
tickCount={chartTicks.length}
|
||||||
|
interval={0}
|
||||||
|
tick={<CustomTick />}
|
||||||
|
/>;
|
||||||
|
})()}
|
||||||
|
|
||||||
<YAxis
|
<YAxis
|
||||||
yAxisId="concentration"
|
yAxisId="concentration"
|
||||||
label={{ value: t('axisLabelConcentration'), angle: -90, position: 'insideLeft', offset: '0 -10', style: { fontStyle: 'italic', color: '#666' } }}
|
label={{ value: t('axisLabelConcentration'), angle: -90, position: 'insideLeft', offset: '0 -10', style: { fontStyle: 'italic', color: '#666' } }}
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ export const de = {
|
|||||||
xAxisTimeFormat: "Zeitformat",
|
xAxisTimeFormat: "Zeitformat",
|
||||||
xAxisFormatContinuous: "Fortlaufend",
|
xAxisFormatContinuous: "Fortlaufend",
|
||||||
xAxisFormatContinuousDesc: "Endlose Sequenz (0h, 6h, 12h...)",
|
xAxisFormatContinuousDesc: "Endlose Sequenz (0h, 6h, 12h...)",
|
||||||
xAxisFormat24h: "24h",
|
xAxisFormat24h: "Tageszeit (24h)",
|
||||||
xAxisFormat24hDesc: "Wiederholender 0-24h Zyklus",
|
xAxisFormat24hDesc: "Wiederholender 0-24h Zyklus",
|
||||||
xAxisFormat12h: "12h AM/PM",
|
xAxisFormat12h: "Tageszeit (12h AM/PM)",
|
||||||
xAxisFormat12hDesc: "Wiederholend 12h mit AM/PM",
|
xAxisFormat12hDesc: "Wiederholend 12h Zyklus im AM/PM Format",
|
||||||
showTemplateDayInChart: "Regulären Plan kontinuierlich im Diagramm anzeigen",
|
showTemplateDayInChart: "Regulären Plan kontinuierlich im Diagramm anzeigen",
|
||||||
showDayReferenceLines: "Tagestrenner anzeigen",
|
showDayReferenceLines: "Tagestrenner anzeigen",
|
||||||
simulationDuration: "Simulationsdauer",
|
simulationDuration: "Simulationsdauer",
|
||||||
@@ -95,8 +95,8 @@ export const de = {
|
|||||||
|
|
||||||
// Day-based schedule
|
// Day-based schedule
|
||||||
regularPlan: "Regulärer Plan",
|
regularPlan: "Regulärer Plan",
|
||||||
deviatingPlan: "Abweichender Plan",
|
deviatingPlan: "Abweichung vom Plan",
|
||||||
continuation: "Fortsetzung",
|
regularPlanOverlay: "Regulär",
|
||||||
dayNumber: "Tag {{number}}",
|
dayNumber: "Tag {{number}}",
|
||||||
cloneDay: "Tag klonen",
|
cloneDay: "Tag klonen",
|
||||||
addDay: "Tag hinzufügen",
|
addDay: "Tag hinzufügen",
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ export const en = {
|
|||||||
xAxisTimeFormat: "Time Format",
|
xAxisTimeFormat: "Time Format",
|
||||||
xAxisFormatContinuous: "Continuous",
|
xAxisFormatContinuous: "Continuous",
|
||||||
xAxisFormatContinuousDesc: "Endless sequence (0h, 6h, 12h...)",
|
xAxisFormatContinuousDesc: "Endless sequence (0h, 6h, 12h...)",
|
||||||
xAxisFormat24h: "24h",
|
xAxisFormat24h: "Time of Day (24h)",
|
||||||
xAxisFormat24hDesc: "Repeating 0-24h cycle",
|
xAxisFormat24hDesc: "Repeating 0-24h cycle",
|
||||||
xAxisFormat12h: "12h AM/PM",
|
xAxisFormat12h: "Time of Day (12h AM/PM)",
|
||||||
xAxisFormat12hDesc: "Repeating 12h with AM/PM",
|
xAxisFormat12hDesc: "Repeating 12h cycle in AM/PM format",
|
||||||
showTemplateDayInChart: "Overlay regular plan in chart",
|
showTemplateDayInChart: "Overlay regular plan in chart",
|
||||||
showDayReferenceLines: "Show day separators",
|
showDayReferenceLines: "Show day separators",
|
||||||
simulationDuration: "Simulation Duration",
|
simulationDuration: "Simulation Duration",
|
||||||
@@ -95,8 +95,8 @@ export const en = {
|
|||||||
|
|
||||||
// Day-based schedule
|
// Day-based schedule
|
||||||
regularPlan: "Regular Plan",
|
regularPlan: "Regular Plan",
|
||||||
deviatingPlan: "Deviating Plan",
|
deviatingPlan: "Deviation from Plan",
|
||||||
continuation: "continuation",
|
regularPlanOverlay: "Regular",
|
||||||
dayNumber: "Day {{number}}",
|
dayNumber: "Day {{number}}",
|
||||||
cloneDay: "Clone day",
|
cloneDay: "Clone day",
|
||||||
addDay: "Add day",
|
addDay: "Add day",
|
||||||
|
|||||||
Reference in New Issue
Block a user