YouTip LogoYouTip

Highcharts Pie Legends

# Highcharts Pie Chart with Legends [![Image 3: Highcharts Pie Chart](#)Highcharts Pie Chart](#) The following example demonstrates a pie chart with legends. We have already learned the basic configuration syntax of Highcharts in previous chapters. Next, let's look at other configurations. * * * ## Configuration ### series Configuration Set the type property of series to pie. series.type describes the data series type. The default value is "line". var series = { type: 'pie'}; ### plotOptions plotOptions uses the plotOptions.pie.showInLegend property to set whether to display the legend. var plotOptions = { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: false }, showInLegend: true }}; ### Example File name: highcharts_pie_legends.htm
$(document).ready(function() { var chart = { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }; var title = { text: 'Browser market shares at a specific website, 2014' }; var tooltip = { pointFormat: '{series.name}: {point.percentage:.1f}%' }; var plotOptions = { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: false }, showInLegend: true } }; var series= [{ type: 'pie', name: 'Browser share', data: [ ['Firefox', 45.0], ['IE', 26.8], { name: 'Chrome', y: 12.8, sliced: true, selected: true }, ['Safari', 8.5], ['Opera', 6.2], ['Others', 0.7] ] }]; var json = {}; json.chart = chart; json.title = title; json.tooltip = tooltip; json.series = series; json.plotOptions = plotOptions; $('#container').highcharts(json); }); [Try it Β»](#) The output of the above example is: [![Image 4: Highcharts Pie Chart](#)Highcharts Pie Chart](#)
← Highcharts Column NegativeHighcharts Column Charts β†’