sgloss
Posts: 4
Joined: Thu Jun 30, 2022 2:24 pm

Making multiple lines that use different X values on one graph

Image
I'm not sure if this was a great explanation in my title of what I want to do but hopefully the picture makes it clear. I'm making a curl command currently that I'm putting into postman to post it onto the highcharts export server to make a chart but I'm struggling to figure out how to make lines that don't exclusively start from the first x value and then continue. I was hoping for some guidance as to how to do this (or if it is not possible). Thanks so much.
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Making multiple lines that use different X values on one graph

Hi there,

Welcome to our forum and thank you for contacting us with your question!
Unfortunately, your image does not load but I think I know what you want to achieve.

To get the desired outcome, you need to provide the specific x values in your data array. (the default one-level array is just built of y values, and x values are array indexes).

You can do that in two ways:
Structure your data like this: [ [x,y], [x,y], [x,y]...) ]
Or like this [ {x: value, y: value}, {x: value, y: value} ]
As a bonus way, if you don't want to provide x values, simply use null at the x values correspoding to array index: [null, y value, y value, null, y value].

Take a look at the demo with the examples on the chart.
DEMO: https://jsfiddle.net/BlackLabel/2zkcopg9/

Let me know if that's what you were looking for,
Regards!
Kamil Musiałowski
Highcharts Developer
sgloss
Posts: 4
Joined: Thu Jun 30, 2022 2:24 pm

Re: Making multiple lines that use different X values on one graph

Thanks for the fast response! You figured it out even from my terrible explanation. I really appreciate that. Fixed my problem. Thanks so much.
kamil.m
Posts: 892
Joined: Thu May 19, 2022 1:33 pm

Re: Making multiple lines that use different X values on one graph

Your explanation was absolutely fine! I'm glad that you found the solution useful.

Do not hesitate to contact us with any further questions,
Have a good day
Kamil Musiałowski
Highcharts Developer

Return to “Highcharts Usage”