Highcharts Pie Chart with Legend
The following example demonstrates a pie chart with a legend.
We learned the basic Highcharts configuration syntax in the previous chapters. Now let's look at some other configurations.
Configure
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
Filename: highcharts_pie_legends.htm
Highcharts 教程 | Runoob Tutorial(runoob.com)
The output of the above example is:
Highcharts Pie Chart