0

Wanted to revese the rendering of Highcharts Sankey Diagram from left-to-right to right-to-left. according to Highcharts forum, it was suggested to switch the keys value from:

 series: [{
        keys: ['from', 'to', 'weight'],
        data: ... 
        }]

to:

 series: [{
        keys: ['to', 'from', 'weight'],
        data: ...
        }]

Output:

before: Before:

After: After:

Code:

Left-to-right diagram (rendering Fine!): LINK

right-to-left diagram (Not rendering properly): LINK


Referring the abv. image, once the keys are switched the diagram is not rendering properly. Ideally, wanted to render diagrams in both left-to-right and right-to-left directions.

Vishnu Baliga
  • 413
  • 6
  • 13
  • It seems the diagram is rendering (in jsfiddle). Do you mean the result is not what you expect? – vyi Dec 19 '22 at 09:46
  • I see the same image after rendering right to left as you show in the picture only one time after first refresh (It could be a bug with a refresh, I will try to fix it), after to second refresh looks are you expected? – Sebastian Hajdus Dec 19 '22 at 10:12
  • Sorry, I had linked the wrong URL (have updated it in the question) or you can check this fiddle link: https://jsfiddle.net/Baliga/6t14qrj0/7/ – Vishnu Baliga Dec 19 '22 at 10:52
  • I recreated and changed `series.keys` in the official demo and can't see the behavior from your case, could you check this [example](https://jsfiddle.net/BlackLabel/ahLdre0m/)? – Sebastian Hajdus Dec 20 '22 at 07:16
  • @SebastianHajdus you should be able to replicate the issue when u reduce the data, if you can remove some of the nodes, the diagram starts to fail. can you check this? https://jsfiddle.net/Baliga/6t14qrj0/7/ – Vishnu Baliga Dec 21 '22 at 13:40
  • It looks like the miss of data caused the problem, I have tried different data and it looks good, like here [demo](https://jsfiddle.net/BlackLabel/6p9t15yr/). – Sebastian Hajdus Dec 21 '22 at 17:11
  • @SebastianHajdus can you try the same with multi steps/levels? (currently in the demo it is single level) – Vishnu Baliga Dec 22 '22 at 05:58
  • You can still option to configure your Sankey chart, [example](https://jsfiddle.net/BlackLabel/6p9t15yr/1/), based on this [article](https://www.highcharts.com/blog/tutorials/what-is-a-sankey-diagram/) and [docs](https://api.highcharts.com/highcharts/series.sankey.nodes). – Sebastian Hajdus Dec 22 '22 at 08:32
  • @SebastianHajdus the example fails when you switch the keys, you can view it here: https://jsfiddle.net/Baliga/oLjvm6wd/ – Vishnu Baliga Dec 22 '22 at 19:06
  • When you switch keys try turning off the offset, you need to adjust the chart so, I think you can submit this as a feature request on GH, for smooth changing direction from keys it will be a cool idea. – Sebastian Hajdus Dec 30 '22 at 22:23

0 Answers0