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

Chart not showing updated series (redisplay?)

1 Answer 139 Views
Charts
This is a migrated thread and some comments may be shown as answers.
Dr.YSG
Top achievements
Rank 2
Dr.YSG asked on 18 Apr 2012, 04:50 PM
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/

1 Answer, 1 is accepted

Sort by
0
Gergo
Top achievements
Rank 1
answered on 20 Apr 2012, 10:12 PM
Hi Dr. YSG,

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

Regards,
Gergő
Tags
Charts
Asked by
Dr.YSG
Top achievements
Rank 2
Answers by
Gergo
Top achievements
Rank 1
Share this question
or