MPAndroidChart条形图从非零Y或列范围图开始 [英] MPAndroidChart Bar chart start from non zero Y or Column Range chart
问题描述
我正在使用MPAndroidChart绘制组合图(带有条形图和折线图).
I am using MPAndroidChart for drawing a Combined graph (with a bar chart and line chart).
我想显示一个列范围图"-条形图,其起点对于每个条目都是可变的,如下图所示,
I want to display a "Column Range Chart" - a bar chart whose starting point will be variable for each entries, as shown in the below image,
如何使用MPAndroidChart实现此目标.
How is it possible to achieve this using MPAndroidChart.
推荐答案
尝试使用CandleStickChart
.它的主要目的是显示财务数据.
您的问题可能是最大或最小(阴影)打开或关闭值,可能需要与它们一起使用才能实现所需的值.
Try with CandleStickChart
. It's main purpose it to show financial data.
Your problem might be with highest/lowest (shadow) open or closing values, it might require to play with them to achieve what you want.
快速样本:
CandleStickChart candleStickChart = (CandleStickChart) findViewById(R.id.chart);</p>
ArrayList<CandleEntry> entries = new ArrayList<>
entries.add(new CandleEntry(0, 2.70f, 4.13f, 2.70f, 4.13f));
entries.add(new CandleEntry(1, 3.35f, 4.96f, 3.35f, 4.96f));
entries.add(new CandleEntry(2, 3.50f, 4.50f, 3.50f, 4.50f));
entries.add(new CandleEntry(3, 4.40f, 5.0f, 4.40f, 5.0f));
entries.add(new CandleEntry(4, 2.80f, 4.5f, 2.80f, 4.5f));
请注意,CandleEntry
构造函数中的第二/第四,第三/第五个参数相同,以消除阴影值.
Notice that second/fourth third/fifth parameter in CandleEntry
constructor are the same to eliminate shadow values.
有关如何使用它的教程,请此处
Tutorial on how to use it is here
更多信息: 您可能在绘制垂直数据值时遇到问题,这可能是不可能的.
More info: You might have a problem with drawing vertical data values, this might not be possible.
这篇关于MPAndroidChart条形图从非零Y或列范围图开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!