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

Stack and DataSource

1 Answer 24 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Andrey
Top achievements
Rank 1
Veteran
Andrey asked on 18 Feb 2020, 02:16 PM

Hi, Dev Team!

For my bar chart i create DataSource dinamycally/

its looks like below:

var docChartData = [];

this.data().forEach(function (item) {
   docChartData.push({ Name: "some name", Value: "some value", Color: "red"})
})

So, I want to stack my chart. how can i add additional stack serie. i try like this, but it didnt work

this.data().forEach(function (item) {

   docChartData.push([{ Name: "some name", Value: "some value", Color: "red"},Name: "some name", Value: 100% - "some value", Color: "GRAY"}])
})

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 20 Feb 2020, 12:26 PM

Hello Andrey,

You can manipulate the series.data arrays and then call the refresh() method of the Kendo UI Chart to visualize the new options:

var newStack = {
          name: "Platinum Medals",
          data: [80, 32, 34, 18, 45, 33, 34, 83, 43, 37, 44, 37, 54, 36, 46],
          color: "pink"
        };
        var chart = $("#chart").data("kendoChart");
        chart.options.series.push(newStack)
        chart.refresh();

Please refer to the following Dojo demo I have prepared demonstrating the above:

Let me know if further questions arise.

Regards,
Nikolay
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Charts
Asked by
Andrey
Top achievements
Rank 1
Veteran
Answers by
Nikolay
Telerik team
Share this question
or