mirror of
https://github.com/nasa/openmct.git
synced 2025-01-01 19:06:40 +00:00
[Plot] Throttle updates
Throttle plot updates to subplots; WTD-1202.
This commit is contained in:
parent
e06d11dcb2
commit
35b5fbefd0
@ -22,7 +22,7 @@
|
|||||||
{
|
{
|
||||||
"key": "PlotController",
|
"key": "PlotController",
|
||||||
"implementation": "PlotController.js",
|
"implementation": "PlotController.js",
|
||||||
"depends": [ "$scope", "telemetryFormatter", "telemetryHandler" ]
|
"depends": [ "$scope", "telemetryFormatter", "telemetryHandler", "throttle" ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,14 @@ define(
|
|||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function PlotController($scope, telemetryFormatter, telemetryHandler) {
|
function PlotController($scope, telemetryFormatter, telemetryHandler, throttle) {
|
||||||
var subPlotFactory = new SubPlotFactory(telemetryFormatter),
|
var subPlotFactory = new SubPlotFactory(telemetryFormatter),
|
||||||
modeOptions = new PlotModeOptions([], subPlotFactory),
|
modeOptions = new PlotModeOptions([], subPlotFactory),
|
||||||
subplots = [],
|
subplots = [],
|
||||||
cachedObjects = [],
|
cachedObjects = [],
|
||||||
updater,
|
updater,
|
||||||
handle,
|
handle,
|
||||||
|
scheduleUpdate,
|
||||||
domainOffset;
|
domainOffset;
|
||||||
|
|
||||||
// Populate the scope with axis information (specifically, options
|
// Populate the scope with axis information (specifically, options
|
||||||
@ -89,9 +90,7 @@ define(
|
|||||||
|
|
||||||
// Update all sub-plots
|
// Update all sub-plots
|
||||||
function update() {
|
function update() {
|
||||||
modeOptions.getModeHandler()
|
scheduleUpdate();
|
||||||
.getSubPlots()
|
|
||||||
.forEach(updateSubplot);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reinstantiate the plot updater (e.g. because we have a
|
// Reinstantiate the plot updater (e.g. because we have a
|
||||||
@ -162,6 +161,12 @@ define(
|
|||||||
|
|
||||||
// Unsubscribe when the plot is destroyed
|
// Unsubscribe when the plot is destroyed
|
||||||
$scope.$on("$destroy", releaseSubscription);
|
$scope.$on("$destroy", releaseSubscription);
|
||||||
|
|
||||||
|
// Create a throttled update function
|
||||||
|
scheduleUpdate = throttle(function () {
|
||||||
|
modeOptions.getModeHandler().getSubPlots()
|
||||||
|
.forEach(updateSubplot);
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
/**
|
/**
|
||||||
|
@ -62,8 +62,6 @@ define(
|
|||||||
points: buf.getLength()
|
points: buf.getLength()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
subplot.update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -58,8 +58,6 @@ define(
|
|||||||
color: PlotPalette.getFloatColor(0),
|
color: PlotPalette.getFloatColor(0),
|
||||||
points: buffer.getLength()
|
points: buffer.getLength()
|
||||||
}];
|
}];
|
||||||
|
|
||||||
subplot.update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function plotTelemetry(prepared) {
|
function plotTelemetry(prepared) {
|
||||||
|
Loading…
Reference in New Issue
Block a user