Highcharts Stock Demo
author(s):
Torstein Hønsi
by Yonathan Benitah
HTML
<div id="container" style="height: 400px; min-width: 600px"></div>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<script type="text/javascript" src="https://www.highcharts.com/samples/data/three-series-1000-points.js"></script>
JavaScript
Highcharts.stockChart('container', {
chart: {
width: 800
},
rangeSelector: {
selected: 4
},
plotOptions: {
series: {
dataGrouping: {
groupPixelWidth: 15,
//forced: true,
units: [
[
'day',
[1]
], [
'week',
[1]
], [
'month',
[1]
]
]
}
}
},
series: [
/* {
name: 'ADBE',
data: ADBE,
dataGrouping: {
type: 'areaspline'
},
tooltip: {
valueDecimals: 2
}
}, */
{
name: 'Data point count (confidence)',
data: ADBE,
dataGrouping: {
approximation: 'average',
/* approximation: function () {
var start = this.cropStart + this.dataGroupInfo.start;
console.log(
'dataGroupInfo:',
this.dataGroupInfo,
'Raw data:',
this.options.data.slice(
start,
start + this.dataGroupInfo.length
)
);
// Individual point options can be applied to the grouped points
if (this.dataGroupInfo.length < 5) {
this.dataGroupInfo.options = {
color: '#FF0000'
};
}
// We want the number of points to represent the value
return this.dataGroupInfo.length;
}, */
forced: true
},
type: 'areaspline'
}]
});