Offset a Line chart horizontally?


« 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 Jason Black on 17th January 2013
I need to do a graph where the data points lie in between the labels, horizontally. In my case, the labels are items that come in a sequence, and the data represents, in a bizarre statistical way I won't go into here, the pairing between successive items in the sequence. So it makes the most sense for each data point to be between the labels and tic-marks, rather than directly over them. So if I could shift the whole graph by half a division, horizontally, that would be perfect.

Up to now I've been faking it by adding dummy empty-string labels in between all the real labels, and similarly padding out the data array with dummy, interpolated values, but this is super ugly and I'd prefer not to do it.
Posted by RGraph support on 18th January 2013
Hi,

What you're doing currently is actually what I was going to suggest - it's probably the easiest method.

Another way is by using the RGraph.DrawXAxis() API method and (if you're using the Line chart) the chart.hmargin option.

Another way is to not use the Line chart - but use the Scatter chart instead. With that you can specify the X position if tickmarks as well. This method is a little more involved though.

1 Year Premium Support now reduced to £299:
   www.rgraph.net/support

Richard, RGraph Support
Posted by Jason Black on 19th January 2013
Thanks. I hadn't considered scatter graphs for this (don't know why not, duh), but I'll give it a whirl. Thanks!

Add a reply

 




« Back to message list
RGraph on social media