I'm loading a store dynamically to a chart, my problem is that when the new chart is loaded, the old one (bars/lines) is still showing behind the new one. This is how I remove the old chart :
我正在动态地将商店加载到图表中,我的问题是,当加载新图表时,旧图表(条形图/线条)仍然显示在新图表后面。这是我删除旧图表的方法:
var removeChart = function (chart) {
var series = chart.series.items, surface = chart.surface,
length = series.length, len = surface.groups.keys.length,
array = [];
for (var i = 0; i < length; i++)
array = Ext.Array.merge(array, series[i].group.keys);
chart.series.clear();
for (var j = 0; j < array.length; j++){
surface.items.getByKey(array[j]).destroy();
};
for (var t = 0; t < len; t++)
surface.groups.items[t].destroy();
};
Then I call removeChart(chart);
and finally add new series config and finish with chart.redraw();
然后我调用removeChart(图表);最后添加新系列配置并完成chart.redraw();
What am I doing wrong please??
我做错了什么?
1 个解决方案
#1
2
You don't need to remove the chart to accomplish what you want.
您无需删除图表即可完成所需操作。
Just reload the store, add the series, and redraw.
只需重新加载商店,添加系列,然后重新绘制。
When you do it this way, you'll also get a cool animation (if you want animation).
当你这样做时,你也会得到一个很酷的动画(如果你想要动画)。
#1
2
You don't need to remove the chart to accomplish what you want.
您无需删除图表即可完成所需操作。
Just reload the store, add the series, and redraw.
只需重新加载商店,添加系列,然后重新绘制。
When you do it this way, you'll also get a cool animation (if you want animation).
当你这样做时,你也会得到一个很酷的动画(如果你想要动画)。