-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
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);
}
}
...............
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels