walterwfrd
Posts: 2
Joined: Wed Sep 11, 2024 3:54 am

Area between to line series

Hi, I have the following two line series and want to know how to fill the area between the lines. I'm looking for something similar to what you show in the area range example (https://www.highcharts.com/demo/highcharts/arearange). From that example it seems like the both series share the same x values but in my sample data, even though the number of points are the same, the x values are different. How can I convert this data to an area range or is there a different approach to this?

series1 = [[0, 0], [1, 2], [2, 4], [3, 8], [4, 32]];
series2 = [[1, 0], [2, 2], [3, 3], [4, 15], [5, 32]];

Regards,

Walter
andrzej.b
Posts: 144
Joined: Mon Jul 15, 2024 12:34 pm

Re: Area between to line series

Hi Walter,

Welcome to our forum and thanks for contacting us with your question!

You basically got it right - you need to use an arearange series to get it done. The only step missing is to prepare data for it combining two arrays in a correct way.
I prepared a sample fiddle using the data you provided: https://jsfiddle.net/BlackLabel/byaes0cu/
You can further play with colors etc according to your needs.

I hope you will find it useful.

Best regards,
Andrzej
walterwfrd
Posts: 2
Joined: Wed Sep 11, 2024 3:54 am

Re: Area between to line series

Thank you for the quick reply, this is exactly what I was looking for.

Regards,

Walter

Return to “Highcharts Usage”