Is it possible to have stacking using JSON like data

2 posts, 0 answers
  1. Geroj
    Geroj avatar
    6 posts
    Member since:
    Jun 2016

    Posted 27 Jun 2016 Link to this post


    I'm trying to have a stacked chart using JSON like data or remote data. 

    using the data below I was able to get exactly the chart I wanted dojo Code here

        var data = [
        {"Name":1,"Year":2011,"Expense":200.00, "color":"grey"},
        {"Name":5,"Year":2011,"Expense":100.00, "color":"red"},
        {"Name":5,"Year":2012,"Expense":315.84, "color":"red"},

    But when I added other rows to this data, the result is not what I was expecting. dojo code here

         var data = [
        {"Name":1,"Year":2011,"Expense":200.00, "color":"grey"},
    {"Name":6,"Year":2010,"Expense":205.00 ,"color":"yellow"},
        {"Name":5,"Year":2011,"Expense":100.00 ,"color":"red"},
        {"Name":5,"Year":2012,"Expense":315.84, "color":"red"},
        {"Name":3,"Year":2011,"Expense":325.84 , "color":"orange"},
      {"Name":5,"Year":2013,"Expense":205.00 ,"color":"red"},

    What I was expecting is the result of this dojo code

    But I was able to do this using this data structure

    series: [{
                        name: "name 3",
                        data: [0, 325.4 ,0],
                    }, {
                        name: "name 1",
                        data: [0, 200, 274],
                    }, {
                        name: "name 5",
                        data: [100, 205, 315.84 ],
                        name: "name 6",
                        data: [205, 0, 0 ],
                        color: "yellow"


    Is there any way to make this work using remote data (Json ) and not  the last data structure that is shown in this post ?

    Any help will be appreciated,


  2. Iliana Nikolova
    Iliana Nikolova avatar
    2602 posts

    Posted 29 Jun 2016 Link to this post

    Hi Geroj,

    The issue is caused by there is a different number of points in each of the groups - in this case you need to use series.categoryField instead of categoryAxis.field (documentation link). For your convenience below is an updated example:

    Iliana Nikolova
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top