radius and color of the mark in the frequency view

pull/151/head
Denis 9 years ago
parent 82d2931559
commit 67ae48b527

@ -235,10 +235,14 @@ public class FrequencyChart extends ScrollableChart
private void drawMarker(Canvas canvas, RectF rect, Integer value) private void drawMarker(Canvas canvas, RectF rect, Integer value)
{ {
float padding = rect.height() * 0.2f; float padding = rect.height() * 0.2f;
float radius = // maximal allowed mark radius
(rect.height() - 2 * padding) / 2.0f / 4.0f * Math.min(value, 4); float maxRadius = (rect.height() - 2 * padding) / 2.0f;
// the real mark radius is scaled down by a factor depending on the value
pGraph.setColor(colors[Math.min(3, Math.max(0, value - 1))]); float scale = Math.min(value, 4) / 4.0f;
float radius = maxRadius * scale;
int colorIndex = Math.round((colors.length-1) * scale);
pGraph.setColor(colors[colorIndex]);
canvas.drawCircle(rect.centerX(), rect.centerY(), radius, pGraph); canvas.drawCircle(rect.centerX(), rect.centerY(), radius, pGraph);
} }

Loading…
Cancel
Save