[Highcharts] set legend height
by Chitkala More
HTML
<script src="http://code.highcharts.com/3.0.6/highcharts.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
JavaScript
$(function () {
var chart;
$(document).ready(function () {
// Build the chart
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Browser market shares at a specific website, 2010'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
legend:{
align: 'right',
verticalAlign:'middle',
width: 200,
itemWidth: 100
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: false
},
showInLegend: true
}
},
series: [{
type: 'pie',
name: 'Browser share',
data: [
{name: 'Firefox1', y: 45.0, legendIndex: 1},
{name: 'IE2', y: 26.8, legendIndex: 3},
{name: 'Chrome3', y: 12.8, legendIndex: 5},
{name: 'Safari4', y: 8.5, legendIndex: 7},
{name: 'Opera5', y: 6.2, legendIndex: 9},
{name: 'Others6', y: 0.7, legendIndex: 11},
{name: 'Firefox7', y: 45.0, legendIndex: 13},
{name: 'IE8', y: 26.8, legendIndex: 2},
{name: 'Chrome9', y: 12.8, legendIndex: 4},
{name: 'Safari10', y: 8.5, legendIndex: 6},
{name: 'Opera11', y: 6.2, legendIndex: 8},
{name: 'Others12', y: 0.7, legendIndex: 10},
{name: 'Firefox13', y: 45.0, legendIndex: 12}
]
}]
});
});
});