TechQ
TechQ

Reputation: 31

Sorting Sankey chart's source & destination nodes alphabetically

I am creating Sankey chart using Highcharts where I want to sort my source and destination labels alphabetically. In this image you can see labels are randomly assigned as per data values. I want to sort those labels for both source and destination. So in second column I want to see nodes in below order,

England -> France -> Portugal -> Spain

How can sort all nodes to get such result ?

Thank you! enter image description here

Upvotes: 0

Views: 1068

Answers (1)

Sebastian Hajdus
Sebastian Hajdus

Reputation: 1560

There is no special option for sorting by name in a sankey type diagram, the data visualization is based on the flow composition algorithm.

You can easily post-sort by rearranging the data in the correct order according to the keys.to.

data: [
  ['Canada', 'England', 1],
  ['Canada', 'France', 5],
  ['Canada', 'Portugal', 1],
  ['Brazil', 'Portugal', 5],
  ['Brazil', 'France', 1],
  ['Brazil', 'Spain', 1],
  ['Brazil', 'England', 1],
],

https://jsfiddle.net/BlackLabel/f5L3ajy8/2/

Upvotes: 1

Related Questions