Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wrap legend in flutter chart

Tags:

flutter

charts

I show a legend on top of a flutter chart with these options:

behaviors: [new charts.SeriesLegend(
  desiredMaxRows: 2,
  position: charts.BehaviorPosition.top,
  outsideJustification: charts.OutsideJustification.middle,
  horizontalFirst: true
),

The problem is that the legend does not wrap to a new row when it does not fit on the screen width. How can I make the legend to wrap into a new row?

Regards,

like image 689
Hyndrix Avatar asked Jul 09 '26 07:07

Hyndrix


1 Answers

Use desiredMaxColumns instead of desiredMaxRows, or set horizontalFirst: false

[desiredMaxColumns] the max columns to use before laying out items in a new row. By default there is no limit. The max columns created is the smaller of desiredMaxColumns and number of legend entries.

enter image description here

like image 171
Kherel Avatar answered Jul 14 '26 14:07

Kherel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!