my environment: React with React-charts2
I want to limit the labels number when i have more labels, example: 1 year total range
This screen is that the date length is thirty days, and the limit rule is that three days are replaced by one field, how can i achieve?
my other charts rules is:
const tickIntervalRule = () => {
let tick;
switch (true) {
case dateDistance < 16:
tick = 1; // will default value
break;
case 16 <= dateDistance && dateDistance <= 30:
tick = 3; // 30/3 reutrn 10 labels
break;
case 31 <= dateDistance && dateDistance <= 90:
tick = 10; // 90/10 reutrn 9 labels
break;
case 91 <= dateDistance && dateDistance <= 365:
tick = 30; // 365/30 reutrn 12 labels
break;
case dateDistance > 365:
tick = 60; // 365/60 reutrn 6 labels
break;
default:
}
return tick;
};
expected look screen shot: 30days dateRange in charts