highcharts-for-python / highcharts-core

Python wrapper for the Highcharts Core JavaScript library
https://www.highcharts.com/integrations/python
Other
58 stars 13 forks source link

`valueSuffix` in Sankey diagram tooltip not rendering properly #181

Open hcpchris opened 5 months ago

hcpchris commented 5 months ago

@hcpchris,

I noticed that in the corrected example, the valueSuffix is working for the point but not for the node.

I got it working using the following code:

            'nodeFormat': '{point.name}: {point.sum}{point.weight} not Working!!!',

{point.sum} return the correct value but without the correct suffix. {point.weight} return an empty value but with the correct suffix.

Put together it works, but I don't think it's the expected behavior.

Originally posted by @JulienBacquart in https://github.com/highcharts-for-python/highcharts-core/issues/148#issuecomment-2160106069

hcpchris commented 5 months ago

This issue is likely related to the serialization of format strings beginning with { and ending with } that was patched in commit https://github.com/highcharts-for-python/highcharts-core/pull/173/commits/5b7a39edb79d1496e58972c15a1ec0a0995e1dc6

hcpchris commented 5 months ago

@JulienBacquart: Turns out this issue is unrelated to the commit I mentioned earlier. Basically, the way that Highcharts (JS) works is that it appends the valueSuffix to the property that it interprets as the y value for the chart...which in the Sankey chart's case is the {point.weight} property. Which is why the workaround you found is working for you.

This seems a bit counterintuitive to me, however, so I've raised this question with the Highcharts (JS) team to see what they think about this. I'm not sure whether they will want to adjust this, but any adjustment to this will require a change on the Highcharts (JS) side. I'll leave this issue open here until I hear back from them and update it accordingly, but I'll remove the milestone I attached to it since it won't be resolved in Highcharts for Python v.1.8.2 after all.