Home Forums Feature Requests & Feedback StripLines – strange output using dates

StripLines – strange output using dates

Viewing 3 posts - 1 through 3 (of 3 total)
  • #29576

    Hi all

    I have been trying to set up strip lines on my chart. The x axis has datetime fields, with all dates in July (month 7) of 2019, however I need to set up the striplines using the same year, day, hour, minute HOWEVER I need to use June (month 6)!!

    What am I doing wrong?

    My jsfiddle demonstrates this:
    https://jsfiddle.net/ChrisEvans_UK/qkr2bu17/9/

    Can anyone help?

    A second point, I seem to have to include the following code just to get the chart to work in the first place (before I try adding striplines):

    for (var i = 0; i < rawData.length; i++) {
    rawData[i][“x”] = new Date(rawData[i][“x”]);
    }

    Do I really need that?

    Any help is greatly appreciated.

    Regards
    Chris

    #29585

    Chris,

    In JavaScript month index starts from 0(January) and ends at 11(December). For more information please refer to this StackOverflow page.

    A second point, I seem to have to include the following code just to get the chart to work in the first place (before I try adding striplines):
    for (var i = 0; i < rawData.length; i++) { rawData[i][“x”] = new Date(rawData[i][“x”]); }

    X values can either be number or date-object. In your case, to make it date-object this loop would be required.


    Vishwas R
    Team CanvasJS

    #29586

    Thanks Vishwas, you are a star!

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

You must be logged in to reply to this topic.