mreifman
Posts: 4
Joined: Thu Sep 28, 2023 1:23 pm

Chart instance missing properties

Thu Sep 28, 2023 1:37 pm

I am trying to debug an issue with a React component that refers to a chart instance. During one of the React update cycles the chart instance is missing various properties, notably `options`, which causes the `update()` function to throw an error. I'm still working on a clean, reproducible sample, but after a number of false starts though I'd offer up what I'm seeing in case someone can offer any clues.

The error I'm seeing is when `setResponsive` tries to reference `this.options`, which is undefined: https://github.com/highcharts/highchart ... ve.ts#L199

Right before the error gets thrown the chart object, i.e. `this`, has the following own properties:

Code: Select all

a11yDirty: true
extraBottomMargin: false
extraTopMargin: false
This is after previous update cycles where the chart object looked like this:

Code: Select all

a11yDirty: true
accessibility: y {chart: g, components: {…}, keyboardNavigation: f, proxyProvider: h}
angular: undefined
announcerContainer: div.highcharts-announcer-container
axes: (2) [z, z]
axisOffset: (4) [0, 0, 25, 35.0625]
bounds: {h: {…}, v: {…}}
callback: undefined
...etc
Any ideas as to what could cause the chart object to change like that?

kamil.k
Posts: 410
Joined: Thu Oct 06, 2022 12:49 pm

Re: Chart instance missing properties

Mon Oct 02, 2023 6:53 am

Hello mreifman,

Welcome to our forum and thanks for sharing your issue!

I think we potentially face an error here but considering your state changes, it's hard for me to reproduce it and point you in the right direction. The this.options property you mentioned is actually all the data you pass to the chart's config, so I think it can be lost during the updates or overwritten by certain conditions due to the config. Also, I think it shouldn't be related to React, but directly to the Core code.

It would be much more helpful if you could provide any reproduction steps along with your chart's config and Highcharts version so I could debug it.

Also, if after your investigation you consider it a bug, you can freely report the case with the whole description on our official GH profile: https://github.com/highcharts/highchart ... new/choose. Please note that I'm a bit unable to do it now without any details, configs, reproduction, etc. but in the end, we forward all the actual issues there.

Looking forward to your response,
Kind Regards!
Kamil Kubik
Highcharts Developer

Return to “Highcharts Stock”