Highcharts Tutorial
Chart Types
To create an interval 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: 'columnrange' }, title: { text: 'Interval Column Chart' }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, yAxis: { title: { text: 'Temperature (��C)' } }, tooltip: { valueSuffix: '��C' }, plotOptions: { series: { borderWidth: 0, dataLabels: { enabled: true, format: '{point.low} - {point.high}��C' } } }, series: [{ name: 'Temperature', data: [ [-5.8, -0.9], [-3.3, 3.5], [-1.1, 8.4], [-0.6, 11.5], [-5.3, 3.9], [-6.5, 0.6], [-6.7, -1.8], [-6.9, -2.2], [-5.6, 0.8], [-4.5, 2.4], [-4.5, 2.8], [-4.7, 1.7] ] }] });
In this example, we're creating an interval column chart with the Highcharts chart
function and passing in a set of options:
chart.type
is set to 'columnrange'
to create a column range charttitle.text
is set to 'Interval Column Chart'
to set the main titlexAxis.categories
is set to an array of category labels for the x-axisyAxis.title
is set to set the label for the y-axistooltip.valueSuffix
is set to '��C'
to set the tooltip suffixplotOptions.series.dataLabels
is set to an object to enable data labels for each data point and format the label textseries
is set to an array of objects with a name
and data
property to define the series dataIn the series.data
option, we're specifying an array of arrays that define the low and high values for each column in the chart. The first value in each array specifies the low value, and the second value specifies the high value.
With these options, you can create an interval column chart with customizable data and appearance.
Customizing appearance in Highcharts Interval Column Chart: To customize the appearance of an Interval Column Chart in Highcharts, you can use various options like colors, borders, width, and more. Here's an example code snippet:
Highcharts.chart('container', { chart: { type: 'column' }, plotOptions: { column: { color: 'steelblue', borderWidth: 1, borderColor: 'white', borderRadius: 5 } }, series: [{ name: 'Data', data: [10, 15, 20, 25, 30] }] });
Adding data to Highcharts Interval Column Chart:
To add data to the Interval Column Chart, you can use the data
property within the series
object. Each data point represents the height of the column. Here's an example:
series: [{ name: 'Data', data: [10, 15, 20, 25, 30] }]
Stacked Interval Column Chart in Highcharts:
To create a stacked Interval Column Chart, you can set the stacking
property in the plot options. Here's an example:
plotOptions: { column: { stacking: 'normal' } }, series: [{ name: 'Category 1', data: [10, 15, 20] }, { name: 'Category 2', data: [5, 10, 15] }]
Grouped Interval Column Chart using Highcharts:
To create a grouped Interval Column Chart, you can leave out the stacking
property. Here's an example:
plotOptions: { column: { // No stacking property for grouped chart } }, series: [{ name: 'Category 1', data: [10, 15, 20] }, { name: 'Category 2', data: [5, 10, 15] }]
Interactive features in Highcharts Interval Column Chart: Highcharts supports interactive features like tooltips, click events, and legends. You can enable these features to enhance user interaction. Here's a snippet for tooltip configuration:
tooltip: { pointFormat: 'Value: {point.y}' }