ppatliakevych
Posts: 5
Joined: Fri Oct 15, 2021 1:35 pm

Highstocks Datetime Column chart, hide empty series if there is no data

Hello everyone!

I`m trying to hide empty spaces between my columns in the chart. I`m using type: datetime, with ordinal: false. You can find my issue here- http://jsfiddle.net/8zLp6vnf/7/ . I`m trying to hide 17th and 18th series. Could you please advise me how to do it? P.S unfortunately, using breaks is not an option.
Thank you in advance.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Highstocks Datetime Column chart, hide empty series if there is no data

Hello ppatliakevych,

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

The thing is that in such cases you should set ordinal option value to true. Is there a reason why do you disable it?
Demo: http://jsfiddle.net/BlackLabel/8tcyaq9u/
API reference: https://api.highcharts.com/highstock/xAxis.ordinal

Best regards!
Mateusz Bernacik
Highcharts Developer
ppatliakevych
Posts: 5
Joined: Fri Oct 15, 2021 1:35 pm

Re: Highstocks Datetime Column chart, hide empty series if there is no data

Hi mateusz.b,

Thank you for the quick response! So I`m using datetime chart type with dataGrouping, and I need to all the series to correspond to the xAxis labels. The problem is: for weekends (and sometimes for other days) we do not have data. And using ordinal option leads to the situation when I have seria for one date but in the xAxis another. As you can see on demo you`ve provided http://jsfiddle.net/BlackLabel/8tcyaq9u/ we have data for 16th but in the xAxis 17th label is displayed. So I`m trying to figure out how to make each seria to correspond to its xAxis label without using breaks or categories chart type Thank you one more time.
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Highstocks Datetime Column chart, hide empty series if there is no data

Hello ppatliakevych,

I would suggest using two options: ordinal and tickPositioner. The second option would be used to render only X axis ticks that have corresponding point values. As a result chart have no empty spaces, X axis shows only existing point values and you can keep using dateTime axis.
Demo: http://jsfiddle.net/BlackLabel/246f5tha/

Let me know what do you think about this solution.
Best regards!
Mateusz Bernacik
Highcharts Developer
ppatliakevych
Posts: 5
Joined: Fri Oct 15, 2021 1:35 pm

Re: Highstocks Datetime Column chart, hide empty series if there is no data

Hi mateusz.b,

Thanks a lot for your help and solution, it works perfectly for almost all the cases! However, I have one case with navigator and big data range (example could be found here https://jsfiddle.net/he39nqgr/74/)/ Could you please help me to find solution for this case? Thank you!

Best regards,
ppatliakevych
ppatliakevych
Posts: 5
Joined: Fri Oct 15, 2021 1:35 pm

Re: Highstocks Datetime Column chart, hide empty series if there is no data

Hi mateusz.b,

I`m just wondering if you have any idea how to fix my issue? It would help me a lot. Thanks!

Best regards,
ppatliakevych
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Highstocks Datetime Column chart, hide empty series if there is no data

Hi ppatliakevych,

Sorry for slightly longer response time. I can see that there is a problem with too many rendered ticks and missing labels. I'll take a look into the problem and will provide you with solution ASAP.

Best regards!
Mateusz Bernacik
Highcharts Developer
ppatliakevych
Posts: 5
Joined: Fri Oct 15, 2021 1:35 pm

Re: Highstocks Datetime Column chart, hide empty series if there is no data

Hi mateusz.b,

I`m wondering if you had a chance to look into this problem? Thanks in advance.

Best regards,
ppatliakevych
mateusz.b
Posts: 2006
Joined: Tue Jul 13, 2021 11:34 am

Re: Highstocks Datetime Column chart, hide empty series if there is no data

Hello ppatliakevych,

Sorry for longer response time.

Could you please try this solution? https://jsfiddle.net/BlackLabel/xajdy2og/

Let me know what do you think.
Regards!
Mateusz Bernacik
Highcharts Developer

Return to “Highcharts Stock”