我目前使用一个 KendoUI Chart 对象,其中正在添加动态数据。有动态数据被添加到数据点以及值轴。当试图在图表上运行 .redraw() 方法以重新绘制整个事物而不是仅仅更新数据点时,IE8 会抛出无效参数错误以及由于 80020101 而无法完成操作。
删除 redraw() 语句可以解决此问题并允许图表呈现,但更新轴和图表的部分不能作为一个整体。这是失败的代码部分。
//add value axis:
var chartOptions = metricsChart.options;
var valueAxis = metricsChart.options.valueAxis;
chartOptions.valueAxis = []; //reset value axis
chartOptions.valueAxis.push(valueAxis);
//chartOptions.valueAxis.push({}); //right value axis
//left value axis:
chartOptions.valueAxis[0] = {
name: leftData.MeasurementTypeGroupName, //"blood pressure"
title: {
text: leftData.MeasurementTypeGroupName + (leftData.SeriesData[0].UnitName.length > 0 ? " (" + leftData.SeriesData[0].UnitName + ")" : ""),
font: "12px",
color: "gray"
},
color: "gray",
labels: {
format: "{0}",
},
majorGridLines: {
visible: false
},
min: yAxisMin,
max: yAxisMax,
//there are three plot bands: (yAxisMin, rangeLow), (rangeLow, rangeHigh), ( rangeHigh, yAxisMax)
plotBands: [{
from: yAxisMin,
to: rangeLow,
color: bottomPlotColor,
opacity: 0.8
}, {
from: rangeLow,
to: rangeHigh,
color: middlePlotColor,
opacity: 0.8
}, {
from: rangeHigh,
to: yAxisMax,
color: topPlotColor,
opacity: 0.8
}]
};
for ( var j = 0; j < leftData.SeriesData.length; j ++) {
chartOptions.series[j].axis = leftData.MeasurementTypeGroupName; //e.g. "blood pressure";
}
metricsChart.redraw();
}
目前这是一个巨大的破坏者,如果有人有另一种方法,他们可以推荐除 .redraw 方法之外的方法。那将是一个巨大的帮助。