Highcharts : adding a plotline on x-axis
by Chitkala More
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
$('#container').highcharts({
chart: {
type: 'areaspline'
},
title: {
text: 'CPM, IMPS, SPEND, etc'
},
legend: {
layout: 'vertical',
align: 'left',
verticalAlign: 'top',
x: 150,
y: 100,
floating: true,
borderWidth: 1,
backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
},
xAxis: {
categories: [
'Week 1',
'Week 2',
'Week 3',
'Week 4',
'Week 5',
'Week 6',
'Week 7',
'Week 8'],
plotLines: [{
color: '#FF0000',
width: 3,
value: 0.2
}]
},
yAxis: {
title: {
text: 'No title required'
},
plotLines: [{
color: '#FF0000',
width: 3,
value: 0.2
}]
},
tooltip: {
shared: true,
valueSuffix: ' units'
},
credits: {
enabled: false
},
plotOptions: {
areaspline: {
fillOpacity: 0.5
}
},
series: [{
name: 'CPM',
data: [6, 3, 4, 3, 5, 4, 10, 12]
}, {
name: 'IMPS',
data: [1, 1, 3, 4, 3, 3, 5, 4]
}]
});
});