View Full Version : [Chart] Clear old series markers

10 Dec 2011, 5:56 PM

what is the best way to remove the old series' sprites before (after) calling chart.redraw()?

Basically, I am trying to define a chart that can dinamically adapt to various kinds of stores with column counts known only at runtime. I have succesfully managed to update the axes and series, however after calling redraw()/refresh(), the old series' sprites still remain.

This is my code for binding a new store to the chart (this.chart is the chart, this is a wrapper panel):

setStore: function(store){
this.store = store;

var fields = this.store.model.prototype.fields.keys;

this.chart.axes.items[1].fields = fields; //just want to change the left axis, bottom stays the same

for (var i = 1; i<fields.length; i++){

this.dataView.series.add({type: 'line', axis: 'left', highlight: true, xField: 'startDate', yField: fields[i]});


this.chart.store = store;


This code currently just draws the newly configured chart over the old one, keeping the old records visible. What is the best way to clear the background surface of a chart?

Thank you for your time.

12 Dec 2011, 12:08 PM
It may be better to remove the chart and reinstantiate it.