Chart.js 给定x值的(缩放)y值
我正在修改一些示例[1][2],以便在画布上画一条线。对于端点,我已经计算了一个数据值,但现在我想计算画布上的y值。 在我找到的例子中Chart.js 给定x值的(缩放)y值,chart.js,chart.js2,Chart.js,Chart.js2,我正在修改一些示例[1][2],以便在画布上画一条线。对于端点,我已经计算了一个数据值,但现在我想计算画布上的y值。 在我找到的例子中 this.chart.chart.scale.getPixelForValue() 这在chart.js 2.6中似乎已被弃用 // Used to get data value locations. Value can either be an index or a numerical value getPixelForValue: helpers.noo
this.chart.chart.scale.getPixelForValue()
这在chart.js 2.6中似乎已被弃用
// Used to get data value locations. Value can either be an index or a numerical value
getPixelForValue: helpers.noop,
第一个例子使用
this.calculatePointY()
但这也帮不了我
我会用什么来代替呢
[注]:此问题类似,但没有答案:
[1]
[2] 对于ChartJS-Version2.6,您应该使用以下内容
chart.scales['y-axis-0'].getPixelForValue(<value>);
chart.scales['y轴-0'].getPixelForValue();