Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Is it possible to have stacking using JSON like data

$
0
0

Hi,

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":1,"Year":2012,"Expense":274.91,"color":"grey"},
    {"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"}
];

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":1,"Year":2012,"Expense":274.91,"color":"grey"},
    {"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],
                  color:"orange"
                }, {
                    name: "name 1",
                    data: [0, 200, 274],
                  color:"grey"
                }, {
                    name: "name 5",
                    data: [100, 205, 315.84 ],
                  color:"red"
                },
                  {
                    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,

Geroj


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>