Order by name on Sanki map

Is it possible to sort by name using sankey? For instance:

Example: https://jsfiddle.net/Khrys/1s3shf2m/

google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('string', 'From'); data.addColumn('string', 'To'); data.addColumn('number', 'Weight'); data.addRows([ [ 'A', 'Mango', 5 ], [ 'A', 'Mango', 7 ], [ 'A', 'Apple', 6 ], [ 'B', 'Coconut', 2 ], [ 'B', 'Mango', 9 ], [ 'B', 'Pineapple', 4 ] ]); // Sets chart options. var options = { width: 600, }; // Instantiates and draws our chart, passing in some options. var chart = new google.visualization.Sankey(document.getElementById('sankey_basic')); chart.draw(data, options); } 

I expect the right side output to be (top to bottom): Apple, Coconut, Mango, Pineapple

thanks

+5
source share
2 answers

Set iterations to 0, and the chart should draw in accordance with the data entry order.

Example:

 var options = { height: 400, width: 400, sankey: { iterations: 0, } 

Hello

+9
source

As Daniel from Google herself answered at https://groups.google.com/forum/#!topic/google-visualization-api/Tsyj8ZQ8IMU

Sorry, we do not have enough control over the generated order of the output nodes.

0
source

Source: https://habr.com/ru/post/1239361/


All Articles