kurkle / chartjs-chart-sankey

Chart.js module for creating sankey diagrams
MIT License
152 stars 29 forks source link

x axis position of items #64

Closed seven700 closed 2 years ago

seven700 commented 2 years ago

Is it possible to specific the order of items along the x axis? For example having a node start further along the sankey diagram rather than at the far left, or having a node finish midway rather than at the far right?

For example. is it possible to force 'banana' to be in the same x axis position as fossil fuels and electricity?

image

kurkle commented 2 years ago

Was not possible, but also was easy to implement. So with 0.9.0 you'd add (to dataset):

column: {
  Banana: 1
}

Columns are integers starting from 0 at left and going in increments of one. There are quite a few limitations on how you can define the columns.. I guess it will be fine-tuned in the future.