Highcharts Tutorial
Chart Types
To create a curve area chart in 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: 'areaspline' }, title: { text: 'Curve Area Chart' }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] }, yAxis: { title: { text: 'Temperature (��C)' } }, series: [{ name: 'Tokyo', data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6], fillColor: { linearGradient: [0, 0, 0, 300], stops: [ [0, Highcharts.getOptions().colors[0]], [1, 'rgba(255,255,255,0)'] ] } }] });
In this example, we're creating an area spline chart with the Highcharts chart
function and passing in a set of options:
chart.type
is set to 'areaspline'
to create a curve area charttitle.text
is set to 'Curve Area Chart'
to set the main titlexAxis.categories
is set to an array of month names to set the x-axis labelsyAxis.title.text
is set to 'Temperature (��C)'
to set the y-axis labelseries
is set to an array with one object containing name
, data
, and fillColor
properties to set the chart data and styling optionsfillColor
is set to configure the color of the area under the curve, using a linear gradient with two stops: the first stop is set to the primary color of the chart, and the second stop is set to transparent white to create a fade-out effectNote that you can customize many other options to further customize your curve area chart, such as the line color, thickness, and style, the chart background color, and the legend position and styling. You can find more details and examples in the Highcharts documentation.
Customizing appearance in Highcharts Curve Area Chart:
Highcharts.chart('container', { chart: { type: 'areaspline', backgroundColor: '#f2f2f2', borderRadius: 10, borderWidth: 2, borderColor: '#999999' }, title: { text: 'Customizing Highcharts Curve Area Chart' }, xAxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'], title: { text: 'Months' } }, yAxis: { title: { text: 'Values' } }, series: [{ name: 'Series 1', data: [5, 10, 15, 20, 25], color: '#64b4dc', fillColor: { linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, stops: [ [0, '#64b4dc'], [1, Highcharts.Color('#64b4dc').setOpacity(0).get('rgba')] ] } }], // Additional configuration options... });
Adding data to Highcharts Curve Area Chart:
series: [{ name: 'Series 1', data: [5, 10, 15, 20, 25], color: '#64b4dc', fillColor: { linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, stops: [ [0, '#64b4dc'], [1, Highcharts.Color('#64b4dc').setOpacity(0).get('rgba')] ] } }, { name: 'Series 2', data: [15, 5, 20, 10, 25], color: '#ff9900', fillColor: { linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, stops: [ [0, '#ff9900'], [1, Highcharts.Color('#ff9900').setOpacity(0).get('rgba')] ] } }],
Highcharts Curve Area 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 Curve Area Chart configuration here... </script>
Highcharts Curve Area Chart configuration options:
chart: { type: 'areaspline', backgroundColor: '#f2f2f2', borderRadius: 10, borderWidth: 2, borderColor: '#999999' }, title: { text: 'Curve Area Chart Configuration Options' }, xAxis: { // Configuration options for X-axis }, yAxis: { // Configuration options for Y-axis }, series: [{ // Configuration options for the series }], // Additional configuration options...
Stacked Curve Area Chart in Highcharts:
plotOptions: { areaspline: { stacking: 'normal', fillOpacity: 0.5 } }, series: [{ name: 'Series 1', data: [5, 10, 15, 20, 25], color: '#64b4dc' }, { name: 'Series 2', data: [15, 5, 20, 10, 25], color: '#ff9900' }],
Grouped Curve Area Chart using Highcharts:
plotOptions: { areaspline: { stacking: null, fillOpacity: 0.5 } }, series: [{ name: 'Series 1', data: [5, 10, 15, 20, 25], color: '#64b4dc' }, { name: 'Series 2', data: [15, 5, 20, 10, 25], color: '#ff9900' }],
Interactive features in Highcharts Curve Area Chart:
series: [{ name: 'Series 1', data: [5, 10, 15, 20, 25], color: '#64b4dc', events: { click: function (event) { alert('Clicked on ' + this.name + ' at ' + event.x + ', ' + event.y); } } }],