[Chartjs]-Extending Line Chart with custom line

8👍

You could override the draw function to append your drawing on to the canvas

draw: function () {
    //call the super draw
    Chart.types.Line.prototype.draw.apply(this, arguments);

    //now your custom line
    this.chart.ctx.beginPath();
    this.chart.ctx.moveTo(0, 5);
    this.chart.ctx.lineTo(100, 100);
    this.chart.ctx.stroke();
}

fiddle http://jsfiddle.net/leighking2/5Lgzvu3r

Leave a comment