Highcharts Stock Demo
author(s): Torstein Hønsi
by Fusher
HTML
<div id="container" style="height: 400px; min-width: 600px"></div>
<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<script type="text/javascript" src="http://www.highcharts.com/samples/data/usdeur.js"></script>
JavaScript
$(function() {
var usdeurN = [];
$(usdeur).each(function(i,e){
usdeurN.push({
x: e[0],
y: e[1],
z: i /* index */
});
});
var chart = new Highcharts.StockChart({
chart: {
renderTo: 'container'
},
plotOptions: {
series: {
dataGrouping: {
enabled: true,
approximation : function(arr){
var ret = 0;
for(var i = 0; i < arr.length; i++) {
ret += arr[i];
}
console.log(arr,ret,this);
return ret;
}
}
}
},
rangeSelector: {
selected: 1
},
series: [{
name: 'USD to EUR',
turboThreshold: 3000,
data: usdeurN
}]
});
});