I want to make a simple graph. Here is the code in node.js from plotly official documentation.
equire('plotly')(username, api_key);
var data = [
{
x: ["2013-10-04 22:23:00", "2013-11-04 22:23:00", "2013-12-04 22:23:00"],
y: [1, 3, 6],
type: "scatter"
}
];
var graphOptions = {filename: "date-axes", fileopt: "overwrite"};
plotly.plot(data, graphOptions, function (err, msg) {
console.log(msg);
});
Here, i want to pass an array in x axis.The line is given below where i want to change.
x: ["2013-10-04 22:23:00", "2013-11-04 22:23:00", "2013-12-04 22:23:00"],
I have tried this way.
xx = [];
for (i = 1; i < 100; i++) {
xx[i] = i;
}
var data = [
{
x: xx,
y: [1, 3, 6],
type: "scatter"
}
];
var graphOptions = {filename: "date-axes", fileopt: "overwrite"};
plotly.plot(data, graphOptions, function (err, msg) {
console.log(msg);
});
But code is not working given above.Please can anyone suggest me how to solve this ? Thanks in advance.
