From 7e60b0393b5b9176ab7cd44db27536d64b3a7de3 Mon Sep 17 00:00:00 2001 From: finchiedev Date: Wed, 7 Nov 2018 16:06:16 +0800 Subject: [PATCH] Add chart.js compatibility --- App/JS/client.js | 13 +--------- App/charts.html | 57 ++++++++++++++++++++++++++++++++++++++++++++ App/controlTest.html | 3 --- App/index.html | 39 +++++++++++++++--------------- main.js | 2 +- package.json | 6 +++-- 6 files changed, 83 insertions(+), 37 deletions(-) create mode 100644 App/charts.html diff --git a/App/JS/client.js b/App/JS/client.js index 51cc2cb..8190ef3 100644 --- a/App/JS/client.js +++ b/App/JS/client.js @@ -15,18 +15,7 @@ function axisValue(dynamixel, axis) { if (val < 0 || val > 1024) { console.error("Controller value is out of bounds! (" + val + ")"); } - - // if (val <= 512) { - // val = (val - 512) * -2; - // } else { - // val = (val - 512) * -2; - // // val = -val; - // console.log(val, -val); - // } - // - // // if (dynamixel == 1 || dynamixel == 3) { - // // val = -val - // // } + val = (val - 512) * -2; if (dynamixel == 1 || dynamixel == 3) { val = -val; diff --git a/App/charts.html b/App/charts.html new file mode 100644 index 0000000..8f4b21f --- /dev/null +++ b/App/charts.html @@ -0,0 +1,57 @@ + + + + + Charts + + + + + +
+ + +
+ + diff --git a/App/controlTest.html b/App/controlTest.html index c2b1ee2..a612490 100644 --- a/App/controlTest.html +++ b/App/controlTest.html @@ -1,11 +1,8 @@ - - - test diff --git a/App/index.html b/App/index.html index 656d056..cc3effe 100644 --- a/App/index.html +++ b/App/index.html @@ -6,29 +6,30 @@ + diff --git a/main.js b/main.js index 8f989de..cb1447e 100644 --- a/main.js +++ b/main.js @@ -9,7 +9,7 @@ function createWindow() { width: 800, height: 600 }) - win.loadFile('App/control.html') + win.loadFile('App/charts.html') // win.loadURL('http://localhost:8080') win.webContents.openDevTools() diff --git a/package.json b/package.json index 2ead866..d98a9f8 100644 --- a/package.json +++ b/package.json @@ -10,11 +10,13 @@ "electron": "^3.0.4" }, "dependencies": { + "apexcharts": "^2.2.0", + "chart.js": "^2.7.3", + "express": "^3.21.2", + "mout": "^1.0.0", "npm": "^6.2.0", "python-shell": "^0.5.0", "shelljs": "^0.8.2", - "express": "^3.21.2", - "mout": "^1.0.0", "stream-split": "^1.1.0", "stream-throttle": "^0.1.3", "ws": "^0.8.0"