give the value points in a line chart their own color#321
Open
mlabouardy wants to merge 2 commits intolecho:masterfrom
Open
give the value points in a line chart their own color#321mlabouardy wants to merge 2 commits intolecho:masterfrom
mlabouardy wants to merge 2 commits intolecho:masterfrom
Conversation
|
IMHO, would be nice to have a method to override in the LineChartRenderer in order to define a point's color when drawing it : private final Paint pointPaintBase = new Paint() {{
setAntiAlias(true);
setStyle(Paint.Style.FILL);
}};
protected Paint getPointPaint(Line line, PointValue pointValue) {
final Paint paint = new Paint(pointPaintBase);
paint.setColor(line.getColor());
return paint;
}
private void drawPoint(Canvas canvas, Line line, PointValue pointValue, float rawX, float rawY,
float pointRadius) {
if (ValueShape.SQUARE.equals(line.getShape())) {
canvas.drawRect(rawX - pointRadius, rawY - pointRadius, rawX + pointRadius, rawY + pointRadius,
getPointPaint(line, pointValue));
} else if (ValueShape.CIRCLE.equals(line.getShape())) {
canvas.drawCircle(rawX, rawY, pointRadius, getPointPaint(line, pointValue));
} else if (ValueShape.DIAMOND.equals(line.getShape())) {
canvas.save();
canvas.rotate(45, rawX, rawY);
canvas.drawRect(rawX - pointRadius, rawY - pointRadius, rawX + pointRadius, rawY + pointRadius,
getPointPaint(line, pointValue));
canvas.restore();
} else {
throw new IllegalArgumentException("Invalid point shape: " + line.getShape());
}
}Maybe @lecho has an idea about it ? |
broakenmedia
approved these changes
Jun 27, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.