The information provided is not arranged in a sorted manner and contains a date format that cannot be interpreted by Highstock. To utilize the data effectively, the date needs to be converted into a Date object, then transformed into a timestamp for Highstock usage while ensuring proper sorting.
// Converting data into an (unordered) array of timestamps and values
var newData = new Array();
for (var i = 0; i < rawData.length; i++) {
var row = rawData[i];
var date = new Date(row.date.substring(6, 10), parseInt(row.date.substring(0, 2)) - 1, row.date.substring(3, 5), row.date.substring(11, 13), 0, 0);
var data = [date.getTime(), parseFloat(row.price)];
newData.push(data);
}
// Sorting the data based on time. Credits to Ben Blank for the solution: http://stackoverflow.com/questions/5199901/how-to-sort-an-associative-array-by-its-values-in-javascript
var tuples = new Array();
for (var key in newData) {
tuples.push([key, newData[key]]);
}
tuples.sort(function(a, b) {
a = a[1];
b = b[1];
return a < b ? -1 : (a > b ? 1 : 0);
});
var orderedData = [];
for (var i = 0; i < tuples.length; i++) {
var key = tuples[i][0];
var value = tuples[i][1];
orderedData.push(value);
}
You can view your line chart here through this fiddle link.