Commit 28f49219 by Valera Rozuvan Committed by Alexander Kryklia

GST work in progress.

parent 3682cb46
...@@ -2,13 +2,15 @@ ...@@ -2,13 +2,15 @@
// define() functions from Require JS available inside the anonymous function. // define() functions from Require JS available inside the anonymous function.
(function (requirejs, require, define) { (function (requirejs, require, define) {
define('Graph', [], function () { define('Graph', ['logme'], function (logme) {
return Graph; return Graph;
function Graph(gstId, config, state) { function Graph(gstId, config, state) {
var plotDiv, dataSets, functions; var plotDiv, dataSets, functions;
logme(config);
plotDiv = $('#' + gstId + '_plot'); plotDiv = $('#' + gstId + '_plot');
if (plotDiv.length === 0) { if (plotDiv.length === 0) {
...@@ -39,11 +41,29 @@ define('Graph', [], function () { ...@@ -39,11 +41,29 @@ define('Graph', [], function () {
if (typeof config.plot['function'] === 'string') { if (typeof config.plot['function'] === 'string') {
addFunction(config.plot['function']); addFunction(config.plot['function']);
} else if ($.isPlainObject(config.plot['function']) === true) { } else if ($.isPlainObject(config.plot['function']) === true) {
addFunction(
config.plot['function']['#text'],
config.plot['function']['@color'],
config.plot['function']['@dot'],
config.plot['function']['@label'],
config.plot['function']['@line'],
config.plot['function']['@point_size'],
config.plot['function']['@style']
);
} else if ($.isArray(config.plot['function'])) { } else if ($.isArray(config.plot['function'])) {
for (c1 = 0; c1 < config.plot['function'].length; c1++) { for (c1 = 0; c1 < config.plot['function'].length; c1++) {
if (typeof config.plot['function'][c1] === 'string') { if (typeof config.plot['function'][c1] === 'string') {
addFunction(config.plot['function'][c1]); addFunction(config.plot['function'][c1]);
} else if ($.isPlainObject(config.plot['function'][c1])) {
addFunction(
config.plot['function'][c1]['#text'],
config.plot['function'][c1]['@color'],
config.plot['function'][c1]['@dot'],
config.plot['function'][c1]['@label'],
config.plot['function'][c1]['@line'],
config.plot['function'][c1]['@point_size'],
config.plot['function'][c1]['@style']
);
} }
} }
} }
...@@ -76,17 +96,31 @@ define('Graph', [], function () { ...@@ -76,17 +96,31 @@ define('Graph', [], function () {
} }
if (typeof line === 'boolean') { if (typeof line === 'boolean') {
newFunctionObject['line'] = line; if ((line === 'true') || (line === true)) {
newFunctionObject['line'] = true;
} else {
newFunctionObject['line'] = false;
}
} }
if (typeof dot === 'boolean') { if ((typeof dot === 'boolean') || (typeof dot === 'string')) {
newFunctionObject['dot'] = dot; if ((dot === 'true') || (dot === true)) {
newFunctionObject['dot'] = true;
} else {
newFunctionObject['dot'] = false;
}
}
if ((newFunctionObject['dot'] === false) && (newFunctionObject['line'] === false)) {
newFunctionObject['line'] = true;
} }
if (typeof label === 'string') { if (typeof label === 'string') {
newFunctionObject['label'] = label; newFunctionObject['label'] = label;
} }
logme(newFunctionObject);
functions.push(newFunctionObject); functions.push(newFunctionObject);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment