Highcharts Stacked Area
by Yonathan Benitah
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 300px"></div>
JavaScript
var serie_A = [];
var serie_B = [];
for(var i = 0 ; i < 10; i++){
serie_A.push({
x: i,
y: Math.random()
})
}
for(var i = 0 ; i < 10; i++){
serie_B.push({
x: i,
y: Math.random()
})
}
/* serie_B.splice(5, 1); */
serie_A.splice(5, 1, {x: 5, y: 0})
serie_A.splice(6, 1, {x: 6, y: 0})
serie_A.splice(7, 1, {x: 7,y: 0})
serie_A.splice(8, 1, {x: 8, y: 0})
/* serie_B.splice(8, 1) */
console.log(serie_B);
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
type: 'area'
},
xAxis: {
type: 'datetime',
minTickInterval: 3600*24
},
plotOptions: {
area: {
stacking: 'overlap'
}
},
series: [{
name: 'International',
data: serie_A
},{
name: 'Domestic',
data: serie_B
}]
});