mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-28 07:28:20 -04:00
added failed/passed colors to measurement graph
This commit is contained in:
parent
4cb80b3918
commit
98c18dee79
@ -89,13 +89,35 @@ public class DataPlotter implements Drawable {
|
||||
g.drawLine(new Vector(xx, BORDER - SEP2), new Vector(xx, (SIZE + SEP) * signals + BORDER - SEP2), Style.DASH);
|
||||
y = BORDER;
|
||||
for (int i = 0; i < signals; i++) {
|
||||
Style style;
|
||||
switch (s[i].getState()) {
|
||||
case FAIL:
|
||||
style=Style.FAILED;
|
||||
break;
|
||||
case PASS:
|
||||
style=Style.PASS;
|
||||
break;
|
||||
default:
|
||||
style=Style.NORMAL;
|
||||
}
|
||||
|
||||
long width = data.getMax(i);
|
||||
if (width == 0) width = 1;
|
||||
int ry = (int) (SIZE - (SIZE * s[i].getValue()) / width);
|
||||
g.drawLine(new Vector(xx, y + ry), new Vector((int) (xx + size), y + ry), Style.NORMAL);
|
||||
if (!first && ry != lastRy[i])
|
||||
g.drawLine(new Vector(xx, y + lastRy[i]), new Vector(xx, y + ry), Style.NORMAL);
|
||||
int ry;
|
||||
if (s[i].getType() == Value.Type.CLOCK) {
|
||||
ry = 0;
|
||||
g.drawLine(new Vector(xx, y + ry), new Vector((int) (xx + size / 2), y + ry), style);
|
||||
if (!first && ry != lastRy[i])
|
||||
g.drawLine(new Vector(xx, y + lastRy[i]), new Vector(xx, y + ry), style);
|
||||
ry = SIZE;
|
||||
g.drawLine(new Vector((int) (xx + size / 2), y + ry), new Vector((int) (xx + size), y + ry), style);
|
||||
g.drawLine(new Vector((int) (xx + size / 2), y), new Vector((int) (xx + size / 2), y + SIZE), style);
|
||||
} else {
|
||||
ry = (int) (SIZE - (SIZE * s[i].getValue()) / width);
|
||||
g.drawLine(new Vector(xx, y + ry), new Vector((int) (xx + size), y + ry), style);
|
||||
if (!first && ry != lastRy[i])
|
||||
g.drawLine(new Vector(xx, y + lastRy[i]), new Vector(xx, y + ry), style);
|
||||
}
|
||||
|
||||
lastRy[i] = ry;
|
||||
y += SIZE + SEP;
|
||||
@ -103,7 +125,7 @@ public class DataPlotter implements Drawable {
|
||||
first = false;
|
||||
pos += size;
|
||||
}
|
||||
g.drawLine(new Vector(x, BORDER - SEP2), new Vector(x, (SIZE + SEP) * signals + BORDER - SEP2), Style.DASH);
|
||||
g.drawLine(new Vector((int) (pos + x), BORDER - SEP2), new Vector((int) (pos + x), (SIZE + SEP) * signals + BORDER - SEP2), Style.DASH);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,14 @@ public class Style {
|
||||
* used for all lines to draw the shapes itself
|
||||
*/
|
||||
public static final Style NORMAL = new Style(LINETHICK, false, Color.BLACK);
|
||||
/**
|
||||
* used for all lines to draw the failed state
|
||||
*/
|
||||
public static final Style FAILED = new Style(LINETHICK, false, Color.RED);
|
||||
/**
|
||||
* used for all lines to draw the passed state
|
||||
*/
|
||||
public static final Style PASS = new Style(LINETHICK, false, Color.GREEN);
|
||||
/**
|
||||
* Used for text which is integral part of the shape.
|
||||
* Text which uses this style is always included in sizing!
|
||||
|
@ -35,6 +35,8 @@ public class TestResultDialog extends JDialog {
|
||||
private static final Color PASSED_COLOR = new Color(200, 255, 200);
|
||||
private static final Icon ICON_FAILED = IconCreator.create("testFailed.png");
|
||||
private static final Icon ICON_PASSED = IconCreator.create("testPassed.png");
|
||||
private static final Icon ICON_GRAPH = IconCreator.create("measurement-graph.png");
|
||||
|
||||
|
||||
private final ArrayList<ValueTable> resultTableData;
|
||||
|
||||
@ -101,7 +103,7 @@ public class TestResultDialog extends JDialog {
|
||||
|
||||
JMenuBar bar = new JMenuBar();
|
||||
JMenu view = new JMenu(Lang.get("menu_view"));
|
||||
ToolTipAction asGraph = new ToolTipAction(Lang.get("menu_showDataAsGraph")) {
|
||||
ToolTipAction asGraph = new ToolTipAction(Lang.get("menu_showDataAsGraph"), ICON_GRAPH) {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
int tab = tp.getSelectedIndex();
|
||||
@ -113,6 +115,10 @@ public class TestResultDialog extends JDialog {
|
||||
bar.add(view);
|
||||
setJMenuBar(bar);
|
||||
|
||||
JToolBar toolBar = new JToolBar();
|
||||
toolBar.add(asGraph.createJButtonNoText());
|
||||
getContentPane().add(toolBar, BorderLayout.NORTH);
|
||||
|
||||
getContentPane().add(tp);
|
||||
pack();
|
||||
setLocationRelativeTo(owner);
|
||||
|
BIN
src/main/resources/measurement-graph.png
Normal file
BIN
src/main/resources/measurement-graph.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
src/main/resources/measurement-graph_hi.png
Normal file
BIN
src/main/resources/measurement-graph_hi.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
@ -18,6 +18,7 @@
|
||||
./expicon.sh View-zoom-out
|
||||
./expicon.sh edit-redo
|
||||
./expicon.sh edit-undo
|
||||
./expicon.sh measurement-graph
|
||||
|
||||
./exptest.sh testFailed
|
||||
./exptest.sh testPassed
|
||||
|
134
src/main/svg/measurement-graph.svg
Normal file
134
src/main/svg/measurement-graph.svg
Normal file
@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Digital by H.Neemann -->
|
||||
|
||||
<!-- created: Mon Jul 03 15:53:05 CEST 2017 -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="17.942812mm"
|
||||
height="15.855mm"
|
||||
viewBox="251 63 119.61875 105.7"
|
||||
version="1.1"
|
||||
id="svg134"
|
||||
sodipodi:docname="measurement-graph.svg"
|
||||
inkscape:version="0.92.1 r15371">
|
||||
<metadata
|
||||
id="metadata140">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs138" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1680"
|
||||
inkscape:window-height="1002"
|
||||
id="namedview136"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:zoom="8"
|
||||
inkscape:cx="45.760076"
|
||||
inkscape:cy="28.200851"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg134"
|
||||
inkscape:snap-grids="true"
|
||||
inkscape:snap-page="true" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.79929172;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
|
||||
id="rect4682"
|
||||
width="119.61875"
|
||||
height="105.7"
|
||||
x="251"
|
||||
y="63"
|
||||
ry="0.0021948952" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:2.79999995;stroke-linecap:square"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path2"
|
||||
d="m 269.21875,68.35 h 25 v 25 h 25 25 v -25 h 25" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:2.79999995;stroke-linecap:square"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4"
|
||||
d="m 269.21875,103.35 h 25 v 25 h 25 v -25 h 25 v 25 h 25" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:2.79999995;stroke-linecap:square"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path6"
|
||||
d="m 269.21875,138.35 h 25 v 25 h 25 25 25" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-dasharray:4, 4"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path24"
|
||||
d="m 269.21875,98.35 h 100" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-dasharray:4, 4"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path26"
|
||||
d="m 269.21875,133.35 h 100" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-dasharray:4, 4"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path28"
|
||||
d="m 369.21875,168.35 v -105 h -100 v 105 h 100" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-dasharray:4, 4"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path30"
|
||||
d="m 294.21875,63.35 v 105" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-dasharray:4, 4"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path32"
|
||||
d="m 319.21875,63.35 v 105" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-dasharray:4, 4"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path34"
|
||||
d="m 344.21875,63.35 v 105" />
|
||||
<g
|
||||
style="stroke-linecap:square"
|
||||
id="g130"
|
||||
transform="translate(-2.78125,-1.65)">
|
||||
<text
|
||||
id="text124"
|
||||
style="font-size:24px;text-anchor:end;fill:#000000"
|
||||
y="91"
|
||||
x="270">A</text>
|
||||
<text
|
||||
id="text126"
|
||||
style="font-size:24px;text-anchor:end;fill:#000000"
|
||||
y="126"
|
||||
x="270">B</text>
|
||||
<text
|
||||
id="text128"
|
||||
style="font-size:24px;text-anchor:end;fill:#000000"
|
||||
y="161"
|
||||
x="270">C</text>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 4.5 KiB |
Loading…
x
Reference in New Issue
Block a user