Skip to content

Commit

Permalink
specify the color of the no resolution and no skill lines for the rel…
Browse files Browse the repository at this point in the history
…iability diagram #465
  • Loading branch information
TatianaBurek committed Oct 17, 2023
1 parent 31482cd commit fc17f51
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 19 deletions.
21 changes: 21 additions & 0 deletions java/edu/ucar/metviewer/MVPlotJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ public class MVPlotJob {

protected List<LineAttributes> lines = new ArrayList<>();

protected String referenceLineCol = "#FF0000";
protected String noskillLineCol = "#FF0000";


/**
* Deep copy of the MVPlotJob, useful for inheritance.
Expand Down Expand Up @@ -350,6 +353,8 @@ public MVPlotJob copy() {
job._strLegendNcol = _strLegendNcol;
job._strCaptionWeight = _strCaptionWeight;
job._strCaptionCol = _strCaptionCol;
job.referenceLineCol = referenceLineCol;
job.noskillLineCol = noskillLineCol;
job._strCaptionSize = _strCaptionSize;
job._strCaptionOffset = _strCaptionOffset;
job._strCaptionAlign = _strCaptionAlign;
Expand Down Expand Up @@ -2378,5 +2383,21 @@ public String getLineType() {
}
return "N/A";
}

public String getReferenceLineCol() {
return referenceLineCol;
}

public void setReferenceLineCol(String referenceLineCol) {
this.referenceLineCol = referenceLineCol;
}

public String getNoskillLineCol() {
return noskillLineCol;
}

public void setNoskillLineCol(String noskillLineCol) {
this.noskillLineCol = noskillLineCol;
}
}

18 changes: 13 additions & 5 deletions java/edu/ucar/metviewer/MVPlotJobParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ public final class MVPlotJobParser {
MVPlotJob.class.getDeclaredMethod("setCaptionWeight", String.class));
formatToStrValues
.put("caption_col", MVPlotJob.class.getDeclaredMethod("setCaptionCol", String.class));
formatToStrValues
.put("reference_line_col", MVPlotJob.class.getDeclaredMethod("setReferenceLineCol", String.class));
formatToStrValues
.put("noskill_line_col", MVPlotJob.class.getDeclaredMethod("setNoskillLineCol", String.class));
formatToStrValues
.put("caption_size", MVPlotJob.class.getDeclaredMethod("setCaptionSize", String.class));
formatToStrValues.put("caption_offset",
Expand Down Expand Up @@ -895,10 +899,10 @@ public static StringBuilder serializeJob(MVPlotJob job, DatabaseInfo databaseInf
xmlStr.append("<rely_event_hist>").append(job.getRelyEventHist()).append("</rely_event_hist>");
xmlStr.append("<add_skill_line>").append(job.getAddSkillLine()).append("</add_skill_line>");
xmlStr.append("<add_noskill_line>").append(job.getAddNoSkillLine()).append("</add_noskill_line>");
xmlStr.append("<add_reference_line>").append(job.getAddReferenceLine())
.append("</add_reference_line>");
xmlStr.append("<add_point_thresholds>").append(job.getAddPointThresholds())
.append("</add_point_thresholds>");
xmlStr.append("<noskill_line_col>").append(job.getNoskillLineCol()).append("</noskill_line_col>");
xmlStr.append("<add_reference_line>").append(job.getAddReferenceLine()).append("</add_reference_line>");
xmlStr.append("<reference_line_col>").append(job.getReferenceLineCol()).append("</reference_line_col>");
xmlStr.append("<add_point_thresholds>").append(job.getAddPointThresholds()).append("</add_point_thresholds>");
xmlStr.append("<reverse_connection_order>").append(job.getReverseConnectionOrder())
.append("</reverse_connection_order>");
xmlStr.append("<create_html>").append(job.getCreateHtml())
Expand Down Expand Up @@ -1919,7 +1923,11 @@ else if (node.tag.equals("roc_calc")) {
} else if (node.tag.equals("add_noskill_line")) {
job.setAddNoSkillLine(node.value.equalsIgnoreCase("true"));
} else if (node.tag.equals("add_reference_line")) {
job.setAddReferenceLine(node.value.equalsIgnoreCase("true"));
job.setAddReferenceLine(node.value.equalsIgnoreCase("true"));}
else if (node.tag.equals("reference_line_col")) {
job.setReferenceLineCol(node.value);}
else if (node.tag.equals("noskill_line_col")) {
job.setNoskillLineCol(node.value);
} else if (node.tag.equals("create_html")) {
job.setCreateHtml(node.value.equalsIgnoreCase("true"));
}
Expand Down
2 changes: 2 additions & 0 deletions java/edu/ucar/metviewer/jobManager/RelyJobManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ protected void run(MVPlotJob job) throws ParseException, ValidationException, IO
yamlInfo.put("add_reference_line", job.getAddReferenceLine() ? "True" : "False");
yamlInfo.put("rely_event_hist", job.getRelyEventHist().equals("TRUE") ? "True" : "False");
yamlInfo.put("inset_hist", job.getInsetHist() ? "True" : "False");
yamlInfo.put("reference_line_col", job.getReferenceLineCol());
yamlInfo.put("noskill_line_col", job.getNoskillLineCol());

rscriptStatManager.prepareDataFileAndRscript(job, plotFixPerm, yamlInfo, new ArrayList<>());
job.setPlotTmpl(this.getPythonScript());
Expand Down
30 changes: 30 additions & 0 deletions webapp/metviewer/js/metviewer_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -3979,6 +3979,19 @@ function createXMLRely(plot) {
agg_stat.append($('<eveq_dis />').text($('#eveq_dis').is(':checked')));
agg_stat.append($('<cl_step />').text($('#cl_step').val()));
plot.append(agg_stat);
var reference_line_col = $('#reference_line_col').val();
if (reference_line_col.startsWith("#")) {
plot.append($('<reference_line_col />').text(reference_line_col));
} else {
plot.append($('<reference_line_col />').text("#" + reference_line_col));
}
var noskill_line_col = $('#noskill_line_col').val();
if (noskill_line_col.startsWith("#")) {
plot.append($('<noskill_line_col />').text(noskill_line_col));
} else {
plot.append($('<noskill_line_col />').text("#" + noskill_line_col));
}

plot = createXMLCommon(plot);
return plot;
}
Expand Down Expand Up @@ -6367,6 +6380,21 @@ function loadXMLRely() {
$('#add_reference_line').prop('checked', false);
}
}
if (initXML.find("plot").find("reference_line_col")) {
var reference_line_col = $(initXML.find("plot").find("reference_line_col")).text();
if (reference_line_col.length > 7) {
reference_line_col = reference_line_col.substring(0, 7);
}
$('#reference_line_col').colorpicker('setColor', reference_line_col);
}
if (initXML.find("plot").find("noskill_line_col")) {
var noskill_line_col = $(initXML.find("plot").find("noskill_line_col")).text();
if (noskill_line_col.length > 7) {
noskill_line_col = noskill_line_col.substring(0, 7);
}
$('#noskill_line_col').colorpicker('setColor', noskill_line_col);
}

loadXMLStatistics();
$("#event_equal").prop('checked', $(initXML.find("plot").find("event_equal")).text() == "true").trigger("change");

Expand Down Expand Up @@ -8137,6 +8165,8 @@ function initPage() {
});
$('#caption_col').colorpicker('setColor', '#333333');



$("#error_message").dialog({
modal: true,
autoOpen: false,
Expand Down
9 changes: 5 additions & 4 deletions webapp/metviewer/js/metviewer_common.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fc17f51

Please sign in to comment.