我尝试显示堆积的折线图,但是它不起作用。 您能用以下代码建议在哪里更改?
window.onload=function(){
var ctx = document.getElementById("myChart").getcontext("2d");
var data = {
labels: {{subcategories|tojson}},datasets: [
{
1st_sample_dataset
},{
2nd_sample_dataset
}
]
},options = {
scales: {
yAxes: [{
stacked: true
}]
}
};
new Chart(ctx).Line(data,{
onAnimationComplete: function () {
var sourceCanvas = this.chart.ctx.canvas;
var targetctx = document.getElementById("myChartAxis").getcontext("2d");
targetctx.canvas.width = copyWidth;
targetctx.drawImage(sourceCanvas,copyWidth,copyHeight,copyHeight);
}
});
}