使用过多系列

时间:2017-06-07 09:27:30

标签: charts chart.js angular-chart

我在一个应用程序中使用角度图表,基本上使用图表js。我现在使用的图表js的版本是2.4.0,角图表版本1.1.1(当前最新版本)。 因此,当我插入几个系列(例如4)时,一切正常。问题是当我有一次处理10个系列的情况。单击系列以隐藏它以某种方式阻止的事件,此错误显示在控制台中:

Uncaught TypeError: Cannot read property 'clearRect' of null
at Object.helpers.clear (Chart.js:5880)
at Chart.Controller.clear (Chart.js:4072)
at Chart.Controller.draw (Chart.js:4365)
at ChartElement.animation.render (Chart.js:4345)
at Object.startDigest (Chart.js:3672)
at Chart.js:3645

为了帮助您,我移动到了Chart.js文件中出现错误的行:

// -- Canvas methods
helpers.clear = function(chart) {
    chart.ctx.clearRect(0, 0, chart.width, chart.height);
};

有没有人有这个问题? Chart js是否不能处理许多系列?

由于

1 个答案:

答案 0 :(得分:0)

当我的颜色用完我的系列时,发生在我身上。一旦我修复了系列的隐藏和显示工作正常,再加上错误。