Home forums Using CanvasJS Dynamically generated chart displaying wrong format

This topic contains 1 reply, has 2 voices, and was last updated by  Manoj Mohan 4 weeks ago.

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

    Displaying wrong format in chart .Can you please look into the below issue?

    window.onload = function () {

    var chart = new CanvasJS.Chart(“chartContainer”, {
    animationEnabled: true,
    title:{
    text: “NEO Data”
    },

    toolTip: {
    shared: true
    },
    legend:{
    cursor: “pointer”,
    itemclick: toggleDataSeries
    },
    data: [{
    type: “stackedBar”,
    showInLegend: “true”,
    dataPoints:
    [{“label”:”1″,”y”:139.0,”indexLabel”:”139;139″},
    {“label”:”2″,”y”:872.0,”indexLabel”:”872;872″},
    {“label”:”5″,”y”:2809.0,”indexLabel”:”2809;2809″},
    {“label”:”6″,”y”:716.0,”indexLabel”:”716;716″}]

    },
    {
    type: “stackedBar”,

    dataPoints: [
    [{“label”:”6″,”y”:1067.0,”indexLabel”:”1067;1067″}]
    ]
    },
    {
    type: “stackedBar”,
    showInLegend: “true”,

    dataPoints: [
    [{“label”:”InHouseVol”,”y”:10892.0,”indexLabel”:”10892;10892″}]
    ]
    },
    {
    type: “stackedBar”,

    showInLegend: “true”,

    dataPoints:
    [{“label”:”NEO Pending”,”y”:1942.0,”indexLabel”:”1942;1942″}]

    },
    {
    type: “stackedBar”,

    showInLegend: “true”,

    dataPoints:
    [{“label”:”Not Met InProgress”,”y”:3657.0,”indexLabel”:”3657;3657″},
    {“label”:”6″,”y”:76.0,”indexLabel”:”76;76″}
    ]
    }]
    });
    chart.render();

    function toggleDataSeries(e) {
    if(typeof(e.dataSeries.visible) === “undefined” || e.dataSeries.visible) {
    e.dataSeries.visible = false;
    }
    else {
    e.dataSeries.visible = true;
    }
    chart.render();
    }

    }

    #27240

    @sravanthi-b,

    Stacked Bar Charts are plotted when multiple Bar Charts with aligned x values are plotted on same axis. Adding x-values to the dataPoints should work fine in your case.

    —-
    Manoj Mohan
    Team CanvasJS

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

You must be logged in to reply to this topic.