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

What is different between refersh method and redraw method in kendoui chart?

1 Answer 438 Views
Grid
This is a migrated thread and some comments may be shown as answers.
youknowme
Top achievements
Rank 1
youknowme asked on 20 Feb 2014, 01:50 PM


I find the kendoui chart has two methods :refersh method and redraw method,what is the difference?I think both of them is to draw the chart again. But if the chart is binding from remote data according to ajax,the request will not fire again.

$("#Chart").data("kendoChart").redraw();
$("#Chart").data("kendoChart").refresh();
I have a situation,at first I have a page which is to draw a chart with autobind from remote data,Now I want to add a line in this chart,it means I have to change the datasource( add the line data to the datasource),Which method should I use best?I find use refresh or redraw method are both OK.

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 24 Feb 2014, 08:51 AM
Hello,

There is no need to call either method provided that you set up your series in advance. For example:

   var ds = new kendo.data.DataSource({
      data: [{ a: 1 }, { a: 2 }]
    });

    $("#chart").kendoChart({
      dataSource: ds,
      series: [{
          field: "a"
      }, {    
          // No data for "b" initially
          field: "b"
      }]
    });
    
    // Data for "b" becomes available
    // A change event is triggered automatically
    ds.data([{ a: 1, b: 10 }, { a: 2, b: 20 }])


If the series fields are not known in advance then you need to use setOptions to define them:

    $("#chart").kendoChart({
      dataSource: ds,
      series: [{
          field: "a"
      }]
    });
    
    // ...
    
    $("#chart").data("kendoChart").setOptions({
      series: [{
          field: "a"
      }, {
          field: "b"
      }]
    })


I hope this helps.

Regards,
T. Tsonev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
youknowme
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or