饼图:如何显示刚刚使用Android的AChartEngine一些图书馆饼图片文字?

问题描述:

我使用的 AChartEngine 的http:// code.google.com / p / achartengine / )库在Android应用程序显示一个饼图。

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

饼图可以有很多的幻灯片。我想只显示一些扇形的价值,但我不能让它工作(我什至不知道这是可能的)。

The pie chart can have lots of slides. I want to display just on some pie slices the values, but I could not make it work (I'm not even sure it is possible).

对于 DefaultRenderer 我做了:

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

和每个 SimpleSeriesRenderer

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

但不工作 - 该值显示在每个饼图切片。
我要的是像下图中(该值仅在第一片显示,不是所有的)。

but is not working - the values are displayed on each pie slice. What I want is like in the below image (the values are displayed only on first slices, not on all).

有关这一点,你必须改变库源。

For this you have to change Library Source.

请在变化画出() PieChart.java ,并使用 renderer.setDisplayValues (真); 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);
      }

您可以改变角度比较值(角α; 60)。根据乌拉圭回合的要求

you can change angle comparison value (angle<60) according to ur requirement.