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

give the value points in a line chart their own color #321

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class PointValue {
private float diffX;
private float diffY;
private char[] label;
private int color;

public PointValue() {
set(0, 0);
Expand All @@ -24,6 +25,11 @@ public PointValue() {
public PointValue(float x, float y) {
set(x, y);
}

public PointValue(float x, float y, int color){
this(x,y);
this.color = color;
}

public PointValue(PointValue pointValue) {
set(pointValue.x, pointValue.y);
Expand All @@ -34,6 +40,14 @@ public void update(float scale) {
x = originX + diffX * scale;
y = originY + diffY * scale;
}

public int getColor() {
return color;
}

public void setColor(int color) {
this.color = color;
}

public void finish() {
set(originX + diffX, originY + diffY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ private void drawPoints(Canvas canvas, Line line, int lineIndex, int mode) {

private void drawPoint(Canvas canvas, Line line, PointValue pointValue, float rawX, float rawY,
float pointRadius) {
pointPaint.setColor(pointValue.getColor());
if (ValueShape.SQUARE.equals(line.getShape())) {
canvas.drawRect(rawX - pointRadius, rawY - pointRadius, rawX + pointRadius, rawY + pointRadius,
pointPaint);
Expand Down