Highcharts Tutorial
Chart Types
A stacked 3D column chart is a chart type that displays data in a three-dimensional format with each column divided into stacked segments representing different categories or data series. Highcharts supports stacked 3D column charts with the chart.type
option set to 'column'
and the chart.options3d.enabled
and plotOptions.column.stacking
options enabled.
To create a stacked 3D column chart using Highcharts, you can follow these steps:
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="chart-container"></div>
Highcharts.chart('chart-container', { chart: { type: 'column', options3d: { enabled: true, alpha: 15, beta: 15, depth: 50 } }, title: { text: 'Stacked 3D Column Chart' }, xAxis: { categories: ['Category 1', 'Category 2', 'Category 3', 'Category 4', 'Category 5'] }, yAxis: { title: { text: 'Y Axis Label' } }, plotOptions: { column: { stacking: 'normal', depth: 25 } }, series: [{ name: 'Series 1', data: [10, 20, 30, 40, 50], stack: 'Stack 1' }, { name: 'Series 2', data: [20, 30, 40, 50, 60], stack: 'Stack 1' }, { name: 'Series 3', data: [30, 40, 50, 60, 70], stack: 'Stack 2' }, { name: 'Series 4', data: [40, 50, 60, 70, 80], stack: 'Stack 2' }] });
In this example, we're creating a stacked 3D column chart with the Highcharts chart
function and passing in a set of options:
chart.type
is set to 'column'
to create a column chartchart.options3d.enabled
is set to true
to enable the 3D effectchart.options3d.alpha
, chart.options3d.beta
, and chart.options3d.depth
are used to control the angle and depth of the 3D effecttitle.text
is set to 'Stacked 3D Column Chart'
to set the main titlexAxis.categories
is set to an array of category labels for the x-axisyAxis.title
is used to set the label for the y-axisplotOptions.column.stacking
is set to 'normal'
to enable stacking of columnsplotOptions.column.depth
is used to control the depth of each stacked segmentseries
is set to an array of objects with a name
, data
, and stack
property to define the series data. The data
property contains an array of values for each category, which are displayed as stacked columns. Customizing appearance in Highcharts Stacked 3D Column Chart: To customize the appearance of a Stacked 3D Column Chart in Highcharts, you can use various options like colors, border styles, and more. Here's an example code snippet:
Highcharts.chart('container', { chart: { type: 'column', options3d: { enabled: true, alpha: 15, beta: 15, viewDistance: 25, depth: 50 } }, plotOptions: { column: { stacking: 'normal', depth: 25, borderColor: 'white', borderWidth: 2 } }, series: [{ name: 'Stack 1', data: [10, 20, 30, 40, 50] }, { name: 'Stack 2', data: [5, 10, 15, 20, 25] }] });
Adding data to Highcharts Stacked 3D Column Chart:
Adding data to a Stacked 3D Column Chart involves specifying the stacking
property. Use the data
property within the series
object. Here's an example:
series: [{ name: 'Stack 1', data: [10, 20, 30, 40, 50] }, { name: 'Stack 2', data: [5, 10, 15, 20, 25] }]
Grouped Stacked 3D Column Chart in Highcharts: To create a grouped Stacked 3D Column Chart, use multiple series within the same chart. Here's an example:
series: [{ name: 'Group 1', data: [10, 20, 30, 40, 50] }, { name: 'Group 2', data: [5, 10, 15, 20, 25] }]
Interactive features in Highcharts Stacked 3D Column Chart: Highcharts supports interactive features like tooltips, click events, and legends in Stacked 3D Column Charts. You can enable these features to enhance user interaction. Here's a snippet for tooltip configuration:
tooltip: { pointFormat: 'Value: {point.y}' }
3D Column Chart with multiple series using Highcharts:
To create a 3D Column Chart with multiple series, use the options3d
property and specify the depth
and groupZPadding
properties. Here's an example:
chart: { type: 'column', options3d: { enabled: true, alpha: 15, beta: 15, viewDistance: 25, depth: 50 } }, series: [{ name: 'Series 1', data: [10, 20, 30, 40, 50] }, { name: 'Series 2', data: [5, 10, 15, 20, 25], group: 'group2' // Assign a different group to create a grouped 3D column chart }]