Callbacks

If you need to filter or change individual tick labels, you can use life cycle callbacks. There are 14 of them and they are configured directly in each axis object. The following code a callback to filter ticks based on their value (increasing the step) and at a later stage, changes the value to be displayed (at this stage, the change no longer affects the chart):

yAxes: [
{
afterBuildTicks: function(axis) {
log('afterBuildTicks')
axis.ticks = axis.ticks.filter((d,i) => d % 100000 == 0);

},
afterTickToLabelConversion: function(axis) {
log('afterTickToLabelConversion')
axis.ticks.forEach((d,i) => axis.ticks[i] = +d/1000);
}
}
]

 See the full code in Advanced/adv-2-callbacks.html and adv-3-radial-callbacks.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset