I'm using the new Swift Charts (https://developer.apple.com/documentation/charts) framework to create a bar chart.
Chart {
BarMark(
x: .value("Name", "Item 1"),
y: .value("Count", 2)
)
BarMark(
x: .value("Name", "Item 2"),
y: .value("Count", 9)
)
BarMark(
x: .value("Name", "Item 3"),
y: .value("Count", 4)
)
BarMark(
x: .value("Name", "Item 4"),
y: .value("Count", 12)
)
BarMark(
x: .value("Name", "Item 5"),
y: .value("Count", 6)
)
BarMark(
x: .value("Name", "Item 6"),
y: .value("Count", 5)
)
}
.chartXAxis {
AxisMarks {
AxisGridline()
AxisTick()
AxisLabel()
}
}
On the x-axis I want to skip just the label for every second element. I want to keep the grid lines and ticks. Using stride for values won't work.
Has anyone an idea on how to achieve this?
Thanks.