私はこのライブラリhttps://github.com/PhilJay/MPAndroidChartを使って私のプロジェクトで棒グラフを作成していますが、私はWikiを試してみましたが、まだ残っている問題のいくつかを見つけることはできません。私は、右側の値(4,3,2,1,0)と、左のカラーブロックと共に、ラベル "BarDataSet"を削除しようとしています。そして最後に私がバーに設定しようとした色は、私が定義した色ではありません。カスタムMPAndroidChart for Android
は私がやっていること:
List<BarEntry> entries = new ArrayList<>();
entries.add(new BarEntry(0f, 55f));
entries.add(new BarEntry(1f, 80f));
entries.add(new BarEntry(2f, 60f));
entries.add(new BarEntry(3f, 50f));
entries.add(new BarEntry(4f, 40f));
BarDataSet set = new BarDataSet(entries, "BarDataSet");
BarData data = new BarData(set);
data.setBarWidth(0.9f); // set custom bar width
barChart.setData(data);
barChart.setFitBars(true); // make the x-axis fit exactly all bars
barChart.invalidate(); // refresh
barChart.getAxisLeft().setEnabled(false);
barChart.getAxisRight().setEnabled(false);
barChart.getXAxis().setDrawGridLines(false);
barChart.getDescription().setEnabled(false);
set.setColors(R.color.star_bar);
をそして私は今持っているもの:
私は右(0から4)と "BarDataSet" のラベルを削除したいです。 R.color.star_barに定義した色は黄色ですが、何とか紫色を表示しています。
が、これは私が)(barChart.getXAxisを設定setDrawLabels(偽);,方が良いだろうと思う – JerryKo
私のために働いた、ありがとう値フォーマッタが ""を返すよりも。 –