Chart not showing updated series (redisplay?)

2 posts, 0 answers
  1. Dr.YSG
    Dr.YSG avatar
    210 posts
    Member since:
    Dec 2009

    Posted 18 Apr 2012 Link to this post

    I have a chart control defined in a .js file:

    var chartViewer;
     
    function buildChart() {
        chartViewer = $("#chartPane").kendoChart({
            title: {
                text: "Type by Distributor"
            },
            dataSource: searchData,
            autoBind: false,
            seriesDefaults: {
                type: "column"
            },
            series: typeSeries,
            tooltip: {visible: true}
        });
        chartViewer = $("#chartPane").data("kendoChart");
    }

    In the datasource I do an update of the series each time the grid regroups the values (notes: newData is the change: function, and typeSeries is a global variable:

    function newData(e) {
        var items = searchData.view();
        var length = items.length;
        var item;
        $("#recCount").text(searchData.total());
     
        typeSeries = []; 
        for (var i = 0; i < length; i++) {
            item = items[i];
            typeSeries.push({ name: item.value, data: [item.aggregates.type.count] })
        }
    //    rebuildChart();
    }


    But I am not seeing anything in the chart. (blank columns). I tried a chartViewer.refresh() but that just gave a i/o error. I need to set autoBind to false, since I need to poll the server at specific times for the JSON data to populate the datasource.



    I know  that my code is pretty close, since this JsFiddle test that I did shows that I can create a series and use it to display a chart. But here the data is all local, and I need a remote JSON source.

    http://jsfiddle.net/drysg/gezJd/6/
  2. Gergo
    Gergo avatar
    20 posts
    Member since:
    Mar 2012

    Posted 20 Apr 2012 Link to this post

    Hi Dr. YSG,

    Try to use datasource.fetch() or datasource.sync() methods, instead of refresh().

    Regards,
    Gergő
  3. Kendo UI is VS 2017 Ready
Back to Top