开发者

How to plot nagative values on graph in core plot?

开发者 https://www.devze.com 2023-01-05 21:07 出处:网络
I am able to draw lines with positive decimal values but in case of negative values my graph shows nothing neither on axis nor on graph.

I am able to draw lines with positive decimal values but in case of negative values my graph shows nothing neither on axis nor on graph.

开发者_JAVA百科How do I do it?


You should simply need to set the plot ranges to encompass the negative values you wish to display. For example:

CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)lineChart.defaultPlotSpace;
plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-10.0f) length:CPDecimalFromFloat(20.0f)];
plotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-10.0f) length:CPDecimalFromFloat(20.0f)];

will show values from -10 to 10 in X and Y.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号