Stack and DataSource

2 posts, 0 answers
  1. Andrey
    Andrey avatar
    16 posts
    Member since:
    Oct 2019

    Posted 18 Feb Link to this post

    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"}])
    })

  2. Nikolay
    Admin
    Nikolay  avatar
    36 posts

    Posted 20 Feb Link to this post

    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.
Back to Top