Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var graphJSON = function(jsonArray) {
- //create a plotly object
- var plotly = require('plotly')('aogarro3', 'sizkqcez0k');
- //parse the json
- var time = [];
- var sentiment = [];
- for (i = 0; i < jsonArray.length; i++) {
- time.push(jsonArray[i].time);
- sentiment.push(jsonArray[i].sentiment);
- }
- console.log(time);
- console.log(sentiment);
- //create graph data
- var data = [{x: time, y: sentiment, type: 'line'}];
- var layout = {fileopt : "overwrite", filename : "nn"};
- //generate online plot
- var link;
- plotly.plot(data, layout, function (err, msg) {
- //if (err) return console.log(err);
- var link = msg.url;
- });
- return link;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement