From 70d593aec2f822d4f5d0f911550491c1e4a69a6a Mon Sep 17 00:00:00 2001 From: TatianaBurek Date: Thu, 15 Feb 2024 14:51:16 -0700 Subject: [PATCH] Bugfix for loading xml #513 --- java/edu/ucar/metviewer/MVPlotJob.java | 10 ++++++++++ java/edu/ucar/metviewer/jobManager/JobManager.java | 6 ++---- webapp/metviewer/js/metviewer_common.js | 2 +- webapp/metviewer/js/metviewer_common.min.js | 2 +- webapp/metviewer/plotJSP/eclv.jsp | 2 +- webapp/metviewer/plotJSP/hist.jsp | 3 ++- 6 files changed, 17 insertions(+), 8 deletions(-) diff --git a/java/edu/ucar/metviewer/MVPlotJob.java b/java/edu/ucar/metviewer/MVPlotJob.java index 493bbecd..8aea1d73 100644 --- a/java/edu/ucar/metviewer/MVPlotJob.java +++ b/java/edu/ucar/metviewer/MVPlotJob.java @@ -1822,6 +1822,16 @@ public void setConSeries(String conSeries) { } public String getShowLegend() { + if (showLegend == null){ + String templ = getPch(); + int size = templ.split(",").length; + String result = "c("; + for (int i = 0; i < size; i++) { + result = result + "1,"; + } + showLegend = result.substring(0, result.length() - 1) + ")"; + } + return showLegend; } diff --git a/java/edu/ucar/metviewer/jobManager/JobManager.java b/java/edu/ucar/metviewer/jobManager/JobManager.java index 65797586..dd9073e8 100644 --- a/java/edu/ucar/metviewer/jobManager/JobManager.java +++ b/java/edu/ucar/metviewer/jobManager/JobManager.java @@ -304,9 +304,7 @@ protected Map createInfoMap(MVPlotJob job, int intNumDepSeries) info.put("con_series", job.getConSeries().isEmpty() ? MVUtil.printRCol( MVUtil.rep(0, intNumDepSeries)) : job.getConSeries()); - if(job.getShowLegend() != null){ - info.put("show_legend",MVUtil.printRCol(MVUtil.rep(0, intNumDepSeries))); - } + info.put("show_legend",job.getShowLegend().isEmpty() ? "c()" : job.getShowLegend()); info.put("legend", job.getLegend().isEmpty() ? "c()" : job.getLegend()); info.put("y1_lim", job.getY1Lim().isEmpty() ? "c()" : job.getY1Lim()); info.put("x1_lim", job.getX1Lim().isEmpty() ? "c()" : job.getX1LimR()); @@ -641,7 +639,7 @@ protected Map addPlotConfigs(Map yamlInfo, MVPlo info.put("show_signif", rListToList(job.getShowSignif())); info.put("con_series", rListToListNumeric(job.getConSeries())); - info.put("show_legend", rListToListNumeric(job.getShowLegend())); + info.put("show_legend", rListToList(job.getShowLegend())); info.put("plot_ci", rListToList(job.getPlotCI())); diff --git a/webapp/metviewer/js/metviewer_common.js b/webapp/metviewer/js/metviewer_common.js index 7557d70c..090a8f63 100644 --- a/webapp/metviewer/js/metviewer_common.js +++ b/webapp/metviewer/js/metviewer_common.js @@ -7636,7 +7636,7 @@ function initPage() { editable: true, edittype: "select", formatter: 'select', - editoptions: {value: "0:No;1:Yes"}, + editoptions: {value: "1:Yes;0:No"}, sortable: false, }, { diff --git a/webapp/metviewer/js/metviewer_common.min.js b/webapp/metviewer/js/metviewer_common.min.js index bfb9daab..141d749c 100644 --- a/webapp/metviewer/js/metviewer_common.min.js +++ b/webapp/metviewer/js/metviewer_common.min.js @@ -339,7 +339,7 @@ $("body").on("resize",function(){$("#plot_display_inner").tabs("refresh")});$("< width:10,index:"order",sortable:!1},{name:"y_axis",width:30,index:"y_axis",align:"center"},{name:"hide",index:"hide",width:30,align:"center",editable:!0,edittype:"checkbox",editoptions:{value:"Yes:No"}},{name:"title",index:"title",width:300},{name:"plot_ci",index:"plot_ci",width:70,editable:!0,edittype:"select",formatter:"select",editoptions:{value:"none:none;boot:boot;std:std;met_prm:met_prm;met_boot:met_boot"},align:"center"},{name:"color",index:"color",width:40,editable:!0,edittype:"custom",editoptions:{custom_element:myelem, custom_value:myvalue},formatter:colorDisplayFmatter,unformat:colorDisplayUnmatter,align:"center"},{name:"pch",index:"pch",editable:!0,width:70,align:"center",edittype:"select",formatter:"select",editoptions:{value:"20:Small circle;19:Circle;15:Square;17:Triangle;18:Rhombus;1:Ring"}},{name:"type",index:"type",sortable:!1,editable:!0,edittype:"select",formatter:"select",editoptions:{value:"p:points;l:lines;o:overplotted;b:joined lines;s:stair steps;h:histogram-like;n:nothing"},width:50,align:"center"}, {name:"lty",index:"lty",sortable:!1,editable:!0,edittype:"select",formatter:"select",editoptions:{value:"1:solid;2:dashed;3:dotted;4:dot-dash;5:long dash;6:long short"},width:70,align:"center"},{name:"lwd",index:"lwd",sortable:!1,editable:!0,sorttype:"int",width:40,align:"center"},{name:"show_signif",index:"hide",width:30,align:"center",editable:!0,edittype:"checkbox",editoptions:{value:"Yes:No"}},{name:"con_series",index:"con_series",sortable:!1,editable:!0,edittype:"select",formatter:"select",editoptions:{value:"0:No;1:Yes"}, -width:30,align:"center"},{name:"show_legend",index:"show_legend",width:30,align:"center",editable:!0,edittype:"select",formatter:"select",editoptions:{value:"0:No;1:Yes"},sortable:!1},{name:"legend",index:"legend",sortable:!1,width:150,align:"left",editable:!0}],rowNum:-1,height:"auto",pager:"#pagerdt",pginput:!1,pgtext:!1,pgbuttons:!1,viewrecords:!0,caption:"Series Formatting",cmTemplate:{title:!1},cellEdit:!0,hoverrows:!1,url:"clientArray",cellsubmit:"clientArray",afterInsertRow:function(a,b){$("#color_"+ +width:30,align:"center"},{name:"show_legend",index:"show_legend",width:30,align:"center",editable:!0,edittype:"select",formatter:"select",editoptions:{value:"1:Yes;0:No"},sortable:!1},{name:"legend",index:"legend",sortable:!1,width:150,align:"left",editable:!0}],rowNum:-1,height:"auto",pager:"#pagerdt",pginput:!1,pgtext:!1,pgbuttons:!1,viewrecords:!0,caption:"Series Formatting",cmTemplate:{title:!1},cellEdit:!0,hoverrows:!1,url:"clientArray",cellsubmit:"clientArray",afterInsertRow:function(a,b){$("#color_"+ b.id).colorpicker({parts:"header map bar hex rgb alpha preview swatches footer".split(" "),altField:"#color_"+b.id})},beforeEditCell:function(a,b,c,d,e){lastSelRow=d;lastSelCol=e}});$("#listdt").jqGrid("navGrid","#pagerdt",{edit:!1,add:!1,del:!1,search:!1,refresh:!1});var a=$("#addDiffCurveDialogForm").dialog({autoOpen:!1,height:"auto",width:"auto",modal:!0,buttons:{"Create Derived Curve":function(){var b=!1,c=$("input:radio[name=yAxisDiff]:checked").val(),d=jQuery("input[name=derive_oper]:checked").val(); -1!==c.indexOf("1")?$("#series1Y1").val()&&$("#series2Y1").val()&&(seriesDiffY1.push($("#series1Y1").val()+","+$("#series2Y1").val()+","+d),b=!0):$("#series1Y2").val()&&$("#series2Y2").val()&&(seriesDiffY2.push($("#series1Y2").val()+","+$("#series2Y2").val()+","+d),b=!0);a.dialog("close");b&&(updateSeries(),$("#event_equal").prop("checked",!0).trigger("change"))},Cancel:function(){a.dialog("close")}},open:function(){$("input[name=derive_oper][value=DIFF]").prop("checked",!0);for(var a=$("#listdt").jqGrid("getRowData"), b=0;b 0 ){ @@ -277,7 +278,6 @@ } initXML = null; } else { - series_var_y1_indexes = []; updateSeriesVarValHist(1, []); updateSeriesHist(); } diff --git a/webapp/metviewer/plotJSP/hist.jsp b/webapp/metviewer/plotJSP/hist.jsp index 67d7ee74..f0932116 100644 --- a/webapp/metviewer/plotJSP/hist.jsp +++ b/webapp/metviewer/plotJSP/hist.jsp @@ -220,6 +220,8 @@ updateSeriesHist(); }); fixed_var_indexes.push(1); + series_var_y1_indexes = []; + if (initXML != null) { if(initXML.find("error").length > 0 ){ alert(initXML.find("error").text()) @@ -239,7 +241,6 @@ } initXML = null; } else { - series_var_y1_indexes = []; updateSeriesVarValHist(1, []); changeFixedVarHist('rhist'); updateFixedVarValHist(1, []);