Home Forums Chart Support Data Time Chart — No Values for dates

Data Time Chart — No Values for dates

Viewing 2 posts - 1 through 2 (of 2 total)
  • #24947

    HI

    I want a Simple Date Area chart to set the x axis to 0 if no dataset is present for that particular date

    e.g.
    In the below there is no value for date 3rd Jan so for this date the x axis should set to zero which in my case is not setting.
    data: [
    {
    type: “area”,
    dataPoints: [//array
    { x: new Date(2012, 01, 1), y: 26},
    { x: new Date(2012, 01, 2), y: 43},
    { x: new Date(2012, 01, 4), y: 54}
    ]
    }
    ]
    });

    https://canvasjs.com/docs/charts/basics-of-creating-html5-chart/date-time-axis/

    #24956

    @abdul8423,

    CanvasJS library just renders chart with dataPoints provided by you and it don’t modify the dataPoints that you have passed. To add missing dates, you can parse through dataPoints array and add missing dates to it before rendering the chart as shown in this JSFiddle.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.