wow, thank u guys for your effort :)
personally for me this project is not that easy, because i need to learn and understand several languages at the same time. So pls be patient ^^
While u posted here i was able to create a JSON file from the mysql database. But the results were looking like this:
[{"Datum":"2018-02-03T23:00:00.000Z","Volumen":2488},{"Datum":"2018-02-03T23:00:00.000Z","Volumen":2488},]
thats probably because the columns in the database are defined as “date” (not datetime) and “decimal”
I think i would get this right and could load this into the MMM-Chart.
But now u guys posted several solutions. The easiest would be to create a CSV and log this directly with the MMM-Chart @ninjabreadman said.
To create the CSV is no problem for me, but how changing the MMM-Chart… i need to pass a.t.m. ^^
Actually i’m not sure how node.js and npm works so i need to read and try a little bit more to understand it better :)
@doubleT
How exactly would highcharts work together with the MM? Is it just like a web page or what? :D
How to start it, where to put the files, and how to implement to MM?
For me it looks nearly like an own module for the MM.
Sorry for the much questions, but i am trying not just to use a finished solution. I want to nearly understand that whole stuff XD
Thank you guys, u are great
edit:
So i changed the columns definition from “date” to “text”.
Now my with the javascript using node i can get a JSON file looks correct:
[{"Datum":"2018-02-04","Volumen":2490},{"Datum":"2018-02-04","Volumen":2488},]
but i am using a very very simple script i think and i am just able to execute it manually by typing in terminal “node script.js”
also i don’t know in what direction this has to be saved.
var mysql = require('mysql');
var fs = require('fs');
var connection = mysql.createConnection({
host: 'xxx.xxx.xxx.xxx',
port: '3307',
user: '...',
password: '...',
database: 'Tank'
});
connection.connect();
connection.query('SELECT * from Volumen', function(err, results, fields) {
if(err) throw err;
fs.writeFile('results.json', JSON.stringify(results), function (err) {
if (err) throw err;
console.log('Saved!');
});
});
connection.end();