Line chart with lots of labels on the x axis

I use Chart.js to implement a line chart. The X axis of this diagram has many points, for example an integer range from 1 to 200. Having this many points on the X axis, there is a problem when displaying:

enter image description here

Is it possible to β€œassemble” tags so that I can simply show 1, 10, 20? This should only affect the labels and not remove points from the plotted line.

+6
source share
1 answer

What I did was when creating an array for shortcuts, check if i % 10 === 0 where i is the index of the label, if true, add the label to the array, if false, add an empty string to the array.

It may not be the cleanest way, but it works.

+4
source

Source: https://habr.com/ru/post/976411/


All Articles