mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 22:28:13 +00:00
[Plot] Organize plot elements
Place elements of the PlotController into a separate directory inside of the source folder for the plot plug-in, in preparation for review and integration. Part of ongoing plot transition to Angular, WTD-533.
This commit is contained in:
35
platform/features/plot/src/elements/PlotAxis.js
Normal file
35
platform/features/plot/src/elements/PlotAxis.js
Normal file
@ -0,0 +1,35 @@
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
"use strict";
|
||||
|
||||
function PlotAxis(axisType, metadatas, defaultValue) {
|
||||
var keys = {},
|
||||
options = [];
|
||||
|
||||
function buildOptionsForMetadata(m) {
|
||||
(m[axisType] || []).forEach(function (option) {
|
||||
if (!keys[option.key]) {
|
||||
keys[option.key] = true;
|
||||
options.push(option);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
(metadatas || []).forEach(buildOptionsForMetadata);
|
||||
|
||||
// Plot axis will be used directly from the Angular
|
||||
// template, so expose properties directly to facilitate
|
||||
// two-way data binding (for drop-down menus)
|
||||
return {
|
||||
options: options,
|
||||
active: options[0] || defaultValue
|
||||
};
|
||||
}
|
||||
|
||||
return PlotAxis;
|
||||
|
||||
}
|
||||
);
|
Reference in New Issue
Block a user