简体   繁体   English

带负值的iOS图表条形图

[英]iOS-charts bar chart with negative values

I am using the great iOS-charts pod for doing my graphics. 我正在使用出色的iOS图表窗格来制作图形。 Now I have to display a bar chart with y-value in a range from -120 to 0. When I add those values, I get the bars displays from the top - 0 - to the bottom. 现在,我必须显示一个y值在-120到0范围内的条形图。当我添加这些值时,我得到的条形图从顶部-0-到底部。 What I am looking for is a way to let the bar be drawn from the bottom of the chart up to it's value, because 0 means a lot for the application while -120 means nothing. 我正在寻找一种让条形图从图表底部开始绘制直至达到其值的方法,因为对于应用程序0意味着很多,而-120则没有任何意义。 So I would like to get a big bar for 0 and nothing for -120 like this. 因此,我想得到一个大的0栏,而对于-120则没有这样的东西。

0 0

 X
 X        X
 X   X    X

-120 x XX -120 x XX

Any idea how I can achieve this behavior? 知道如何实现这种行为吗?

Thanks a lot Andy 非常感谢安迪

You need to set logical values for the correct visibility - and the use a formatter for showing the values as negative values. 您需要设置逻辑值以获得正确的可见性-并使用格式化程序将这些值显示为负值。

In Charts 3.0 it is easier to format the values. 在Charts 3.0中,更容易设置值的格式。

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

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