多个酒吧和achartengine线 [英] multiple Bars and lines in achartengine

查看:173
本文介绍了多个酒吧和achartengine线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用achartengine在一个图表3条系列和3线系列结合起来。

I want to combine 3 bar series and 3 line series in one chart using achartengine.

在我指定的图表类型为柱状图,并给它3个系列,事情工作的权利。酒吧宽度是什么我设置和间距和着色是正确的:
(见图片在这里: http://i42.tinypic.com/ifu1ap.jpg

When I specify the type of chart as BarChart and give it 3 series, things work right. The bars widths are what I set and the spacing and colouring is correct: (see image here: http://i42.tinypic.com/ifu1ap.jpg)

但是,当我指定的图表类型为

But when I specify the chart type as

mChart = ChartFactory.getCombinedXYChartView(getView()。的getContext(),mDataset,mRenderer,新的String [] {BarChart.TYPE,BarChart.TYPE,BarChart.TYPE,LineChart.TYPE,线型图。 TYPE,LineChart.TYPE});

条显示在彼此的顶部和宽度不正确的:
(见图片在这里: http://i43.tinypic.com/2vum2xv.jpg

the bars display on top of each other and the widths aren't right: (see image here: http://i43.tinypic.com/2vum2xv.jpg)

无论是 XYMultipleSeriesRenderer.setBarWidth()也不 XYSeriesRenderer.setLineWidth()适用于酒吧的宽度。

Neither XYMultipleSeriesRenderer.setBarWidth() nor XYSeriesRenderer.setLineWidth() works for the bar widths.

我想,如果我加入了XYSeries x值与偏移,我可以解决这个重叠条问题,但在随后的酒吧宽度还没有什么,我将其设置为

I thought that if I added the XYSeries x values with an offset that I could fix the overlapping bars issue but then the widths of the bars are still not what I set it to be.

有谁知道(正道)如何使一个图表,显示多个酒吧和线系列在一个图表?

Does anyone know (the right way) how to make a chart that shows multiple bar and line series in one chart?

推荐答案

您是如何使用的偏移来呈现酒吧比如他们不重叠正确的。

You are correct about using an offset to render the bars such as they don't overlap.

不过,对于他们的间距,则需要使用 renderer.setBarSpacing(2); 这意味着在同一系列2项之间的空间等于两倍一个条形的宽度。

However, for spacing them, you need to use renderer.setBarSpacing(2); which means that the space between 2 items in the same series is equal to two times width of one bar.

这篇关于多个酒吧和achartengine线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆