lecho / hellocharts-android

Charts library for Android compatible with API 8+, several chart types with scaling, scrolling and animations 📊
Apache License 2.0
7.44k stars 1.61k forks source link

Labels are now showing #514

Open sontqq opened 5 years ago

sontqq commented 5 years ago

I am trying to show a piechart with labels at the values without success. I use the code below:

PieChartView pieChartView = findViewById(R.id.chart2);
List<SliceValue> values = new ArrayList<SliceValue>();
values.add(new SliceValue(Float.valueOf(words[1])).setLabel(words[0]).setColor(Color.parseColor(color)));
PieChartData pieChartData = new PieChartData(values);
pieChartView.setPieChartData(pieChartData);
pieChartData.setCenterText1("Recorded data per Device");
pieChartData.setHasCenterCircle(true);
pieChartData.setHasLabels(true);
pieChartData.setHasLabelsOnlyForSelected(true);
pieChartData.setHasLabelsOutside(true);
pieChartView.setValueSelectionEnabled(true);
pieChartData.setValues(values);

Anyone knows why these doesn't show or how to fix that?