我正在努力通过将 chartJS v1.x 的绘制图表函数重写到 v2.0 来为我的图表添加功能。图表绘制函数中的许多功能在 v1.x 中使用“self.scale.endPoint”,但看起来 v2.0 结构中有很多变化,我无法找到它。 喜欢这里:
// the min is required so animation does not start from below the axes
bar.y = Math.min(bar.y + radius, self.scale.endPoint - 1);
我如何使用这个值?
JSFiddle可以看到here .
最佳答案
在 chartJS v2.x 中,您必须指定要访问的轴(因为它们现在支持多个)。对于您的问题,您想使用默认的 y 轴,应该可以通过这种方式访问它
this.chart.scales["y-axis-0"]
虽然我自己没有测试过,但我认为 endPoint 现在被称为 bottom,因此你可以像这样得到相同的值:
this.chart.scales["y-axis-0"].bottom
关于javascript - 什么是 self.scale.endPoint chartJs v2.0?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38717688/