正如标题所说,我试图将MPAndroidChart包含在一个项目中,并且不能让蜡烛显示出来.这是我的代码:
List<CandleEntry> ceList = new ArrayList<>();
ceList.add(new CandleEntry(0, 4.62f, 2.02f, 2.70f, 4.13f));
ceList.add(new CandleEntry(1, 5.50f, 2.70f, 3.35f, 4.96f));
ceList.add(new CandleEntry(2, 5.25f, 3.02f, 3.50f, 4.50f));
ceList.add(new CandleEntry(3, 6f, 3.25f, 4.40f, 5.0f));
ceList.add(new CandleEntry(4, 5.57f, 2f, 2.80f, 4.5f));
CandleDataSet cds = new CandleDataSet(ceList, "Entries");
cds.setColor(Color.BLUE);
cds.setValueTextColor(Color.RED);
CandleData cd = new CandleData(cds);
candleStickChart.setData(cd);
candleStickChart.invalidate();
Run Code Online (Sandbox Code Playgroud)
但我明白了:
图表Xml
<com.github.mikephil.charting.charts.CandleStickChart
android:id="@+id/CandleStickChart"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)
带有折线图的相同代码似乎工作正常.我有什么想法可能做错了吗?谢谢!