【发布时间】:2017-04-06 06:24:32
【问题描述】:
我希望我的图表具有固定 y 轴的水平滚动。 发现类似http://jsfiddle.net/mbhavfwm/
new Chart(ctx).Line(data, {
onAnimationComplete: function () {
var sourceCanvas = this.chart.ctx.canvas;
var copyWidth = this.scale.xScalePaddingLeft - 5;
// the +5 is so that the bottommost y axis label is not clipped off
// we could factor this in using measureText if we wanted to be generic
var copyHeight = this.scale.endPoint + 5;
var targetCtx = document.getElementById("myChartAxis").getContext("2d");
targetCtx.canvas.width = copyWidth;
targetCtx.drawImage(sourceCanvas, 0, 0, copyWidth, copyHeight, 0, 0, copyWidth, copyHeight);
}});
对于 v.1,但对于 v.2,代码似乎不同
我在文档中没有看到此参数或选项。有什么想法吗?
【问题讨论】:
标签: javascript chart.js