Currently having trouble getting data to display on a highchart.
I'm importing data from a CSV file, and plotting this data. The CSV file takes the format:
"Row1","Row2","Row3"
"1362567600","67882833572","63034526585"
"1362571200","67834631584","63250345463"
"1362574800","67886235392","63654664341"
"1362578400","67883347248","63683239219"
"1362582000","67884373456","63905665096"
There are 44 elements for each row within the CSV file.
I'm currently importing it in the following way:
$(document).ready(function() {
var c = [];
var d = [];
var e = [];
$.get('test.csv', function(data) {
var lines = data.split('\n');
$.each(lines, function(lineNo, line) {
var items = line.split(',');
c.push(items[0]);
d.push(items[1]);
e.push(items[2]);
});
createGraph('container', 'line', 'Graph 1', c[0],d[0],c);
});
});
The function createGraph takes the paramaters - divId(Specifying what div to display the graph in; graphType, graphTitle, line1, line2, and graphCategories.
I create an array - seriesData[] and use the following for loop to add data to it:
seriesData[0] = "[";
for (var i = 1; i < graphCategories.length - 1; i++){
seriesData[i] = "["+(graphCategories[i].replace(/["']{1}/gi,"")*1000)+","+876+"],";
}
seriesData.push("],");
When logging this array on the console it looks like this:
[,[1362567600000,876],,[1362571200000,876],,[1362574800000,876],,[1362578400000,876],,],
Then when plotting the graph I use:
series: [{
name: line1,
data: seriesData
}]
(There is another line, but for simplicity I'm just showing the one).
My question is, why is nothing displaying on the graph? I get the following output:
Thanks for your help.