openmct/platform/features/plot/src/SubPlotFactory.js
Victor Woeltjen fc0376296d [Telemetry] Refactor plot to use TelemetryFormatter
Refactor plot view to use an injected telemetry formatter,
instead of explicitly including moment. WTD-599.
2014-12-24 10:59:34 -08:00

40 lines
1.3 KiB
JavaScript

/*global define*/
define(
["./SubPlot"],
function (SubPlot) {
"use strict";
/**
* Utility factory; wraps the SubPlot constructor and adds
* in a reference to the telemetryFormatter, which will be
* used to represent telemetry values (timestamps or data
* values) as human-readable strings.
* @constructor
*/
function SubPlotFactory(telemetryFormatter) {
return {
/**
* Instantiate a new sub-plot.
* @param {DomainObject[]} telemetryObjects the domain objects
* which will be plotted in this sub-plot
* @param {PlotPanZoomStack} panZoomStack the stack of pan-zoom
* states which is applicable to this sub-plot
* @returns {SubPlot} the instantiated sub-plot
* @method
* @memberof SubPlotFactory
*/
createSubPlot: function (telemetryObjects, panZoomStack) {
return new SubPlot(
telemetryObjects,
panZoomStack,
telemetryFormatter
);
}
};
}
return SubPlotFactory;
}
);