Home forums Using CanvasJS Months double-up on x-axis in multi-line chart

This topic contains 0 replies, has 1 voice, and was last updated by  DaveR 2 years, 4 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #6534

    DaveR
    Participant

    Running the following yields duplicate months along the x-axis (Mar & May appear twice each). Also, possibly as a result, data points do not position over the correct month in some cases:

    var chart = new CanvasJS.Chart(“chartContainer”,
    {

    title: {
    text: “duplicate months demo”
    },
    axisX: {
    valueFormatString: “MMM”
    },
    axisY: {
    valueFormatString: “#0%”
    },
    axisY: {
    gridColor: “Silver”,
    tickColor: “silver”
    },
    data: [
    {
    type: “line”,
    showInLegend: true,
    lineThickness: 2,
    name: “Line 1”,
    markerType: “square”,
    color: “#F08080”,
    dataPoints: [
    { x: new Date(2014, 0), y: 1 },
    { x: new Date(2014, 1), y: 5 },
    { x: new Date(2014, 2), y: 15 },
    { x: new Date(2014, 3), y: 25 },
    { x: new Date(2014, 4), y: 35 },
    { x: new Date(2014, 5), y: 45 },
    { x: new Date(2014, 6), y: 55 }
    ]
    },
    {
    type: “line”,
    showInLegend: true,
    name: “Line 2”,
    color: “#20B2AA”,
    lineThickness: 2,

    dataPoints: [
    { x: new Date(2014, 0), y: 3 },
    { x: new Date(2014, 1), y: 10 },
    { x: new Date(2014, 2), y: 17 },
    { x: new Date(2014, 3), y: 22 },
    { x: new Date(2014, 4), y: 30 },
    { x: new Date(2014, 5), y: 40 },
    { x: new Date(2014, 6), y: 50 }
    ]
    }

    ]
    });

    What am I doing wrong?

    Thanks.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.