Thickness of line.ondraw

Share RGraph:   Share or Like RGraph on Facebook!

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Todd on 8th May 2013
Hello!
I have the following function to draw a dotted line across my line chart. The dotted line works, but I can't figure a way to increase its thickness, I tried:
                 obj.context.linewidth = '3';
                 obj.context.lwd = '3';

Can't figure it out.. here is my code:

             line.ondraw = function (obj)
             {
                 var y = Math.round(obj.getYCoord(<? echo $avg;?>));
                 var x1 = obj.Get('chart.gutter.left');
                 var x2 = obj.canvas.width - obj.Get('chart.gutter.right')-3;
                 obj.context.beginPath();
                 obj.context.strokeStyle = '#F82222';
                 obj.context.linewidth = '3';
                 RGraph.DashedLine(obj.context, x1, y, x2, y);
                 obj.context.stroke();
             }
Thanks!
Posted by RGraph support on 8th May 2013
Hi there,

Your problem is this line:

obj.context.linewidth = '3';

It should be a number - like this:

obj.context.linewidth = 3;


BTW Did you know that there's a dotted/dashed line function already in RGraph?





Richard

Add a reply




« Back to message list