Hi
I've looked at the Canvas demo to draw a rectangle, but I can't see how to draw a line? Is there a specific function that I can't find?
Please could you point me to the documentation or offer some basic code to draw a horizontal line on a line chart.
Many thanks
Draw a line on the canvas
Re: Draw a line on the canvas
Hello,
You have to use the stroke as explained here.
Here a simple example using a chart:
You have to use the stroke as explained here.
Here a simple example using a chart:
Code: Select all
var myFormat = new Tee.Format(Chart1);
myFormat.stroke.fill = "rgb(250, 83, 55)";
Chart1.ondraw=function() {
var x1 = Chart1.axes.bottom.calc(2),
y1 = Chart1.axes.left.calc(70),
x2 = Chart1.axes.bottom.calc(4),
y2 = Chart1.axes.left.calc(40);
Chart1.ctx.beginPath();
Chart1.ctx.moveTo(x1, y1);
Chart1.ctx.lineTo(x2, y2);
myFormat.stroke.prepare();
Chart1.ctx.stroke();
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |