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

How to add data to StockChart but not redraw all the chart?

1 Answer 122 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Levon
Top achievements
Rank 1
Levon asked on 20 Feb 2013, 07:23 AM
hello:
I have a problem about StockChart. Our requirement is to add new data to the StockChart after I get the new data from server. the following code is just a test fragment. But the problem is in the update function when I add the new data to StockChart. the stockchart will totally redraw all the chart. If add the new data to the chart frequently, it is not tolerated. we just need to add the new data at the end of line chart smoothly.  So do you know some options that I can use in this case?
         
  $("#container").kendoStockChart({
                title: {
                    text: "My test"
                },
                dateField: "D",
                dataSource: {
                  transport: {
                      read:"url to get datas"
                  }
              },
                series:[{
                    type:"line",
                    field:"V"
                }],
                axisDefaults:
                {
                    valueAxis: {
                        labels: {
                        template: "#=value#",
                        visible: true
                    }
                    }
                },
                navigator: {
                    series: {
                        type:"line",
                        field:"V"
                    }
                }
            });


            var updatefunction = function () {

                var kendoStockChart = $("#container").data("kendoStockChart");
                var d = new Date();
                kendoStockChart.dataSource.add({"D":d.getTime(),"V":1000});
                setTimeout(updatefunction, 10000);

            };
            setTimeout(updatefunction, 10000);

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 21 Feb 2013, 07:41 PM
Hi Levon,

I am afraid what you would like to achieve is not supported -> by design each change (adding, removing etc.) in the data will cause Kendo UI Chart to refresh and this behavior cannot be prevented. Please accept my apologies for the inconvenience caused.

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
Levon
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or