Highcharts Tutorial
Chart Types
To create a fixed layout 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', spacing: [10, 10, 15, 10], height: 300 }, title: { text: 'Fixed Layout Column Chart' }, xAxis: { categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas'], tickLength: 0 }, yAxis: { title: { text: 'Fruit eaten' }, gridLineWidth: 0, labels: { enabled: false } }, series: [{ name: 'Jane', data: [3, 2, 1, 4, 5], color: '#FFA500' }, { name: 'John', data: [2, 3, 5, 7, 6], color: '#0066FF' }] });
In this example, we're creating a fixed layout 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.spacing
is set to an array of four values to adjust the spacing between the chart elementschart.height
is set to 300
to set the chart heighttitle.text
is set to 'Fixed Layout Column Chart'
to set the main titlexAxis.categories
is set to an array of category names to set the x-axis categoriesxAxis.tickLength
is set to 0
to hide the x-axis ticksyAxis.title.text
is set to 'Fruit eaten'
to set the y-axis titleyAxis.gridLineWidth
is set to 0
to hide the y-axis grid linesyAxis.labels.enabled
is set to false
to hide the y-axis labelsseries
is set to an array of objects with a name
, data
, and color
property to define the series data and colorsWith these options, you can create a fixed layout column chart that has a fixed height and spacing between the chart elements, with hidden x-axis ticks and y-axis grid lines and labels.
Customizing appearance in Highcharts Fixed Layout Column Chart:
Highcharts.chart('container', { chart: { type: 'column', width: 600, // Fixed width height: 400, // Fixed height }, title: { text: 'Customizing Appearance in Highcharts Fixed Layout Column Chart' }, series: [{ data: [10, 20, 30, 40, 50] }], // Additional configuration options... });
Adding data to Highcharts Fixed Layout Column Chart:
series: [{ name: 'Fixed Layout Column', data: [10, 20, 30, 40, 50] }],
Highcharts Fixed Layout Column Chart live demo:
<div id="container"></div> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/exporting.js"></script> <script src="https://code.highcharts.com/modules/export-data.js"></script> <script src="https://code.highcharts.com/modules/accessibility.js"></script> <script> // Highcharts Fixed Layout Column Chart configuration here... </script>
Highcharts Fixed Layout Column Chart configuration options:
chart: { type: 'column', width: 600, // Fixed width height: 400, // Fixed height }, title: { text: 'Fixed Layout Column Chart Configuration Options' }, series: [{ // Configuration options for the series }], // Additional configuration options...
Stacked Fixed Layout Column Chart in Highcharts:
plotOptions: { column: { stacking: 'normal' } },
Grouped Fixed Layout Column Chart using Highcharts:
plotOptions: { column: { grouping: false } },
Interactive features in Highcharts Fixed Layout Column Chart:
chart = Highcharts.chart('container', { series: [{ name: 'Fixed Layout Column', data: [10, 20, 30, 40, 50], events: { click: function (event) { alert('Clicked on column: ' + this.name); } } }] });