From a0137b341eac8e0093f274f6b141557535dfdc6e Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Thu, 29 Jan 2015 12:27:04 -0800 Subject: [PATCH] [Plot] Fix bug for panels Fix bug wherein number of points-to-plot is misreported with multiple traces in a plot; clean up on modifications to plot to self-cache streaming telemetry, to remove other cache, WTD-751. --- platform/features/plot/src/PlotController.js | 13 +++++++++---- platform/features/plot/src/elements/PlotUpdater.js | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/platform/features/plot/src/PlotController.js b/platform/features/plot/src/PlotController.js index 74de65d1aa..0050a5a22e 100644 --- a/platform/features/plot/src/PlotController.js +++ b/platform/features/plot/src/PlotController.js @@ -34,6 +34,7 @@ define( var subPlotFactory = new SubPlotFactory(telemetryFormatter), modeOptions = new PlotModeOptions([], subPlotFactory), subplots = [], + cachedObjects = [], updater, subscription, domainOffset; @@ -56,10 +57,13 @@ define( // Set up available modes (stacked/overlaid), based on the // set of telemetry objects in this plot view. function setupModes(telemetryObjects) { - modeOptions = new PlotModeOptions( - telemetryObjects || [], - subPlotFactory - ); + if (cachedObjects !== telemetryObjects) { + cachedObjects = telemetryObjects; + modeOptions = new PlotModeOptions( + telemetryObjects || [], + subPlotFactory + ); + } } // Update all sub-plots @@ -81,6 +85,7 @@ define( // Handle new telemetry data in this plot function updateValues() { + setupModes(subscription.getTelemetryObjects()); if (updater) { updater.update(); modeOptions.getModeHandler().plotTelemetry(updater); diff --git a/platform/features/plot/src/elements/PlotUpdater.js b/platform/features/plot/src/elements/PlotUpdater.js index b074765bbd..f59fda4e52 100644 --- a/platform/features/plot/src/elements/PlotUpdater.js +++ b/platform/features/plot/src/elements/PlotUpdater.js @@ -194,7 +194,7 @@ define( * @returns {number} the number of points in this buffer */ getLength: function (index) { - return lengthArray; + return lengthArray[index] || 0; }, /** * Update with latest data.