Ticket WTD-1315
Merge branch 'open-master' into open475
This commit is contained in:
@@ -23,7 +23,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) {
|
||||
|
||||
@@ -33,6 +33,7 @@ define(
|
||||
var mockScope,
|
||||
mockFormatter,
|
||||
mockHandler,
|
||||
mockThrottle,
|
||||
mockHandle,
|
||||
mockDomainObject,
|
||||
mockSeries,
|
||||
@@ -56,6 +57,7 @@ define(
|
||||
"telemetrySubscriber",
|
||||
["handle"]
|
||||
);
|
||||
mockThrottle = jasmine.createSpy("throttle");
|
||||
mockHandle = jasmine.createSpyObj(
|
||||
"subscription",
|
||||
[
|
||||
@@ -73,12 +75,18 @@ define(
|
||||
);
|
||||
|
||||
mockHandler.handle.andReturn(mockHandle);
|
||||
mockThrottle.andCallFake(function (fn) { return fn; });
|
||||
mockHandle.getTelemetryObjects.andReturn([mockDomainObject]);
|
||||
mockHandle.getMetadata.andReturn([{}]);
|
||||
mockHandle.getDomainValue.andReturn(123);
|
||||
mockHandle.getRangeValue.andReturn(42);
|
||||
|
||||
controller = new PlotController(mockScope, mockFormatter, mockHandler);
|
||||
controller = new PlotController(
|
||||
mockScope,
|
||||
mockFormatter,
|
||||
mockHandler,
|
||||
mockThrottle
|
||||
);
|
||||
});
|
||||
|
||||
it("provides plot colors", function () {
|
||||
@@ -224,4 +232,4 @@ define(
|
||||
});
|
||||
});
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user