问题
I'm having this Plot:
Every tick on the X-axis represents a day in the calendar. But as you can see, the date is very hard to read so I would like to set the the zoom level to show only 7 days instead of 11 (like right now). Please see screenshot below:
But it's important to have more data available, so users can scroll to the left and there will still be dates shown.
How would I do that?
Thanks in advance.
回答1:
You need to set the xRange and globallXRange properties to get work.
plotSpace.xRange = [CPPlotRange
plotRangeWithLocation:CPDecimalFromFloat(0.0)
length:CPDecimalFromUnsignedInteger(10)];
[plotSpace setGlobalXRange:[CPTPlotRange
plotRangeWithLocation:CPTDecimalFromFloat(0.0)
length:CPDecimalFromUnsignedInteger(50)]];
Pass location and length values correctly.
来源:https://stackoverflow.com/questions/18609105/core-plot-set-zoom-level-to-show-only-part-of-graph