Veoth
Posts: 2
Joined: Fri Apr 09, 2021 8:34 am

[BUG] Chart update from category to datetime xAxis type

Hello,

I've encountered a bug when updating a chart.

The initial chart is a line chart with 2 series & a set a predifined categories. xAxis type is set to 'category'.
Then I update the chart, setting the xAxis type to 'datetime', fillings series data with a x value (timestamp) to get a timeline chart

Here is a stackblitz: The xAxis is not showing proper formatted ticks
https://stackblitz.com/edit/highcharts- ... e=index.js

Regards
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: [BUG] Chart update from category to datetime xAxis type

Hello Veoth!

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

When updating chart's elements with new options, old options are not removed, so in this case categories array is still there and is causing chart to act strange. Set categories (axis option) to false on chart update and axis type will be changed.

Demo: https://stackblitz.com/edit/highcharts- ... e=index.js

Best regards!
Dominik Chudy
Highcharts Developer
Veoth
Posts: 2
Joined: Fri Apr 09, 2021 8:34 am

Re: [BUG] Chart update from category to datetime xAxis type

Hello Dominik,

Thanks for the quick answer I appreciate !

The things is that i'm building a chart using angualr alongside with typescript, and the provided type for XAxisOptions does not allow categories to be set to false.
It can be either an array of string or undefined.

Any ideas ?

Thanks, have a good day !
dominik.c
Posts: 2081
Joined: Fri Aug 07, 2020 7:07 am

Re: [BUG] Chart update from category to datetime xAxis type

Hi again!

That's strange. Are you sure that it's not possible?

You can try to delete the whole chart and create it one more time with datetime axis instead of categories one. Probably there are no other ways to do that.

Best regards!
Dominik Chudy
Highcharts Developer

Return to “Highcharts Usage”