Drawing API - bounding box width & placement


« 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 Matt on 6th June 2014
Can anyone elaborate on the x and y coordinates passed in the RGraph.Drawing.Text call?

Do they change based on the halign or valign settings?

If your text is right-aligned (.Set('halign', 'right') it is very difficult to get consistent placement, since it seems like the X-coord set in the call is for the starting (left) side of the text. If the text includes a variable it will change the bounding box width and placement a bit unpredictably.
Posted by Richard on 9th June 2014
The coordinates don't change - the alignment of the text around those coordinates will change depending on those settings. So when halign is left the left of the text will be aligned with those coordinates, and when it's right the right of the text will be aligned with the coordinates.

It will probably help you if you specify the marker option (set it to true). This marker will be placed on the coordinates and won't move - it will give you a visual cue.

Eg:


var text = new RGraph.Drawing.Text('cvs', 50,50,'A custom title using the drawing API text object')
    .set('halign', 'left')
    .set('valign', 'top')
    .set('marker', true)
    .draw();




Richard

Add a reply

 




« Back to message list
RGraph on social media