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

[Solved] How to update data on donut chart?

3 Answers 326 Views
Chart for HTML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Melicaster
Top achievements
Rank 1
Melicaster asked on 24 Jun 2014, 07:47 AM
I been reading some donut chart info the support documentation. I do have a donut chart that need to be updated when new data comes in. These data is stored locally. Is there anyway to update those data and reflect on the donut chart?

I had made some example of the source code as below:

var donutSeriesChartCtrl = new Telerik.UI.RadChart(document.getElementById("donutSeriesChart"));
var donutSeries = new Telerik.UI.Chart.DonutSeries();
donutSeries.data = [16.7, 20, 15.7, 26.6, 23.5];
donutSeriesChartCtrl.series.push(donutSeries);
donutSeriesChartCtrl.refresh();

I have new data like "[50,0,40,6,4]". How to I update the donutSeries.data and reflect it to the donut chart?

3 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 24 Jun 2014, 12:15 PM
Hi Melicaster,

With this chart declaration, you can change the series data with the following code:

donutSeriesChartCtrl.series[0].data = [50, 0, 40, 6, 4];
donutSeriesChartCtrl.refresh();

Additionally, you can take a look at the following article to see what are the other possible options for binding a RadChart control:
Data Binding

Regards,
Tsvetina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Melicaster
Top achievements
Rank 1
answered on 24 Jun 2014, 04:16 PM
Thank you...! It is working...

When the app is doing donutSeriesChartCtrl.refresh();, is it possible to disable the animation?
0
Tsvetina
Telerik team
answered on 25 Jun 2014, 06:50 AM
Hi Melicaster,

You can turn of animations for your chart by setting its transitions property to false:
var donutSeriesChartCtrl = new Telerik.UI.RadChart(document.getElementById("donutSeriesChart"), {
    dataSource: {
        data: [
            { val: 16.7 },
            { val: 20 },
            { val: 15.7 },
            { val: 26.6 },
            { val: 23.5 }
        ]
    },
    series: [
        {
            type: "donut",
            field: "val"
        }
    ],
    transitions: false
});


Regards,
Tsvetina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Chart for HTML
Asked by
Melicaster
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Melicaster
Top achievements
Rank 1
Share this question
or