Highcharts - Stepped lines
Trying to show better/worse measures where +1 = getting better, -1 = getting worse
by mark47
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 400px"></div>
<br /><br />
<div id="container" style="height: 400px"></div>
CSS
body {
font-family: Arial, Verdana, sans-serif;
}
JavaScript
$(function () {
$('#container').highcharts({
colors: ['rgba(100,100,255,0.8)', '#0066FF', '#00CCFF'],
title: {
text: 'Symptoms Over Time'
},
xAxis: {
categories: ['Start', '#1', '#2', '#3', '#4', '#5', '#6', '#7']
},
yAxis: {
min: -5,
max: 5,
title: {
enabled: false
},
labels: {
formatter: function () {
if (this.value == 2.5) {
return 'Getting Better';
} else if (this.value == -2.5) {
return 'Getting Worse'
}
}
}
},
series: [{
data: [0, 1, 2, 3, 3, 4, 3, 2],
step: 'center',
name: 'Pain'
}, {
data: [0, 0, -1, -1, -2, -3, -2, -1],
step: 'left',
name: 'Redness'
}, {
data: [0, 1, 2, 3, null, null, null, null],
step: 'left',
name: 'Warmth'
}],
plotOptions: {
series: {
lineWidth: 1,
marker: {
enabled: false
},
states: {
hover: {
lineWidthPlus: 3
}
}
}
}
});
});