[Telemetry] Refactor plot to use TelemetryFormatter

Refactor plot view to use an injected telemetry formatter,
instead of explicitly including moment. WTD-599.
This commit is contained in:
Victor Woeltjen
2014-12-24 10:59:34 -08:00
parent b080f90f64
commit fc0376296d
8 changed files with 62 additions and 14 deletions

View File

@ -0,0 +1,40 @@
/*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;
}
);