Instead of continuing the battle against spammers, we decided to close the forum for new users and topics. But don't worry, there are still plenty of ways to reach us. Most notably, we will move our attention to Stack Overflow, where we will monitor questions under the tags [highcharts], [highstock] and [highslide].
For other ways of getting in touch with us, see Highcharts Support or Highslide Support.
Torstein Hønsi, CTO, 2013-01-29http://jsfiddle.net/Uufmn/
<script type='text/javascript'>
$(document).ready(function() {
function parseDate(dateStr) {
var matches = dateStr.match(/([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{4})/)
return Date.UTC(matches[3], matches[1] - 1, matches[2]);
}
$.get('data.csv', function visualise(csvData) {
var series = [],
lines = csvData.split('\n'),
rows;
$.each(lines, function(i, line) {
rows = line.split(',');
if (i === 0) {
for (i = 1; i < rows.length; i++) {
series.push({
name: rows[i],
data: []
});
}
return;
}
for (i = 1; i < rows.length; i++) {
series[i - 1].data.push([
parseDate(rows[0]),
parseInt(rows[i])
]);
}
});
console.log(series)
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
xAxis: {
type: 'datetime'
},
series: series
});
});
visualise(csv)
});
</script>
</head>
<body>
<div id="container" style="height: 500px; width: 600px;"></div>
</body>
Users browsing this forum: No registered users and 6 guests