HighCharts
Showing off various HighCharts options for multi and non-uniform axes.
by subskybox
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: 400px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
$('#container').highcharts({
chart: {
renderTo: 'container'
},
credits : {
enabled : true,
text: 'Fake Data'
},
plotOptions: {
line: {
dataLabels: {
enabled:true,
color: '#000000',
formatter: function() {
for (var i = 0, len = this.series.data.length; i < len; i++) {
if (this.series.data[i].x === this.point.x && i == Math.floor(len/2)) {
return this.series.name;
}
}
return "";
}
}
}
},
title: {
text: 'LOFT'
},
yAxis: [{ // Primary yAxis
labels: {
formatter: function() {
return this.value +' Kg.';
},
style: {
color: '#89A54E'
}
},
title: {
text: 'Weight',
style: {
color: '#89A54E'
}
},
opposite: true
}, { // Secondary yAxis
gridLineWidth: 0,
title: {
text: 'Altitude',
style: {
color: '#4572A7'
}
},
labels: {
formatter: function() {
return this.value +' ft.';
},
style: {
color: '#4572A7'
}
}
}],
subtitle: {
text: 'Planned Flight Profile & Fuel Consumption'
},
xAxis: [{
type: 'datetime',
},{
...