X-Axis decimal places displayed using chartjs-plugin-zoom

105 Views Asked by At

When zooming in (both x&y set) the x-axis labels that are defaulted to 1 decimal place using Chart.config._config.options.scales.xAxis.ticks.precision = 1; will show 14 digits on the first and last tick mark whilst all other tick marks are 1 decimal place. Is there a setting to limit the first and last labels or, is this a bug?

First & Last tick mark issue

Using chartjs 4.3 I tried the following callback in the scales:xAxis:ticks: section.

callback: function(value) {
    if (Math.floor(value) === value) {
      return value;
    }
}

Which worked on line chart types but, no decimal places. Correct tick marks

It did not work on time chart types (no tick marks were shown). Missing tick marks

0

There are 0 best solutions below