Highcharts Tutorial
Chart Types
To create a 3D pie chart using Highcharts, you can follow these steps:
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="chart-container"></div>
var data = [ { name: 'Apples', value: 5 }, { name: 'Oranges', value: 3 }, { name: 'Bananas', value: 2 }, { name: 'Pears', value: 7 } ];
Highcharts.chart('chart-container', { chart: { type: 'pie', options3d: { enabled: true, alpha: 45, beta: 0 } }, title: { text: 'Fruit Sales' }, plotOptions: { pie: { innerSize: '50%', depth: 45 } }, series: [{ name: 'Sales', data: data.map(item => [item.name, item.value]) }] });
#chart-container { width: 100%; height: 500px; max-width: 800px; margin: 0 auto; }
This will create a 3D pie chart with the specified data and options, and render it in the 'chart-container' element on your web page. You can customize the chart further by adjusting the options and adding additional features, like tooltips, legends, and labels.
Customizing Highcharts 3D Pie Chart appearance:
chart
object, such as options3d
for 3D effects.Highcharts.chart('container', { chart: { type: 'pie', options3d: { enabled: true, alpha: 45 } }, series: [{ type: 'pie', data: [5, 10, 15, 20] }], // Other configuration options... });
Adding data to Highcharts 3D Pie Chart:
data
property of the series.Highcharts.chart('container', { chart: { type: 'pie', options3d: { enabled: true, alpha: 45 } }, series: [{ type: 'pie', data: [{ name: 'Category 1', y: 5 }, { name: 'Category 2', y: 10 }, { name: 'Category 3', y: 15 }, { name: 'Category 4', y: 20 }] }], // Other configuration options... });
Nested 3D Pie Chart in Highcharts:
Highcharts.chart('container', { chart: { type: 'pie', options3d: { enabled: true, alpha: 45 } }, series: [{ type: 'pie', innerSize: '50%', data: [{ name: 'Category 1', y: 5 }, { name: 'Category 2', y: 10 }] }, { type: 'pie', data: [{ name: 'Category 3', y: 15 }, { name: 'Category 4', y: 20 }] }], // Other configuration options... });
Exploded 3D Pie Chart using Highcharts:
Highcharts.chart('container', { chart: { type: 'pie', options3d: { enabled: true, alpha: 45 } }, plotOptions: { pie: { innerSize: '50%', depth: 45 } }, series: [{ type: 'pie', data: [{ y: 5, sliced: true, selected: true }, { y: 10 }, { y: 15 }, { y: 20 }] }], // Other configuration options... });
Interactive features in Highcharts 3D Pie Chart:
Highcharts.chart('container', { chart: { type: 'pie', options3d: { enabled: true, alpha: 45 } }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '<b>{point.name}</b>: {point.y}' } } }, series: [{ type: 'pie', data: [{ name: 'Category 1', y: 5 }, { name: 'Category 2', y: 10 }, { name: 'Category 3', y: 15 }, { name: 'Category 4', y: 20 }] }], // Other configuration options... });