Home forums Report Bugs Problem with Dates when showing individual days

This topic contains 1 reply, has 1 voice, and was last updated by  lharley@designinteractive.com 1 year, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9512

    I posted my code on JSFiddle
    http://jsfiddle.net/4qz2ozty/1/

    If you look at the bar chart in the display on JS Fiddle, you’ll see that May 31, 2015 and Jun 1, 2015 are both displayed for a single bar. That is, two dates are confused as one day. If you look at the JavaScript code, you can see that I have set two separate dataPoints, but only one bar displays in the chart.

    { x: new Date(2015, 05, 31), y: 7832 },
    { x: new Date(2015, 06, 01), y: 7348 },

    This only happens when — intervalType: “day” and interval: 1.

    If I set the interval to 2 or 7, the bar for May 31 and Jun 1 are two separate bars. The chart displays correctly. But if I set the chart to display each bar as a separate day, May 31 seems to get dropped as a distinct day.

    Is this a true bug or have I programmed something incorrectly? I have done a workaround by setting x as a custom label, but I’m trying to write an extended tooltip (which is only partly complete). It would really be better for my code if I could use true dates for the x label instead of a custom label.

    #9513

    I believe the problem is not with YOUR code. I forgot that JavaScript Date object is zero-based. So Date(2015, 05, 31) is NOT May 31.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.