Skip to content

Commit 3ec69c8

Browse files
(quince-science#2931) Argo plots working
1 parent 414f68b commit 3ec69c8

3 files changed

Lines changed: 119 additions & 33 deletions

File tree

WebApp/WebContent/resources/script/plotPage.js

Lines changed: 68 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -88,41 +88,80 @@ const FLAG_COLORS = {
8888
'ICOS': {
8989
'y1': {
9090
'Needed': '#817FFF',
91-
'Not calibrated': '#AC9326',
92-
'1': '#AC9326',
93-
'Questionable': '#FFA42B',
94-
'3': '#FFA42B',
95-
'Bad': '#FF0000',
96-
'4': '#FF0000',
97-
'Good': '',
98-
'2': '',
99-
'Assumed Good': '',
100-
'-2': '',
101-
'GHOST': '#C0C0C0'
91+
'Not calibrated': '#AC9326',
92+
'1': '#AC9326',
93+
'Questionable': '#FFA42B',
94+
'3': '#FFA42B',
95+
'Bad': '#FF0000',
96+
'4': '#FF0000',
97+
'Good': '',
98+
'2': '',
99+
'Assumed Good': '',
100+
'-2': '',
101+
'GHOST': '#C0C0C0'
102102
},
103103
'y2': {
104104
'Needed': '#D7D6FF',
105105
'Not calibrated': '#CCCBAF',
106-
'1': '#CCCBAF',
107-
'Bad': '#E6B6A6',
108-
'4': '#E6B6A6',
109-
'Questionable': '#EFDCBF',
106+
'1': '#CCCBAF',
107+
'Bad': '#E6B6A6',
108+
'4': '#E6B6A6',
109+
'Questionable': '#EFDCBF',
110110
'3': '#EFDCBF'
111111
}
112+
},
113+
'Argo': {
114+
'y1': {
115+
'Needed': '#817FFF',
116+
'Good': '',
117+
'1': '',
118+
'Assumed Good': '',
119+
'-1': '',
120+
'Probably Good': '#FFFF00',
121+
'2': '#FFFF00',
122+
'Bad, potentially correctable': '#ED7F10',
123+
'3': '#ED7F10',
124+
'Bad': '#FF0000',
125+
'4': '#FF0000',
126+
'Value Changed': '#FF00FF',
127+
'5': '#FF00FF',
128+
'Estimated Value': '#0000FF',
129+
'8': '#0000FF',
130+
},
131+
'y2': {
132+
'Needed': '#817FFF',
133+
'Good': '',
134+
'1': '',
135+
'Assumed Good': '',
136+
'-1': '',
137+
'Probably Good': '#FFFF00',
138+
'2': '#FFFF00',
139+
'Bad, potentially correctable': '#ED7F10',
140+
'3': '#ED7F10',
141+
'Bad': '#FF0000',
142+
'4': '#FF0000',
143+
'Value Changed': '#FF00FF',
144+
'5': '#FF00FF',
145+
'Estimated Value': '#0000FF',
146+
'8': '#0000FF',
147+
}
112148
}
113149
}
114150

115151
function getFlagScheme() {
116152
return $('#plotPageForm\\:flagScheme').val();
117153
}
118154

119-
function getFlagColor(flag, axis) {
120-
return FLAG_COLORS[getFlagScheme()][axis][flag];
155+
function getFlagColor(flag, axis, emptyIsTransparent) {
156+
let color = FLAG_COLORS[getFlagScheme()][axis][flag];
157+
if (color == '') {
158+
color = emptyIsTransparent ? '#00000000' : '#000000';
159+
}
160+
return color;
121161
}
122162

123-
function getFlagColors(flags, axis) {
124-
let lookupTable = FLAG_COLORS[getFlagScheme()][axis];
125-
return flags.map(f => {return lookupTable[f]; });
163+
function getFlagColors(flags, axis, emptyIsTransparent) {
164+
return flags.map(f => {return getFlagColor(f, axis, emptyIsTransparent)});
126165
}
127166

128167
// VARIABLES FOR THE PLOT/TABLE LAYOUT
@@ -325,7 +364,7 @@ function showQCMessage(qcFlag, qcMessage) {
325364
if (qcMessage != '') {
326365

327366
let content = '';
328-
content += '<div class="qcInfoMessage" style="color: ' + getFlagColor(qcFlag, 'y1') + '">';
367+
content += '<div class="qcInfoMessage" style="color: ' + getFlagColor(qcFlag, 'y1', false) + '">';
329368
content += qcMessage;
330369
content += '</div>';
331370

@@ -900,7 +939,7 @@ function getColumnDefs() {
900939
"render": function (data, type, row, meta) {
901940
let result = '';
902941
if (null != data && !jQuery.isEmptyObject(data)) {
903-
let flagColor = getFlagColor(data['qcFlag'], 'y1');
942+
let flagColor = getFlagColor(data['qcFlag'], 'y1', false);
904943
if (null == flagColor) {
905944
throw 'Unrecognised flag ' + data['qcFlag'];
906945
}
@@ -1159,7 +1198,7 @@ function drawY2Plot(index, keepZoom) {
11591198
y2_options.visibility[0] = false;
11601199

11611200
// The labels contain the X axis, which we don't use for series colors
1162-
let y2Colors = getFlagColors(labels.slice(3, labels.length - 1), 'y2');
1201+
let y2Colors = getFlagColors(labels.slice(3, labels.length - 1), 'y2', true);
11631202
// Insert blank colors for the ID and Y1 series, which aren't shown
11641203
y2Colors.splice(0, 0, null, null);
11651204

@@ -1574,10 +1613,10 @@ function drawFlagPlot1Y(index) {
15741613
window['flagPlot' + index] = null;
15751614
} else {
15761615
let flag_options = Object.assign({}, BASE_PLOT_OPTIONS);
1577-
flag_options.labels = JSON.parse($(getPlotFormName(index) + '\\:plot' + index + 'FlagLabels').val());
1616+
flag_options.labels = JSON.parse($(getPlotFormName(index) + '\\:plot' + index + 'FlagLabels').val());
15781617

1579-
// The labels contain the X axis, which we don't use for series colors
1580-
flag_options.colors = getFlagColors(flag_options.labels.slice(1), 'y1');
1618+
// The labels contain the X axis, which we don't use for series colors
1619+
flag_options.colors = getFlagColors(flag_options.labels.slice(1), 'y1', true);
15811620
flag_options.xlabel = ' ';
15821621
flag_options.ylabel = ' ';
15831622
flag_options.pointSize = FLAG_POINT_SIZE;
@@ -1628,8 +1667,8 @@ function drawFlagPlot2Y(index) {
16281667

16291668
flag_options.labels = JSON.parse($(getPlotFormName(index) + '\\:plot' + index + 'FlagLabels').val());
16301669

1631-
// The labels contain the X axis, which we don't use for series colors
1632-
flag_options.colors = getFlagColors(flag_options.labels.slice(1), 'y1');
1670+
// The labels contain the X axis, which we don't use for series colors
1671+
flag_options.colors = getFlagColors(flag_options.labels.slice(1), 'y1', true);
16331672

16341673
flag_options.xlabel = ' ';
16351674
flag_options.ylabel = ' ';
@@ -2408,7 +2447,7 @@ function getPointColor(mapIndex, point) {
24082447
.getColor(point.properties.value);
24092448
}
24102449
case FLAG_TYPE: {
2411-
return getFlagColor(point.properties.flag, 'y1');
2450+
return getFlagColor(point.properties.flag, 'y1', true);
24122451
}
24132452
case SELECTION_TYPE: {
24142453
return null != window['mapSelectionColor'] ? window['mapSelectionColor'] : '#FFFF00';

WebApp/src/uk/ac/exeter/QuinCe/data/Dataset/QC/ArgoFlagScheme.java

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,55 @@
11
package uk.ac.exeter.QuinCe.data.Dataset.QC;
22

3+
import java.util.ArrayList;
4+
import java.util.List;
5+
36
import uk.ac.exeter.QuinCe.data.Instrument.Instrument;
47

58
public class ArgoFlagScheme extends AbstractFlagScheme {
69

10+
/**
11+
* {@link Flag} indicating that a value is probably good.
12+
*/
13+
public static final Flag PROBABLY_GOOD_FLAG = new Flag(2, "Probably Good",
14+
'P', 10, true, false, 2);
15+
16+
/**
17+
* {@link Flag} indicating that a value has been estimated.
18+
*/
19+
public static final Flag ESTIMATED_VALUE_FLAG = new Flag(8, "Estimated Value",
20+
'E', 20, false, false, 8);
21+
22+
/**
23+
* {@link Flag} indicating that a value has been estimated.
24+
*/
25+
public static final Flag VALUE_CHANGED_FLAG = new Flag(5, "Value Changed",
26+
'C', 30, false, false, 5);
27+
28+
/**
29+
* {@link Flag} indicating that a value is bad but may be correctable.
30+
*/
31+
public static final Flag BAD_CORRECTABLE_FLAG = new Flag(3,
32+
"Bad, potentially correctable", 'b', 40, true, false, 3);
33+
34+
/**
35+
* {@link Flag} indicating that a value is bad and not correctable.
36+
*/
37+
public static final Flag BAD_FLAG = new Flag(4, "Bad", 'B', 50, true, false,
38+
4);
39+
740
/**
841
* Singleton instance of this scheme.
942
*/
1043
private static ArgoFlagScheme instance = null;
1144

1245
protected ArgoFlagScheme() throws FlagException {
1346
super();
14-
registerGoodFlag(new Flag(2, "Good", 'G', 2, true, false, 2));
47+
registerGoodFlag(new Flag(1, "Good", 'G', 2, true, false, 1));
48+
registerFlag(PROBABLY_GOOD_FLAG);
49+
registerFlag(ESTIMATED_VALUE_FLAG);
50+
registerFlag(VALUE_CHANGED_FLAG);
51+
registerFlag(BAD_CORRECTABLE_FLAG);
52+
registerFlag(BAD_FLAG);
1553
}
1654

1755
public static ArgoFlagScheme getInstance() throws FlagException {
@@ -35,8 +73,18 @@ public String getName() {
3573

3674
@Override
3775
public Flag getBadFlag() {
38-
// TODO Auto-generated method stub
39-
return null;
76+
return BAD_FLAG;
4077
}
4178

79+
@Override
80+
public List<Flag> getPlotHighlightFlags() {
81+
List<Flag> result = new ArrayList<Flag>();
82+
result.add(getGoodFlag());
83+
result.add(PROBABLY_GOOD_FLAG);
84+
result.add(ESTIMATED_VALUE_FLAG);
85+
result.add(VALUE_CHANGED_FLAG);
86+
result.add(BAD_CORRECTABLE_FLAG);
87+
result.add(BAD_FLAG);
88+
return result;
89+
}
4290
}

WebApp/src/uk/ac/exeter/QuinCe/web/datasets/plotPage/FlagPlotValueSerializer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ public JsonElement serialize(PlotValue src, Type typeOfSrc,
6868
}
6969
}
7070
}
71-
7271
}
7372

7473
// Placeholder for the Y2 value if we're doing a dual-axis plot. I

0 commit comments

Comments
 (0)