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

Support for multiple series types when binding to local grouped data?

1 Answer 139 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Pete
Top achievements
Rank 1
Pete asked on 14 Aug 2012, 03:19 AM
I want to render a chart where all but one of the series are stacked columns.  The other series is a line.  This works fine if I embed the series data within the JSON object passed to kendoChart(), but if I want to bind to a local variable holding grouped data, I don't see a way to associate a chart type to each of the groups.  Is this a shortcoming of the tool, or am I missing something?

Here's what the code looks like when I embed the series data within the JSON object (the chart CORRECTLY renders the "Expenses" series as a line chart...and the others are CORRECTLY rendered as stacked columns):

function createChart() {
    $("#chart").kendoChart({
        seriesDefaults: {
            type: "column",
            stack: true
        },
        series: [{
            name: "Expenses",
            data: [50000, 50000, 50000, 50000],
            type: "line"
        }, {
            name: "Pension Annuity",
            data: [12000, 12000, 12000, 12000]
        }, {
            name: "Social Security",
            data: [24000, 24000, 24000, 24000]
        }],
        categoryAxis: {
            categories: [65, 66, 67, 68]
        }
    });
}

However if I switch this code to bind to local grouped data, I can't see a way to set the 2 different chart types to match this.  Any ideas?

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 16 Aug 2012, 08:53 PM
Hi Pete,

I am not sure if I understand you correctly. By design there are two main approaches that could be applied in order to stack the bars in Kendo UI Chart:
  • Set stack: true property to the SeriesDefaults;
  • Stack with group name for each of the series. For convenience I prepared a small example which illustrates such approach in action.

I hope this helps. Please let me know in case I missed something. 

Kind regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Charts
Asked by
Pete
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or