I am hoping to use plot.ly to graph multiple time series lines.
I am using the following code:
var trace1 = [
{
x: ['2013-10-04 22:23:00', '2013-11-04 22:23:00', '2013-12-04 22:23:00'],
y: [1, 3, 6],mode: 'lines',
type: 'scatter'
}
];
var trace2 = [
{
x: ['2013-10-04 22:23:00', '2013-11-04 22:23:00', '2013-12-04 22:23:00'],
y: [1, 2, 4],mode: 'lines',
type: 'scatter'
}
];
var data = [trace1, trace2];
Plotly.newPlot('myDiv', data);
But nothing appears. Does anyone know if it is possible to make them with Plotly.js?
plotly traces need to be objects not arrays. This should work:
var trace1 = {
x: ['2013-10-04 22:23:00', '2013-11-04 22:23:00', '2013-12-04 22:23:00'],
y: [1, 3, 6],mode: 'lines',
type: 'scatter'
};
var trace2 = {
x: ['2013-10-04 22:23:00', '2013-11-04 22:23:00', '2013-12-04 22:23:00'],
y: [1, 2, 4],mode: 'lines',
type: 'scatter'
};
var data = [trace1, trace2];
Plotly.newPlot('myDiv', data);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With