You are on page 1of 2

// select query // Generate recodrset $.get('data.

csv', function(data) { // Use recordset instead of csv // Split the lines var lines = data.split('\n'); // Iterate over the lines and add categories or series $.each(lines, function(lineNo, line) { var items = line.split(','); // header line containes categories if (lineNo == 0) { $.each(items, function(itemNo, item) { if (itemNo > 0) options.xAxis.categories.push(item); }); } // the rest of the lines contain data with their name in the first posit ion else { var series = { data: [] }; $.each(items, function(itemNo, item) { if (itemNo == 0) { series.name = item; } else { series.data.push(parseFloat(item)); } }); options.series.push(series); } }); // Create the chart var chart = new Highcharts.Chart(options); }); var options = { chart: { renderTo: 'container', defaultSeriesType: 'column' }, title: { text: 'whatever' }, xAxis: { categories: [] }, yAxis: { title: { text: 'Units'

} }, series: [] };

You might also like