Pie chart: how to display text only on some pieces of the pie using the Android library AChartEngine?

I am using AChartEngine ( http://code.google.com/p/achartengine/ ) to display a pie chart in an Android app.

A pie chart can have many slides. I want to display only some slicer slices, but I could not get it to work (I'm not even sure if this is possible).

For DefaultRendererI did:

renderer.setLabelsColor(Color.BLACK);  // color of the text displayed on the chart
renderer.setLabelsTextSize(12); // size of the text displayed on the chart

and for each SimpleSeriesRenderer:

if (pieSlidesNo > 5) {
    serieRender.setDisplayChartValues(false);
} else {
    serieRender.setDisplayChartValues(true);
}

but does not work - values ​​are displayed on each segment of the pie. What I want is similar to the image below (values ​​are displayed only on the first slices, and not at all).

enter image description here

+3
source share
1

.

draw() PieChart.java renderer.setDisplayValues(true); of DefaultRenderer

 if (mRenderer.isDisplayValues()) {
        if(angle<60)
        {}
        else
        drawLabel(
            canvas,
            getLabel(mRenderer.getSeriesRendererAt(i).getChartValuesFormat(), mDataset.getValue(i)),
            mRenderer, prevLabelsBounds, mCenterX, mCenterY, shortRadius / 2, longRadius / 2,
            currentAngle, angle, left, right, mRenderer.getLabelsColor(), paint, false, true);
      }

(angle<60) .

+2

All Articles