There is an awkward gap on the trailing end of the chart. I want the bar to fill up the entire width so that there are no empty spaces. I tried playing around with the width field but I can't figure it out or know if its even possible. Thank you.
struct ViewStatus {
var views: Double
var status: String
}
struct ViewsChartView: View {
let data: [ViewStatus]
var body: some View {
Chart(data, id: \.status) {
BarMark(
x: .value("Views", $0.views)
)
.foregroundStyle(by: .value("Status", $0.status))
}
}
}

By default, Chart will draw the next
placeholdermaximum value, depend on the input. In your example above is400,000. To fix it you must re-calculate the range of x-axis to provide the minimum value and the maximum value.Output: