This is a migrated thread and some comments may be shown as answers.

Stack multiple series

1 Answer 169 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Ahmed
Top achievements
Rank 1
Ahmed asked on 02 Apr 2012, 09:40 AM
I tried to stack Project 1 and Project 2 and put the total in line graph. however, project 1 and 2 are not stacking up.

Any idea what is the problem?

var
data = [{"TimeSeries":"2011-Jan","Project2":"225.13","Project1":"311.17","Total":"268.15"},{"TimeSeries":"2011-Feb","Project2":"235.57","Project1":"321.29","Total":"278.43"},{"TimeSeries":"2011-Mar","Project2":"245.38","Project1":"340.67","Total":"293.03"},{"TimeSeries":"2011-Apr","Project2":"232.6","Project1":"320.38","Total":"276.49"}];

$(document).ready(function() {
$("#chart").kendoChart({
theme: "silver",
title: {
text: "Total records processed"
},
legend: {
position: "bottom"
},
dataSource: {
data: data,
},
transitions: false,
series: [{
type: "column",
field: "Project1", stack:true },{
type: "column",
field: "Project2", stack:true },{
type: "line",
field: "Total" }
],
categoryAxis: {
field: "TimeSeries"
}
});
});

1 Answer, 1 is accepted

Sort by
0
Ahmed
Top achievements
Rank 1
answered on 02 Apr 2012, 09:49 AM
Just after i post, i found a solution. Here is the code update.

series: [{
type: "column",
field: "Project1", name:"P1", stack:"P2"},{
type: "column",
field: "Project2", name:"P2" }],

Assign 'name' of series two in the 'stack' of Series one.

Thanks
Tags
Charts
Asked by
Ahmed
Top achievements
Rank 1
Answers by
Ahmed
Top achievements
Rank 1
Share this question
or