Use csv as chart data

Description

The following code shows how to use csv as chart data.

Example


<!-- ww  w  . j a  v a2s . com-->
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>
$(function () {
    $('#container').highcharts({
        data: {
            csv: document.getElementById('csv').innerHTML,
        },
    });
});
</script>
</head>
<body>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/data.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="height: 400px"></div>
<pre id="csv" style="display:none">Year,Annual mean,5 year mean
2003,0.57,0.55
2004,0.9,1.56
2005,0.63,0.57
2006,0.56,0.54
2007,0.59,1.56
2008,0.44,0.56
2009,0.57,0.55
2010,0.64,0.54
2011,0.2,,0.94
2012,0.52,</pre>

</body>
</html>

Click to view the demo





















Home »
  highcharts »
    Chart Setup »




3D Chart
Chart
Chart Style
Data
Event
Export
Legend
Title
Tooltip
Tooltip Format