Thickness of line.ondraw

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« 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?

dev.rgraph.net/fiddle/view/c963efc8d41a3c99116950c8f54ffd5a



PS Please remember to link to the RGraph website - cheers!





Richard, RGraph Support

5 developer license with Priority support for £299:
   www.rgraph.net/license#five-developer

Add a reply




« Back to message list