负BARCHART与AndroidplotBARCHART、Androidplot

2023-09-05 01:35:11 作者:? àī ωǒ Ьīé

我使用了 Androidplot 库来绘制柱状图显示的东西。 我值的范围是 -40至+ 40

I'm using the Androidplot library to plot a Barchart to display something. The range of my values are -40 till +40.

我如何可以绘制一个酒吧消极的一面?我只想集中在y轴中间的零和酒吧应该成长向上或向下,如果该值positiv是负面的。我的酒吧距离下界向上增长。它应该是这样的:

How can I plot a bar to the negative side? I just want to center the zero on the y-axis in the middle and the bars should growing up or down, if the value is positiv of negativ. My bars are growing from the lower bound upwards. It should look like this:

推荐答案

负杆的支持,最近被添加到Androidplot 0.6.2 ;你需要使用最新开发版本得到它(这是非常稳定的)。

Negative bar support has recently been added to Androidplot 0.6.2; you'll need to use the latest development version to get it (it's very stable).

一旦你有了正确的版本Androidplot,你可以使用玛丽亚·雷纳的建议,使负值的显示。下面是我如何做下面的截图:

Once you have the correct version of Androidplot you can use Maria Reina's suggestion to enable the display of negative values. Here's how I'm doing it in the screenshot below:

plot.setUserRangeOrigin(0);
plot.setRangeBoundaries(0, BoundaryMode.AUTO, 0,BoundaryMode.AUTO);

注意:的目前地方,如果您使用的是叠加模式,2个或更多的系列,并有负面的酒吧,负棒叠加顺序颠倒的错误,导致一个较小的负值bargroup由较大的遮蔽。如果你的目标仅仅是为了重现上面虽然那么像你应该罚款。

Note : There is currently a bug where if you are using overlay mode with 2 or more series and have negative bars, the overlay order of negative bars is reversed, causing the smaller negative values in a bargroup to be obscured by the larger ones. If your goal is simply to reproduce the image above though then you should be fine.