[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:
Victor Woeltjen
2014-12-01 18:21:51 -08:00
parent ad802e674e
commit 86711735b7
8 changed files with 17 additions and 9 deletions

View 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;
}
);