Rodrigo Araújo @rodrigo.rapptor.dev · Nov 29

Dear #SwiftUI #Swift devs, has anyone ran into this weird SwiftCharts legend bug? It's trying to align the items as columns, but seems to not be taking line 2 into consideration before positioning line 1. Here's the code to reproduce: gist.github.com/rodrigoarauj... Please share for visibility :)

4 likes 4 replies

?

Replies

Joshua Aaron · Nov 30

You have to make your own custom legend layout. Most of the default chart stuff makes charts worthless. The good news is you can really push it to do great things but it takes a lot of time and a lot of code.

Tyler W. · Nov 29

FWIW, Charts is great when it works. And terrible when this stuff starts to happen.

Will Frost · Nov 29

Yeah… I have got this issue as well in my app! I haven’t found a full proof way of fixing yet… #swiftlang #dev #iOSdev

Ryley · Nov 30

I had that issue as well, and ended up centering it to enforce a new layout on it. Not the best solution but it worked. .scaledToFit() .chartLegend(alignment: .center, spacing: 16)