I made a line chart using Chart.js version 2.1.3.
var canvas = $('#gold_chart').get(0); var ctx = canvas.getContext('2d'); var fillPatternGold = ctx.createLinearGradient(0, 0, 0, canvas.height); fillPatternGold.addColorStop(0, '#fdca55'); fillPatternGold.addColorStop(1, '#ffffff'); var goldChart = new Chart(ctx, { type: 'line', animation: false, data: { labels: dates, datasets: [{ label: '', data: prices, pointRadius: 0, borderWidth: 1, borderColor: '#a97f35', backgroundColor: fillPatternGold }] }, title: { position: 'bottom', text: '\u7F8E\u5143 / \u76CE\u53F8' }, options: { legend: { display: false }, tooltips: { callback: function(tooltipItem) { return tooltipItem.yLabel; } }, scales: { xAxes: [{ ticks: { maxTicksLimit: 8 } }] } } });
The conclusion is as follows:

As you can see, I limited the maximum number of ticks to 8 through maxTicksLimit . However, the distribution is not even. How can I distribute ticks evenly?
ps there are always 289 records in the data set, and data is recorded every 5 minutes. Sample values ββfor the prices variable are:
[ {"14:10", 1280.3}, {"14:15", 1280.25}, {"14:20", 1282.85} ]
I tried different maxTicksLimit values ββand the results are still not evenly distributed.
Raptor May 16 '16 at 9:18 2016-05-16 09:18
source share