剑道chart.redraw()方法在IE8中不起作用

时间:2013-05-13 18:21:53

标签: javascript jquery kendo-ui

我目前使用的是一个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方法以外的其他方法。那将是一个巨大的帮助。

1 个答案:

答案 0 :(得分:0)

问题解决了,错误是

text: leftData.MeasurementTypeGroupName + (leftData.SeriesData[0].UnitName.length > 0 ? " (" + leftData.SeriesData[0].UnitName + ")" : ""),

从标题{}对象中删除该行解决了这个问题。