Highlight specific values on a line chart

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 Erin on 4th August 2014
Hi mate

Say I have a line graph with a set of values. I wish to highlight one specific value with a label / text. for example - say I have a X-Y line chart while x between 0-1000 and Y between 0-1000, and I have a line drawn by the set of values. However I want to highlight point [450,350] with a red tickmark or test balloon. Could that be done?

Thanks :-)
Posted by Richard on 5th August 2014
1. For an XY chart you'll need to use a Scatter chart with the option enabled. The Line chart has no X scale.
2. Use the obj.getXCoord(450) and obj.getYCoord(350) methods to get the coordinates on the canvas and then draw on the canvas with ther standard canvas API using the context which is held at obj.context. If you find that too verbose you could use the RGraph path function:

RGraph.Path(scatter.context, ['b', 'a', x, y, 5, 0, 6.28, false, 'f', 'red']);

More on that function in the API docs:

www.rgraph.net/api






Richard

Add a reply




« Back to message list