datalabel last value
by J. Albert Bowden
HTML
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="height:400px;margin:1.5em 1em;"></div>
JavaScript
var myData = new Array(7,12,16,32,64);
var len = myData.length -1;
var lastPoint = myData[len];
var chart = new Highcharts.Chart({
chart: {
renderTo:'container',
marginRight:50
},
title:{
text:'Chart Title'
},
credits:{enabled:false},
legend:{
},
plotOptions: {
series: {
shadow:false,
borderWidth:0,
dataLabels:{
align:'right',
x:25,
y:10,
}
}
},
xAxis:{
lineColor:'#999',
lineWidth:1,
tickColor:'#666',
tickLength:3,
title:{
text:'X Axis Title'
}
},
yAxis:[{
lineColor:'#999',
lineWidth:1,
tickColor:'#666',
tickWidth:1,
tickLength:3,
gridLineColor:'#ddd',
title:{
text:'Y Axis Title',
rotation:0,
margin:50,
}
},{
opposite:true,
linkedTo:0,
tickPositions:[lastPoint] ,
gridLineWidth:0
}],
series: [{
data: myData
}]
});