Core Plot - set zoom level to show only part of graph

橙三吉。 提交于 2019-12-12 02:48:32

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!