highcharts / highcharts

Highcharts JS, the JavaScript charting framework
https://www.highcharts.com
Other
11.86k stars 3.52k forks source link

Using of onPoint.z for 'Map with overlaid pie charts' demo #21159

Open hubaksis opened 2 weeks ago

hubaksis commented 2 weeks ago

This example "Map with overlaid pie charts" https://www.highcharts.com/demo/maps/map-pies uses onPoint.z property to set the size. However, returning any number from this function (like 10, 50, 200) does not change the pie chart size. See here: https://jsfiddle.net/Guest538/tyvwbs0r/1/ lines 240-243. Moreover, there is no mention of z property in the api docs here: https://api.highcharts.com/highmaps/series.map.onPoint

Possible workaround

Use size property. See https://jsfiddle.net/Guest538/vq0sgahw/1/ line 244

Expected behaviour

Not sure what was the plan.

If onPoint.z property is supposed to be used, then it should work correctly and it should be mentioned in the docs. If onPoint.z property is not supposed to be used, then demo of "Map with overlaid pie charts" should not use it.

Actual behaviour

Live demo with steps to reproduce

See here: https://jsfiddle.net/Guest538/tyvwbs0r/1/ lines 240-243.

Product version

11.4.1

Affected browser(s)

Chrome 124.0.6367.201

hubertkozik commented 2 weeks ago

Hi @hubaksis!

The option onPoint.z is working correctly, you can check it here: https://jsfiddle.net/BlackLabel/7bzg8tmh/ I am returning random values 10, 20, 30, or 40 and you can see, that the dimensions of pies are different. You're right, it's not documented and it should be here: https://api.highcharts.com/highmaps/series.map.onPoint

The option size works, because you are using pie series: https://api.highcharts.com/highcharts/series.pie.size This is correct behaviour, because you can use properties from pie series in series on point pie.

Internal note: We should add onPoint.z to the API docs.

hubaksis commented 2 weeks ago

Hi @hubertkozik,

What's the meaning of onPoint.z than? If I return a constant value instead of your random value, then despite the value the size of the pie chart is the same. See https://jsfiddle.net/Guest538/1e9Lpw3q/ and https://jsfiddle.net/Guest538/1e9Lpw3q/1/

hubertkozik commented 2 weeks ago

The onPoint.z is similar to bubble.data.z value: https://api.highcharts.com/highcharts/series.bubble.data.z

hubaksis commented 2 weeks ago

Thanks, now it makes sense.

By trial and error I also figured out that onPoint has properties minSize and maxSize, which are used by z when calculating the size of the chart. Example is here: https://jsfiddle.net/Guest538/wh9peozn/

While the documentation is being updated - can you please tell me if there is a way to make the pie chart grow when the map is zoomed in? Maybe it's also not in the docs yet :)

Thanks!

hubertkozik commented 2 weeks ago

@hubaksis about minSize and maxSize there is another GH ticket: https://github.com/highcharts/highcharts/issues/19702 You're right, those options are working and should be documented also.

When it comes to making the pie chart grow when the map is zoomed in, I would classify it as a new Feature Request. It's not implemented right now into series-on-point module. If you would like to, you can create a Feature Request as a new GitHub ticket.