piaoyongren / core-plot

Automatically exported from code.google.com/p/core-plot
0 stars 0 forks source link

How can we increase the X asix class length without changes the X & Y data plot values #145

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Dear Concerned,
I need to implement zoom in/out feature.
Let say day wise to hour wise.
For eg: 
There are three values for the data plot
X: 03 May,2010 11:30:23 AM Y:20
X: 15 May,2010 02:12:15 PM Y:22
X: 18 May,2010 05:45:12 PM Y:18
Its works well when we kept the labeling policy Automatic & user
interaction true i.e it shows the data day wise.
Now here i am confused that how can we change the X class length from day
to hour wise.
Please guide me 
Regards Zahur.

Original issue reported on code.google.com by zghotlawala@gmail.com on 21 May 2010 at 5:30

GoogleCodeExporter commented 9 years ago
Just change the plot range in the CPXYPlotSpace for the x axis. You need to a 
do a bit of math. A day is 86000 
seconds. Change your range to be some number of minutes or hours (given in 
seconds).

Original comment by drewmcco...@mac.com on 21 May 2010 at 6:47

GoogleCodeExporter commented 9 years ago

Original comment by drewmcco...@mac.com on 21 May 2010 at 6:48

GoogleCodeExporter commented 9 years ago
Thanks for replying. 
Well 
xRange=[CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(min)
length:CPDecimalFromFloat(maxValue-min)];
Here the min & max values are NSTimeInterval.
I had just shown the glimpse that how i get the min & max values.
 double min=[XDataValue timeIntervalSinceDate:refDate];
 double max=[XDataValue timeIntervalSinceDate:refDate];
here i get the min & max values proper. Now please guide me where I had to make
changes.As min & max are already in seconds

If I change the Xdata values let say
X: 03 May,2010 11:30:23 AM Y:20
X: 03 May,2010 02:12:15 PM Y:22
X: 03 May,2010 05:45:12 PM Y:18
Still the data plot is correct, it turn to hour wise.Without making changes in 
the code
Thanks & Regards 
Zahur

Original comment by zghotlawala@gmail.com on 21 May 2010 at 7:20