Skip to content

Commit

Permalink
Issue 50842: Fix upper and lower bounds legends on qc plots (#948)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankurjuneja authored Aug 19, 2024
1 parent d5297d9 commit f7d7a61
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions webapp/TargetedMS/js/LeveyJenningsPlotHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,15 @@ Ext4.define("LABKEY.targetedms.LeveyJenningsPlotHelper", {
return ['value_series1', 'value_series2'];
},

getLJLegend: function () {
getLJLegend: function (combinedPlot) {
var ljLegend = [];

if (!this.getMetricPropsById(this.metric).series2Label) {
let metricInfo = this.getMetricPropsById(this.metric);

if (metricInfo.metricStatus === LABKEY.targetedms.MetricStatus.ValueCutoff || metricInfo.metricStatus === LABKEY.targetedms.MetricStatus.MeanDeviationCutoff) {
let isCombinedValueCutOff = LABKEY.targetedms.MetricStatus.ValueCutoff && combinedPlot;
let isYAxisScaleLinearOrLog = this.yAxisScale === 'linear' || this.yAxisScale === 'log';
let showLegend = (isYAxisScaleLinearOrLog && isCombinedValueCutOff) || !isCombinedValueCutOff;
if (showLegend|| metricInfo.metricStatus === LABKEY.targetedms.MetricStatus.MeanDeviationCutoff) {
if (Number.isFinite(metricInfo.upperBound)) {
ljLegend.push({
text: 'Upper: ' + metricInfo.upperBound,
Expand Down
4 changes: 2 additions & 2 deletions webapp/TargetedMS/js/QCPlotHelperBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ Ext4.define("LABKEY.targetedms.QCPlotHelperBase", {
newLegendData = newLegendData.concat(ionLegend);
}

var extraPlotLegendData = this.getAdditionalPlotLegend(plotType);
var extraPlotLegendData = this.getAdditionalPlotLegend(plotType, true);
newLegendData = newLegendData.concat(extraPlotLegendData);

return newLegendData;
Expand Down Expand Up @@ -856,7 +856,7 @@ Ext4.define("LABKEY.targetedms.QCPlotHelperBase", {

Ext4.apply(trendLineProps, this.getPlotTypeProperties(precursorInfo, plotType, isCUSUMMean, metricProps));

var plotLegendData = this.getAdditionalPlotLegend(plotType);
var plotLegendData = this.getAdditionalPlotLegend(plotType, false);
if (Ext4.isArray(this.legendData)) {
plotLegendData = plotLegendData.concat(this.legendData);
}
Expand Down
4 changes: 2 additions & 2 deletions webapp/TargetedMS/js/QCPlotHelperWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,13 +392,13 @@ Ext4.define("LABKEY.targetedms.QCPlotHelperWrapper", {
return this.getLJCombinedPlotLegendSeries();
},

getAdditionalPlotLegend: function(plotType) {
getAdditionalPlotLegend: function(plotType, combinedPlot) {
if (plotType === LABKEY.vis.TrendingLinePlotType.CUSUM)
return this.getCUSUMGroupLegend();
if (plotType === LABKEY.vis.TrendingLinePlotType.MovingRange)
return this.getMRLegend();
if (plotType === LABKEY.vis.TrendingLinePlotType.LeveyJennings)
return this.getLJLegend();
return this.getLJLegend(combinedPlot);
if (this.showMeanCUSUMPlot() || this.showVariableCUSUMPlot() ||
plotType === LABKEY.vis.TrendingLinePlotType.TrailingMean ||
plotType === LABKEY.vis.TrendingLinePlotType.TrailingCV)
Expand Down

0 comments on commit f7d7a61

Please sign in to comment.