简体   繁体   English

在iOS的核心图中设置轴线

[英]Setting axis line in core plot in ios

I am plotting a bar graph using core plot for both positive and negative values.I want a line at x=0 seperating the positive and negative values .Can anyone tell me how to set the axis line 我正在使用核心图绘制正值和负值的条形图。我想要x = 0处的线将正值和负值分开。谁能告诉我如何设置轴线

thanks 谢谢

You need to set the orthogonalCoordinateDecimal property of the axes. 您需要设置轴的orthogonalCoordinateDecimal属性。 So for example: 因此,例如:

        yAxis.orthogonalCoordinateDecimal = CPTDecimalFromDouble(0); 

will make 0 the point of the yAxis where the yAxis crosses the xAxis. 将使yAxis与xAxis相交的yAxis点成为0。

In addition to using the orthogonalCoordinateDecimal as @pe60t0 mentioned, set the plot range of the y-axis so it covers both positive and negative values. 除了使用@ Co60t0提到的orthogonalCoordinateDecimal坐标十进制之外,还要设置y轴的绘图范围,使其覆盖正值和负值。 For example to make the y-axis span from -10 to 10, 例如,使y轴跨度为-10到10,

plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(-10.0)
                                                length:CPTDecimalFromDouble(20.0)];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM