piaoyongren / core-plot

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

fix axis while scrolling the graph #177

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello.
Is it possible to prevent axis (ticks, labels) from moving while scrolling the 
graph? I want to possess tickLocations for xAxis in the beginning and later 
while scrolling the graph just to update the labels value, but the 
majorTickLocations to stay fixed. constraints works great to fix xAxis for 
vertical scrolling, but I want it to be fixed for horizontal scrolling as well. 
If it is not implemented yet, it would be great to. Thank you.

Original issue reported on code.google.com by Yakubovi...@gmail.com on 13 Jul 2010 at 3:59

GoogleCodeExporter commented 8 years ago
It doesn't really make sense to talk of constraining an x axis for horizontal  
movement, because it doesn't move. I can see what you want to achieve though.

I think you could do this using the CPPlotSpace delegate method

-(void)plotSpace:(CPPlotSpace *)space 
didChangePlotRangeForCoordinate:(CPCoordinate)coordinate;

Just set the plot space delegate to your controller, then implement this 
method. Set the axis labeling policy to CPAxisLabelingPolicyLocationsProvided, 
and set the new locations of the ticks. Basically, the new locations should 
just be the old locations, translated by however much the plot space has 
shifted. 

Original comment by drewmcco...@mac.com on 14 Jul 2010 at 9:34

GoogleCodeExporter commented 8 years ago
thanks a lot. that is exactly I was looking for

Original comment by Yakubovi...@gmail.com on 14 Jul 2010 at 12:47