MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / drawBar

Function drawBar

examples/drivers/m5stack-imu/main.js:143–153  ·  view source on GitHub ↗
(label, value, x, y, width, height)

Source from the content-addressed store, hash-verified

141}
142
143function drawBar(label, value, x, y, width, height) {
144 const halfWidth = width >> 1;
145 const barWidth = (value * halfWidth) | 0;
146
147 if (value > 0)
148 render.fillRectangle(barColor, x + halfWidth, y, barWidth, height);
149 else
150 render.fillRectangle(barColor, x + halfWidth + barWidth, y, -barWidth, height);
151
152 render.drawText(label + " " + formatValue(value), font, textColor, x + 50, y);
153}
154
155function moveBallTo(x, y) {
156 const w = ball.width, h = ball.height;

Callers 1

onReadingFunction · 0.70

Calls 3

drawTextMethod · 0.80
formatValueFunction · 0.70
fillRectangleMethod · 0.65

Tested by

no test coverage detected