mirror of
https://github.com/nasa/openmct.git
synced 2024-12-29 17:38:53 +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",
|
||||
"implementation": "PlotController.js",
|
||||
"depends": [ "$scope", "telemetryFormatter", "telemetryHandler" ]
|
||||
"depends": [ "$scope", "telemetryFormatter", "telemetryHandler", "throttle" ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -51,13 +51,14 @@ define(
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function PlotController($scope, telemetryFormatter, telemetryHandler) {
|
||||
function PlotController($scope, telemetryFormatter, telemetryHandler, throttle) {
|
||||
var subPlotFactory = new SubPlotFactory(telemetryFormatter),
|
||||
modeOptions = new PlotModeOptions([], subPlotFactory),
|
||||
subplots = [],
|
||||
cachedObjects = [],
|
||||
updater,
|
||||
handle,
|
||||
scheduleUpdate,
|
||||
domainOffset;
|
||||
|
||||
// Populate the scope with axis information (specifically, options
|
||||
@ -89,9 +90,7 @@ define(
|
||||
|
||||
// Update all sub-plots
|
||||
function update() {
|
||||
modeOptions.getModeHandler()
|
||||
.getSubPlots()
|
||||
.forEach(updateSubplot);
|
||||
scheduleUpdate();
|
||||
}
|
||||
|
||||
// Reinstantiate the plot updater (e.g. because we have a
|
||||
@ -162,6 +161,12 @@ define(
|
||||
|
||||
// Unsubscribe when the plot is destroyed
|
||||
$scope.$on("$destroy", releaseSubscription);
|
||||
|
||||
// Create a throttled update function
|
||||
scheduleUpdate = throttle(function () {
|
||||
modeOptions.getModeHandler().getSubPlots()
|
||||
.forEach(updateSubplot);
|
||||
});
|
||||
|
||||
return {
|
||||
/**
|
||||
|
@ -62,8 +62,6 @@ define(
|
||||
points: buf.getLength()
|
||||
};
|
||||
});
|
||||
|
||||
subplot.update();
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -58,8 +58,6 @@ define(
|
||||
color: PlotPalette.getFloatColor(0),
|
||||
points: buffer.getLength()
|
||||
}];
|
||||
|
||||
subplot.update();
|
||||
}
|
||||
|
||||
function plotTelemetry(prepared) {
|
||||
|
Loading…
Reference in New Issue
Block a user