Skip to content

Commit

Permalink
More cognitive age counting
Browse files Browse the repository at this point in the history
  • Loading branch information
petterav committed Apr 17, 2024
1 parent dd3b2f5 commit 2719f64
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,23 @@ export const GrowthChartBuilder = ({
},
min: datasetMetadata.range.start,
max: datasetMetadata.range.end,
ticks: { stepSize: 1 },
ticks: {
stepSize: 1,
callback: (value: number, index, values) => {
if (datasetMetadata.xAxisLabel === 'Months') {
const isFirstTick = index === 0;
const isLastTick = index === values.length - 1;

if (isFirstTick) return '0';
if (isLastTick) return '12';

const modulo = value % 12;
return modulo === 0 ? '' : modulo;
}
return value;
},
},

},
y: {
title: {
Expand Down

0 comments on commit 2719f64

Please sign in to comment.