I tried with Xcode 16.0ß and Xcode 15.3, on iOS 17.4 and 18.0 simulators and got a correct result. It is not wrapped but correctly positioned and sized.
So I extended your text further more and got a correct result again:
And even more, to exceed width limit:
ChartData(id: 2, title: "Item 2 With a Long Title and then some more and even some more for a crazy legend length", count: 6, color: .blue),
Then it did not work.
I used a different modifier to build the legend manually:
.chartLegend(alignment: .leading, content: {
HStack(alignment: .top, spacing: 5) {
ForEach(data) { d in
HStack {
Text("•")
.font(.system(size: 48))
.bold()
.foregroundStyle(d.color)
Text("\(d.title)")
.font(.system(size: 14))
.lineLimit(nil) // Multilines
.foregroundStyle(Color.gray)
}
.frame(width: 125, height: 120)
}
}
})
You can adapt content to better fit your need.