我要在amchart中创建实时饼图,但是当我在代码中使用addData时,已经有数据添加到我以前拥有的数据中,并删除了addData中的数据不能正常工作,我的代码是< / p>
function topProtocol() {
am4core.useTheme(am4themes_animated);
var chart_tp = am4core.create("top-protocol", am4charts.PieChart3D);
chart_tp.hiddenState.properties.opacity = 1; // this creates initial fade-in
chart_tp.innerRadius = am4core.percent(30);
chart_tp.depth = 120;
// Create series
chart_tp.legend = new am4charts.Legend();
var series_tp = chart_tp.series.push(new am4charts.PieSeries3D());
series_tp.hidden = false;
series_tp.interpolationDuration = 20000;
// series.renderer.inside = true;
series_tp.dataFields.value = "value";
series_tp.dataFields.depthValue = "value";
series_tp.dataFields.category = "label";
series_tp.slices.template.cornerRadius = 5;
series_tp.colors.step = 3;
series_tp.labels.template.disabled = false;
series_tp.ticks.template.disabled = false;
series_tp.slices.template.configField = "config";
intervaltp = setInterval(function(){
var i=0;
console.log(topPro)
console.log(i);
chart_tp.data(topPro)
i=+1;
}, 3000);
startInterval(intervaltp)
}