Chart doesn't refresh

10 posts, 0 answers
  1. Pradyumna
    Pradyumna avatar
    2 posts
    Member since:
    Aug 2011

    Posted 05 Oct 2012 Link to this post

    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.
  2. Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011

    Posted 15 Oct 2012 Link to this post

    hey!

    try this:

    chart.dataSource.read();
    chart.refresh();
  3. George
    George avatar
    3 posts
    Member since:
    Nov 2012

    Posted 12 Dec 2012 Link to this post

    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().
  4. Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011
  5. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 13 Dec 2012 Link to this post

    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!
  6. Pascal
    Pascal avatar
    8 posts
    Member since:
    Nov 2012

    Posted 21 Mar 2013 Link to this post

    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?
  7. Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011

    Posted 21 Mar 2013 Link to this post

    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.
  8. Pascal
    Pascal avatar
    8 posts
    Member since:
    Nov 2012

    Posted 21 Mar 2013 Link to this post

    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.
  9. Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011

    Posted 21 Mar 2013 Link to this post

    Ok, it makes sense for me what you mean.
    Let's wait for KendoUI team to answer about the methods design.
  10. Hristo Germanov
    Admin
    Hristo Germanov avatar
    703 posts

    Posted 21 Mar 2013 Link to this post

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