Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling setData on Map Series throws an error with pattern-fill.js #19323

Closed
SyedTayyab99 opened this issue Jul 7, 2023 · 9 comments · Fixed by #19477
Closed

Calling setData on Map Series throws an error with pattern-fill.js #19323

SyedTayyab99 opened this issue Jul 7, 2023 · 9 comments · Fixed by #19477

Comments

@SyedTayyab99
Copy link

Expected behaviour

When series[0].setData() function is called, it should update the data of the series.

Actual behaviour

The call throws the following error

Uncaught TypeError: Cannot read properties of undefined (reading 'chart')
at r.calculatePatternDimensions (pattern-fill.src.js:169:36)
at R. (pattern-fill.src.js:417:21)
at highmaps.src.js:1748:25
at Array.forEach ()
at e (highmaps.src.js:1745:17)
at H.complexColor (highmaps.src.js:9664:17)
at H.fillSetter (highmaps.src.js:9993:21)
at H. (highmaps.src.js:9586:29)
at C (highmaps.src.js:1413:21)
at H.attr (highmaps.src.js:9564:21)

Steps to reproduce

I am attaching the files being used. On line 577, there is a call to "hchart.series[0].setData(data)" which results in error.
live-data.zip

Product version

Latest Versions

Affected browser(s)

All browsers

@highsoft-bot highsoft-bot added this to To do in Development-Flow via automation Jul 7, 2023
@karolkolodziej
Copy link
Contributor

Hi @SyedTayyab99!

I'm unable to recreate that locally. Will you be able to prepare a minimal demo in some online code editor?

@SyedTayyab99
Copy link
Author

Hi @karolkolodziej Thanks a lot for your response. Let me try that

@karolkolodziej
Copy link
Contributor

There is a lot of custom code in your example shared initially. It would be great if you can reduce it ;)

@SyedTayyab99
Copy link
Author

@karolkolodziej Please check the following fiddle. Once you click on the "Reload Data" button, you'll be able to see the issue.

https://jsfiddle.net/SyedTayyab/an4ocdsp/

Please feel free to let me know if you need anything else from my side.

@karolkolodziej
Copy link
Contributor

Thank you @SyedTayyab99 for the demo.

Internal note:
I managed to simplify it even more.
@KacperMadej @hubertkozik Could you please take a look? It seems like this line might be the issue:

// If we don't have a width/height yet, handle it. Try faking a point
// and running the algorithm again.
if (pattern._width === 'defer' || pattern._height === 'defer') {
Point.prototype.calculatePatternDimensions.call(
{ graphic: { element: element } }, pattern
);
}

@SyedTayyab99
Copy link
Author

Hi @karolkolodziej please let me know if there is a work around or a patch that I can use in the meantime?

@mabuhaddah
Copy link

mabuhaddah commented Jul 24, 2023

Dear @karolkolodziej , Hope this message finds you well.
Your kind support is highly appreciated.
Please we need any hotfix for that issue urgently.

Thanks

@mabuhaddah
Copy link

@karolkolodziej your quick action and feedback are highly appreciated!

@hubertkozik
Copy link
Member

hubertkozik commented Jul 27, 2023

Hello guys!

I have prepared a workaround for that issue by overwriting drawPoints method for MapSeries. It is inside the IIFE function in the below demo. If you want to use it, just copy-paste it into your project and everything should work as intended. A similar solution will be used in the Highcharts Maps code.

Live demo: https://jsfiddle.net/BlackLabel/w8z3fv4k/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

5 participants