Axis displaying incorrect tick values for some data point combination
I've noticed that when using chart.js to plot date related data points, there are times when the graph displays incorrect axis ticks. This happens only for specific data points.
Expected Behavior
The expected behaviour is that the chart correctly generates axis ticks when using a date as an axis based on the provided data set. If the difference between the data points is in the magnitude of days, the chart's axis should reflect that.
Current Behavior
For a multi-day plot, instead of displaying dates such as "20 Feb" the chart displays hours such as "1PM" although the difference of points is in the magnitude of days. Weird thing is that this happens only for specific data.
Possible Solution
I think that there is logic in the chart.js implementation for calculating gaps between data points that are of type "date". I would start investigating how these points are calculated when using the data from Steps To Reproduce (for bugs)
Steps to Reproduce (for bugs)
- Open https://codepen.io/anon/pen/KYazaR
- In JS tab, switch data between dataThatWorks and dataThatDoesNotWork
- In CSS tab, switch width between 900px and 1200px
Context
As our project is intended to present various networking metrics to our customers, the date ranges for these points are important.
Environment
Chart.js version 2.8.0 being used as part of an Angular 6 application Browser used for testing is Chrome Version 70.0.3538.77 (Official Build) (64-bit) running on top of Lubuntu.
Demonstrative formats: https://codepen.io/anon/pen/KYazaR https://stackblitz.com/edit/ng2-chart-example-kvghc3?file=app%2Fapp.component.html