Chart.js: v2.0 beta2, time scale min and max date settings are not working

Created on 30 Jan 2016  路  3Comments  路  Source: chartjs/Chart.js

Hi,

I am using v2.0 beta2, trying to set min and max date but chart is not showing all x-axis ticks.

My requirement is, chart should always have x-axis ticks even if data is there or not.

For example, if current hour is 2:00, ticks should be: 1:00, 1:10, 1:20, 1:30, 1:40, 1:50, 2:00 (10 mins apart).

This is scatter plot for time scale.

Here is some of the code. With this chart shows only first tick on the x-axis, no other ticks are shown, how to fix this? for full code: https://jsfiddle.net/ch4gdusL/1/

       `var timeFormat = 'MM/DD/YYYY HH:mm:SS';`
    `function startDateString(days) {` 
        `var date = moment().format(timeFormat);`
        `return date;`
   `}`
 `function endDateString(hours) {`
        `var date = moment().add(hours, 'h').format(timeFormat);`
        `return date;`
`}`

time: {
displayFormat: 'HH:mm',
unit: 'minute',
min: startDateString(),
max: endDateString(1)
},

bug

All 3 comments

I think this is related to #1941 and #1825

@gv007 I tried the latest built version from the v2.0-dev branch and it works as intended :)

https://jsfiddle.net/01zetgd8/1/

@etimberg this still has issue.

For every refresh behavior is not consistent. Most of the time it is showing'Invalid date' on the x-axis. Some times it shows start and end time without any ticks. Some time it shows 3 ticks(30 mins apart, like 10:00, 10:30, 11:00). Can you please help?

https://jsfiddle.net/01zetgd8/2/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joebirkin picture joebirkin  路  3Comments

SylarRuby picture SylarRuby  路  3Comments

lizbanach picture lizbanach  路  3Comments

Woogles picture Woogles  路  3Comments

nanospeck picture nanospeck  路  3Comments