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

Chart doesn't refresh

9 Answers 1713 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Pradyumna
Top achievements
Rank 1
Pradyumna asked on 05 Oct 2012, 05:38 AM
Hi,

I am using dataviz-version-710 for the charts. I copied the code from the sample and tried to run it.
But some how the chart doesn't refresh.

var chart = $("#chart").data("kendoChart"),
                        series = chart.options.series,
                        type = $("input[name=seriesType]:checked").val(),
                        stack = $("#stack").prop("checked");

                    for (var i = 0, length = series.length; i < length; i++) {
                        series[i].stack = stack;
                        series[i].type = type;
                    };

chart.refresh();

Can thing I missed here? please suggest.

9 Answers, 1 is accepted

Sort by
0
Igor
Top achievements
Rank 2
answered on 15 Oct 2012, 07:21 PM
hey!

try this:

chart.dataSource.read();
chart.refresh();
0
George
Top achievements
Rank 2
answered on 12 Dec 2012, 09:37 PM
Wow.  Chart.DataSource.Read(); was exactly what I was looking for.  Where is the documentation that describes all of the methods available for chart.dataSource.whatever()?  The API documentation available from the website is limited.  For example, dataSource is mentioned but does not go over each member function like read().
0
Igor
Top achievements
Rank 2
answered on 13 Dec 2012, 05:51 AM
0
Sebastian
Telerik team
answered on 13 Dec 2012, 02:48 PM
And also this one:
http://docs.kendoui.com/api/dataviz/chart#refresh

Greetings,
Sebastian
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Pascal
Top achievements
Rank 1
answered on 21 Mar 2013, 10:23 AM
I had the same problem and don't understand why the call to refresh doesn't reload the data as described in the documentation. If I have to manually call read on the datasource what's the point of the refresh method compared to redraw? Shouldn't the refresh method internally call read on the datasource? If that is not the case what does "reloads the data" mean?
0
Igor
Top achievements
Rank 2
answered on 21 Mar 2013, 10:32 AM
Pascal, please provide the code you using?
datasource is the different object, bound to your visual (such as chart). when you refresh the visual, you probably want to do it as fast as possible without additional data reading from the server.
0
Pascal
Top achievements
Rank 1
answered on 21 Mar 2013, 11:03 AM
I just looked at the charts code and saw, that it just calls the view method on the datasource to get the data. This makes sense when for example only filters changed. In my case the data property of the transport objects changed and I want to get a new resultset from the server. It seems like I need to manually call read in this case, which works fine and is ok for me. I was just a bit confused by the term "reloads the data" in the refresh method's documentation. Maybe you should point out that this reload does not include a call to the server, but only refreshes the datasources view.
0
Igor
Top achievements
Rank 2
answered on 21 Mar 2013, 11:08 AM
Ok, it makes sense for me what you mean.
Let's wait for KendoUI team to answer about the methods design.
0
Hristo Germanov
Telerik team
answered on 21 Mar 2013, 12:20 PM
Hi guys,

Redraw and Refresh of the chart are slightly different.
Refresh will redraw your chart with the new data if you change it from the javascript object. We can't refresh your DataSource, because we don't know what you need to do(fetch, read or query).

Regards,
Hristo Germanov
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
Pradyumna
Top achievements
Rank 1
Answers by
Igor
Top achievements
Rank 2
George
Top achievements
Rank 2
Sebastian
Telerik team
Pascal
Top achievements
Rank 1
Hristo Germanov
Telerik team
Share this question
or