1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-07 01:54:26 +01:00

set grid color through theme.txt now

This commit is contained in:
duff2013 2016-10-18 00:04:43 -07:00
parent db8526c27c
commit 9a3881ecce
2 changed files with 9 additions and 8 deletions

View File

@ -75,12 +75,13 @@ public class SerialPlotter extends AbstractMonitor {
private Rectangle bounds; private Rectangle bounds;
private int xOffset, xPadding; private int xOffset, xPadding;
private final Font font; private final Font font;
private final Color bgColor; private final Color bgColor, gridColor, boundsColor;
private final Color gridColor = new Color(245, 245, 245, 245);
public GraphPanel() { public GraphPanel() {
font = Theme.getFont("console.font"); font = Theme.getFont("console.font");
bgColor = Theme.getColor("plotting.bgcolor"); bgColor = Theme.getColor("plotting.bgcolor");
gridColor = Theme.getColor("plotting.gridcolor");
boundsColor = Theme.getColor("plotting.boundscolor");
xOffset = 20; xOffset = 20;
xPadding = 20; xPadding = 20;
} }
@ -134,7 +135,7 @@ public class SerialPlotter extends AbstractMonitor {
Rectangle2D fRect = fm.getStringBounds(String.valueOf(tick), g); Rectangle2D fRect = fm.getStringBounds(String.valueOf(tick), g);
xOffset = Math.max(xOffset, (int) fRect.getWidth() + 15); xOffset = Math.max(xOffset, (int) fRect.getWidth() + 15);
g.setColor(Color.BLACK); g.setColor(boundsColor);
// draw tick // draw tick
g.drawLine(xOffset - 5, (int) transformY(tick), xOffset + 2, (int) transformY(tick)); g.drawLine(xOffset - 5, (int) transformY(tick), xOffset + 2, (int) transformY(tick));
// draw tick label // draw tick label
@ -144,8 +145,6 @@ public class SerialPlotter extends AbstractMonitor {
g.drawLine(xOffset + 3, (int) transformY(tick), bounds.width - xPadding, (int) transformY(tick)); g.drawLine(xOffset + 3, (int) transformY(tick), bounds.width - xPadding, (int) transformY(tick));
} }
//g.drawLine(bounds.x + xOffset, bounds.y + 5, bounds.x + xOffset, bounds.y + bounds.height - 10);
// handle data count // handle data count
int cnt = xCount - BUFFER_CAPACITY; int cnt = xCount - BUFFER_CAPACITY;
if (xCount < BUFFER_CAPACITY) cnt = 0; if (xCount < BUFFER_CAPACITY) cnt = 0;
@ -170,15 +169,15 @@ public class SerialPlotter extends AbstractMonitor {
sWidth = (int)fBounds.getWidth()/2; sWidth = (int)fBounds.getWidth()/2;
xValue = (int)((bounds.width - xOffset - xPadding) * ((xTickRange * i) / BUFFER_CAPACITY) + xOffset); xValue = (int)((bounds.width - xOffset - xPadding) * ((xTickRange * i) / BUFFER_CAPACITY) + xOffset);
} }
// draw graph x axis ticks and labels // draw graph x axis, ticks and labels
g.setColor(Color.BLACK); g.setColor(boundsColor);
g.drawString(s, xValue - sWidth, (int) bounds.y + (int) transformY(zeroTick) + 15); g.drawString(s, xValue - sWidth, (int) bounds.y + (int) transformY(zeroTick) + 15);
g.drawLine(xValue, (int)transformY(zeroTick) - 2, xValue, bounds.y + (int)transformY(zeroTick) + 5); g.drawLine(xValue, (int)transformY(zeroTick) - 2, xValue, bounds.y + (int)transformY(zeroTick) + 5);
// draw vertical grid lines // draw vertical grid lines
g.setColor(gridColor); g.setColor(gridColor);
g.drawLine(xValue, (int)transformY(zeroTick) - 3, xValue, bounds.y + (int)transformY(lastTick)); g.drawLine(xValue, (int)transformY(zeroTick) - 3, xValue, bounds.y + (int)transformY(lastTick));
} }
g.setColor(Color.BLACK); g.setColor(boundsColor);
// draw major y axis // draw major y axis
g.drawLine(bounds.x + xOffset, (int) transformY(lastTick) - 5, bounds.x + xOffset, bounds.y + (int) transformY(zeroTick) + 5); g.drawLine(bounds.x + xOffset, (int) transformY(lastTick) - 5, bounds.x + xOffset, bounds.y + (int) transformY(zeroTick) + 5);
// draw major x axis // draw major x axis

View File

@ -40,6 +40,8 @@ buttons.status.color = #ffffff
# color cycle created via colorbrewer2.org # color cycle created via colorbrewer2.org
plotting.bgcolor = #ffffff plotting.bgcolor = #ffffff
plotting.color = #ffffff plotting.color = #ffffff
plotting.gridcolor = #f0f0f0
plotting.boundscolor = #000000
plotting.graphcolor.size = 4 plotting.graphcolor.size = 4
plotting.graphcolor.00 = #2c7bb6 plotting.graphcolor.00 = #2c7bb6
plotting.graphcolor.01 = #fdae61 plotting.graphcolor.01 = #fdae61