I’m attempting to plot some OCHL data from a CSV in the same directory as my JavaScript file. I am following the example: https://plot.ly/javascript/ohlc-charts/#ohlc-chart-without-rangeslider
While I have gotten it to work with the example data, using my own has caused the plotly widget to not render any bar data:
This is what my JavaScript code looks like:
Plotly.d3.csv('EURUSD.csv',
function(err, rows){
console.log(err);
function unpack(rows, key) {
return rows.map(function(row) {
return row[key];
});
}
var x_time = [];
for (var i = 0; i < rows.length; i++) {
row = rows[i];
x_time.push( row['Local Time'] );
}
var trace = {
x: unpack(rows, 'Local Time'),
close: unpack(rows, 'Close'),
high: unpack(rows, 'High'),
low: unpack(rows, 'Low'),
open: unpack(rows, 'Open'),
// cutomise colors
increasing: {line: {color: 'black'}},
decreasing: {line: {color: 'red'}},
type: 'ohlc',
xaxis: 'x',
yaxis: 'y'
};
console.log(trace);
var data = [trace];
var layout = {
dragmode: 'zoom',
showlegend: false,
xaxis: {
autorange: true,
title: 'Date'
},
yaxis: {
autorange: true,
}
};
Plotly.plot('myDiv', data, layout);
});
And this is a sample of my CSV file.
Can someone help me debug this problem?