I have a trouble with loading CSV to highcharts. I don't know what to do to get something like this: http://jsfiddle.net/3bQne/885/ (my code is based on: How do I select which columns from my CSV to chart with HighChart?). It is my sample CSV:
1,24,38
3,26,62
4,16,42
5,17,36
And this is code which should show me chart on webpage:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="width:100%; height:400px;"></div>
<script>
var options = {
chart: {
renderTo: 'container',
defaultSeriesType: 'line'
},
title: {
text: 'Temperatura'
},
xAxis: {
categories: []
},
yAxis: {
title: {
text: 'temperatura'
}
},
series: [{
data: []
}]
};
$.get('data.csv', function(data) {
var lines = data.split('\n');
$.each(lines, function (lineNo, line) {
var items = lines.split(',');
if(lineNo !== 0) {
var x = items[0];
temp = parseFloat(items[1]);
if(!isNaN(temp)){
options.series[0].data.push([x,temp]);
}
}
});
});
new Highcharts.Chart(options);
</script>
I have sit whole day trying to make chart which interests me and I have only this... Thank you for any help!