How do I draw lines over an image?

« 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 Patrick on 26th March 2014
In the following, drawing the image eliminates the line no matter the order I draw in. Other elements like the circle I show here do not eliminate the line and are not eliminated by the image. I would like to draw labelled dashed dimension lines, preferably arrows, on the image. I have successfully drawn the dashed lines, but cannot get them to draw over the image. I show a solid line here for simplicity.

// place sketch of a car in the center of the chart area
   var carsketch = new RGraph.Drawing.Image
                 .Set('width', carWidth)
                 .Set('height', carWidth/4)
                 .Set('halign', 'center')
                 .Set('valign', 'center')
                 .Set('alpha', .5)
// place circle for cg location
  var cg = new RGraph.Drawing.Circle('cvs', cgX, cgY, radius)
                .Set('strokestyle', 'black')
                .Set('fillstyle', 'rgba(255,0,0,0.7)')

// draw wheelbase line
  var wbLine = document.getElementById("cvs").getContext('2d');
Posted by Richard on 26th March 2014
Hi there,

Try adding the line using the ondraw event of the last object that you draw:

cg.ondraw = function (obj)
     // draw wheelbase line
     var co = obj.context;

Posted by Patrick on 26th March 2014
Thank You. That worked, but I'm not sure why. I'll place all my added lines inside the ondraw event. Is there a simple arrow line end style?
Posted by Richard on 26th March 2014
Hi there,

The only arrow end is a tickmark style for the Line chart - there's no general purpose one.


Add a reply

« Back to message list