【发布时间】:2020-03-16 03:20:39
【问题描述】:
我正在为我们的图表使用 Amcharts 3,并且我正在动态地在图表上添加/删除指南。如果用户选择了一个复选框,那么它会在图表中添加 2 个指南,但如果用户取消选择该复选框或选中另一个复选框,我希望删除这些指南。到目前为止,我已经正确添加了指南,但是当用户选择/取消选择另一个复选框时,由于某种原因,指南没有被删除。
这是我用来添加/删除指南的代码:
let posReportTypeChart = chartingManager.getChartById("posReportType");
// If only one Checkbox is Selected, add the Guides to the chart
if (this.selectedQrCount == 1) {
let selected = qrGridEvents.grid.dataSource.data().filter(x => x.IsSelected == true);
let guideEffDate = this.getNewGuide(selected[0].EffectiveDate);
let guideEndDate = this.getNewGuide(selected[0].EndDate);
posReportTypeChart.guides.push(guideEffDate);
posReportTypeChart.guides.push(guideEndDate);
this.reDrawPOSReportTypeChart(posReportTypeChart);
}
else if (posReportTypeChart.guides.length > 1) {
posReportTypeChart.guides = [];
this.reDrawPOSReportTypeChart(posReportTypeChart);
}
// This is the function that I am using to redraw the chart. For some reason it is
adding the Guides fine but whenever I go to remove the Guides this isn't working.
private reDrawPOSReportTypeChart = (chart: any) => {
chartingManager.charts[3] = chart;
chart.dataProvider = chartingManager.itemChartingData;
chart.validateNow(true, false);
chart.invalidateSize();
chart.legend.validateNow();
}
【问题讨论】:
标签: asp.net-mvc typescript kendo-grid amcharts