Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions webapp/TargetedMS/js/QCPlotHelperBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,21 +332,17 @@ Ext4.define("LABKEY.targetedms.QCPlotHelperBase", {

Ext4.Object.each(this.guideSetDataMap, function(guideSetId, guideSetData) {
// for truncating out of range guideset data find first index of plotDate ending at guideset.trainingEnd
if (plotData.guideSetId === guideSetId && plotData.inGuideSetTrainingRange && guideSetData.TrainingEnd <= this.startDate) {
if (plotData.guideSetId == guideSetId && plotData.inGuideSetTrainingRange && guideSetData.TrainingEnd <= this.startDate) {
this.filterPoints[frag][plotData.MetricId]['filterPointsFirstIndex'] = j + 1;
// ReferenceRangeSeries is used to separate series
plotData['ReferenceRangeSeries'] = "GuideSet";
}
else {
plotData['ReferenceRangeSeries'] = "InRange";
}

}, this);

// for truncating out of range guideset data find last index of plotData starting from this.startDate
// Mark the last index to truncate as j-1 (the point just before the user range starts),
// so the first in-range data point is NOT included in the removed gap.
if (plotData.fullDate >= this.startDate) {
if (!this.filterPoints[frag][plotData.MetricId]['filterPointsLastIndex']) {
this.filterPoints[frag][plotData.MetricId]['filterPointsLastIndex'] = j;
if (this.filterPoints[frag][plotData.MetricId]['filterPointsLastIndex'] === undefined) {
this.filterPoints[frag][plotData.MetricId]['filterPointsLastIndex'] = j - 1;
}
}
}
Expand Down Expand Up @@ -392,6 +388,16 @@ Ext4.define("LABKEY.targetedms.QCPlotHelperBase", {
renderPlots: function() {
if (this.filterQCPoints) {
this.truncateOutOfRangeQCPoints();
// Recompute showDataPoints based on post-truncation counts, since the gap between the
// reference guide set and the user's date range was removed and the remaining set may
// be well under the threshold.
var maxPointsPerSeries = 0;
for (var i = 0; i < this.precursors.length; i++) {
if (this.fragmentPlotData[this.precursors[i]]) {
maxPointsPerSeries = Math.max(this.fragmentPlotData[this.precursors[i]].data.length, maxPointsPerSeries);
}
}
this.showDataPoints = maxPointsPerSeries <= LABKEY.targetedms.QCPlotHelperBase.maxPointsPerSeries;
}
// do not persist plot options in qc folder if changed after coming through experimental folder link
if (!this.showExpRunRange) {
Expand Down Expand Up @@ -434,7 +440,7 @@ Ext4.define("LABKEY.targetedms.QCPlotHelperBase", {
Ext4.Object.each(this.fragmentPlotData, function(label, fragmentData) {
// traverse plotData backwards from firstIndex to lastIndex and
// remove them from the array
if (this.filterQCPoints && this.filterPoints) {
if (this.filterQCPoints && this.filterPoints && this.filterPoints[label]) {

// when we're plotting two different metrics at the same time, then we
// have repeated dates (from oldest to newest for metric 1, and then oldest to newest for metric 2, all in the same array).
Expand Down
Loading