February 2019
Beginner to intermediate
284 pages
6h 20m
English
The scale service can be used to update scales during changes. You can use it to pass a partial configuration that will be merged with the current configuration. In the following code, it was used to set the minimum boundary for ticks in the linear scale, and append text to tick labels in the category scale:
Chart.scaleService.updateScaleDefaults('linear', { ticks: { min: -100000 }, afterTickToLabelConversion: function(axis) { axis.ticks.forEach((d,i) => axis.ticks[i] = +d/1000); } }); Chart.scaleService.updateScaleDefaults('category', { afterTickToLabelConversion: function(axis) { axis.ticks.forEach((d,i) => axis.ticks[i] = d + " Ocean") } });
See the full code in Advanced/adv-4-scaleService.html.
Read now
Unlock full access