Multiple Y axis with variable X axis length


« 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 Senne on 15th April 2014
I'm having a problem when I want to draw multiple y-axis.
I have an array of dates, for example 1/1/2014, 1/2/2014, 1/3/2014 and 1/4/2014 (the same for every line).
Now I want to draw 3 or 4 lines, but not all line have values for all the dates.
For example line 1 only has values for 1/1 and 1/3, so I use (value, null, value, null), but then it shows just 2 points, not connecting them. How can I solve this?
Posted by Richard on 15th April 2014
Hi there,

To draw a Line you need to have two consecutive points. You could rearrange your array and either remove the null values or simply move them to the end of the array.




Richard
www.rgraph.net
If RGraph has helped you - please share the website - thanks!
Posted by Senne on 15th April 2014
But then the values wouldn't allign to their dates anymore. I have 3/4 arrays of values, and they are all linked to a date. Sometimes there isn't a value for that date.
Posted by Richard on 16th April 2014
Hi there,

Well you need two consecutive points for a line. You could change your null value to 0.




Richard
www.rgraph.net
If RGraph has helped you - please share the website - thanks!

RGraph Priority Support: www.rgraph.net/support#priority-support
Posted by Senne on 16th April 2014
Then I get this result: i61.tinypic.com/1zbb8cz.jpg

But I need/want this: i57.tinypic.com/r8uu7o.jpg

Is this impossible?
Posted by Richard on 16th April 2014
Hi there,

I don't get the correlation - you have two lines there. The top yellow one has no null or zero values and all the values for the green line are approximately five.




Richard
www.rgraph.net
If RGraph has helped you - please share the website - thanks!

RGraph Priority Support: www.rgraph.net/support#priority-support
Posted by Senne on 16th April 2014
The top yellow line has no value 25-07-2013 date, and still the line is uninterrupted.
The bottom green line also has no values for the third and fourth date, and still the points are connected (the second graph is not made with RGraph).
That's how I want it, when there's no value for that date, it just needs to "skip" that one.
Posted by Richard on 16th April 2014
Hi there,


I see - the Line chart won't do this, but the Scatter chart with a connecting line (an XY chart) will. It will allow you to put the points wherever you choose - since you specify the X/Y coordinates. For example:

www.rgraph.net/demos/scatter-multiple-datasets.html

If you want the labels still in the line chart style (positioned on a point instead of in-between two points) I think you'll also need to use the drawing API X axis with the labels.position option set to 'edge'.

www.rgraph.net/docs/drawing-api-xaxis.html



Richard
www.rgraph.net
If RGraph has helped you - please share the website - thanks!

RGraph Priority Support: www.rgraph.net/support#priority-support
Posted by Senne on 16th April 2014
Ok, thanks a lot !

Add a reply

 




« Back to message list
RGraph on social media