Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chart issure #3

Open
2639117470 opened this issue Jun 21, 2017 · 0 comments
Open

chart issure #3

2639117470 opened this issue Jun 21, 2017 · 0 comments

Comments

@2639117470
Copy link

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);
        }
    }
  ...............

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant