Page 1 of 1
[56K WARN] JPGraph axis question [SOLVED]
Posted: Sun May 01, 2005 10:09 am
by Chris Corbyn
Hi,
I'm using JPGraph to plot a line graph but the units are in degrees (0-360).
Now, if the line ran from 0-360 it would all be good

BUT, Some lines do the opposite and go from 270-90 (looping back to the start of the circle).
Can I get my X axis scale in JPGraph to go 270-360, then 0-90?
Like this (not JPGraph in this case);
I'm actually on quite a tight dealine to get this fixed
Thanks if anybody can help.
Posted: Sun May 01, 2005 10:12 am
by Chris Corbyn
I could even shift the value for the sake of constructing the graph so long as I can make it look like I have used the actual values by printing 270-360, then 0-90 on the axis (a dirty fix)... Can I do this if I can't make a split scale?
Posted: Sun May 01, 2005 11:23 am
by Chris Corbyn
Actually, in an ideal world it should go 180-360, 0-180.
Do I need to rephrase my question or is it just that nobody has used JPGraph?
Posted: Sun May 01, 2005 11:36 am
by hawleyjr
Have you considered creating two graphs and parsing them next to each other?
Posted: Sun May 01, 2005 11:54 am
by Chris Corbyn
Hmm... you could have an idea there.
What this is all for is realted to the suns position in the sky. Everything goes pear shaped in the southern hemisphere (I have already got the code to work out which hemisphere it's working in).
The only issue with that is that there will be a gap between the two lines (at the 360 degrees point)...
I'll play around but ideally I need a wonky scale

Posted: Sun May 01, 2005 1:49 pm
by Chris Corbyn
OK one problem is fixed.....
I have gone from this.....
to this....
By adding 360 to anything less than 180. But now the values appear wrong on the scale. Can I somehow overwrite the values on the X axis with my own text without destroying the plotted points?
I'm currently using 'intlin' but I'll change to whatever works.
Posted: Sun May 01, 2005 3:13 pm
by Chris Corbyn
It's OK guys I have worked this out.
I tried this before and it didn't work but now I know why.
$graph->xaxis->SetTickLabels($ticks_array);
I didn't realise it takes every single integer as a tick (so I need hundreds of ticks but I for() loops will suffice to make these

).