# HG changeset patch # User Nicholas Jillings # Date 1493299165 -3600 # Node ID df1823dbfb93348b6787a6772190f7043b2261ff # Parent 7b1c05a9514a530389725345575c229cb8271f8e Add use scale to test_create diff -r 7b1c05a9514a -r df1823dbfb93 test_create.html --- a/test_create.html Thu Apr 27 13:55:40 2017 +0100 +++ b/test_create.html Thu Apr 27 14:19:25 2017 +0100 @@ -839,7 +839,17 @@

Axis Scales

- + + +
@@ -1011,7 +1021,7 @@
-
+
diff -r 7b1c05a9514a -r df1823dbfb93 test_create/test_core.js --- a/test_create/test_core.js Thu Apr 27 13:55:40 2017 +0100 +++ b/test_create/test_core.js Thu Apr 27 14:19:25 2017 +0100 @@ -46,6 +46,28 @@ AngularInterface.controller("view", ['$scope', '$element', '$window', function ($s, $e, $w) { $s.popupVisible = true; + $s.testSpecifications = {}; + + (function () { + new Promise(function (resolve, reject) { + var xml = new XMLHttpRequest(); + xml.open("GET", "test_create/interfaces/specifications.json"); + xml.onload = function () { + if (xml.status === 200) { + resolve(xml.responseText); + return; + } + reject(xml.status); + }; + xml.onerror = function () { + reject(new Error("Network Error")); + }; + xml.send(); + }).then(JSON.parse).then(function (data) { + $s.testSpecifications = data; + $s.$apply(); + }) + })(); $s.showPopup = function () { $s.popupVisible = true; @@ -97,7 +119,7 @@ $s.state--; }; $s.mouseover = function (name) { - var obj = $s.interfaces.find(function (i) { + var obj = $s.testSpecifications.interfaces.find(function (i) { return i.name == name; }); if (obj) { @@ -111,27 +133,8 @@ specification.interface = obj.interface; }; // Get the test interface specifications - $s.interfaces = {}; $s.file = undefined; $s.description = ""; - var interfaceCollection = new Promise(function (resolve, reject) { - var xml = new XMLHttpRequest(); - xml.open("GET", "test_create/interfaces/specifications.json"); - xml.onload = function () { - if (xml.status === 200) { - resolve(xml.responseText); - return; - } - reject(xml.status); - }; - xml.onerror = function () { - reject(new Error("Network Error")); - }; - xml.send(); - }).then(JSON.parse).then(function (data) { - $s.interfaces = data.interfaces; - $s.$apply(); - }); $s.handleFiles = function ($event) { $s.file = $event.currentTarget.files[0]; @@ -292,6 +295,15 @@ text: undefined }); }; + $s.clearScales = function () { + $s.interface.scales = []; + }; + $s.useScales = function (scales) { + $s.clearScales(); + scales.forEach(function (s) { + $s.interface.scales.push(s); + }); + }; }]); AngularInterface.controller("page", ['$scope', '$element', '$window', function ($s, $e, $w) { $s.addInterface = function () {