【问题标题】:ChartJS v2.6 update breaks custom line-with-area-range (stripe) chartChartJS v2.6 更新打破了自定义 line-with-area-range (stripe) 图表
【发布时间】:2017-06-22 10:42:55
【问题描述】:

我创建了一个基于来自@potatopeelings 的this helpful answer 的带区域范围(条纹)图表。

但是它基于 ChartJS v2.1,当我更新到 ChartJS v2.6 - 其他要求(注释)所必需的 - 自定义图表类型中断。

示例

ChartJSv2.1 - http://jsfiddle.net/u20cfpcd/

ChartJSv2.6 - http://jsfiddle.net/cjweb/99nc8atn/

这些换行符:

Chart.elements.Line.prototype.lineToNextPoint.apply(...)

Chart.controllers.line.prototype.updateBezierControlPoints.apply(...)

我认为 Line 原型现在应该使用“draw”,但我无法解决。

有什么帮助吗?我给你买一大口! ;)

【问题讨论】:

  • 我添加了console.log(Chart.elements.Line.prototype);,似乎lineToNextPoint 函数已从prototype 中删除。

标签: javascript canvas charts chart.js


【解决方案1】:

解决了。

lineToNextPoint() 已过时,可以使用 lineTo() 助手。

所以...

Chart.elements.Line.prototype.lineToNextPoint.apply({ _chart: { ctx: ctx } }, [previous, point, next, null, null])

...替换为:

helpers.canvas.lineTo(ctx, previous._view, point._view);

【讨论】:

    猜你喜欢
    • 2016-11-27
    • 2017-02-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-20
    相关资源
    最近更新 更多