Skip to content

chart issure #3

@2639117470

Description

@2639117470

hello,Tks the chart,when i use it, the datas is from network, the chart can't work right, then i modify the onMesure() ,please verify the problem.

@OverRide
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
float width = getMeasuredWidth();
float height = getMeasuredHeight();
side = Math.min(width, height);
cx = width / 2;
cy = height / 2;
paint.setColor(centerColor);
}

@Override
public void draw(Canvas canvas) {
    super.draw(canvas);
    if (CollectionUtils.isEmpty(chartUtils)) {
        if (chartData != null) {
            if (withPercent) {
                float value = 0;
                int i;
                for (i = 0; i < chartData.size(); i++) {
                    value += chartData.get(i).getPartInPercent();
                    if (value > 100)
                        break;
                }
                if (i < chartData.size()) {
                } else {
                    chartUtils = ChartHelper.generateArcWithPercent(chartData);
                }
            } else {
                chartUtils = ChartHelper.generateArc(chartData);
            }
            alpha = 255 / chartData.size();
            textPaintAbout.setTextSize(textSize);
        }
    }
  ...............

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions