MCPcopy Index your code
hub / github.com/arduino/Arduino / paint

Method paint

app/src/processing/app/SerialPlotter.java:65–76  ·  view source on GitHub ↗
(Graphics2D g, float xstep, double minY, 
                      double maxY, double rangeY, double height)

Source from the content-addressed store, hash-verified

63 }
64
65 public void paint(Graphics2D g, float xstep, double minY,
66 double maxY, double rangeY, double height) {
67 g.setColor(color);
68 g.setStroke(new BasicStroke(1.0f));
69
70 for (int i = 0; i < buffer.size() - 1; ++i) {
71 g.drawLine(
72 (int) (i * xstep), (int) transformY(buffer.get(i), minY, rangeY, height),
73 (int) ((i + 1) * xstep), (int) transformY(buffer.get(i + 1), minY, rangeY, height)
74 );
75 }
76 }
77
78 private float transformY(double rawY, double minY, double rangeY, double height) {
79 return (float) (5 + (height - 10) * (1.0 - (rawY - minY) / rangeY));

Callers 1

paintComponentMethod · 0.45

Calls 4

transformYMethod · 0.95
setColorMethod · 0.80
sizeMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected