I am having some issues with Swift charts. I have the following Chart
which has RuleMark
. As you can see from the screenshot below the RuleMark
extends the length of the screen. I am attempting to only show the mark below the line. Something like this question is asking. If any further clarity is required let me know. The code is below.
struct Item: Identifiable {
var date: String
var count: Double
var id = UUID()
}
var data: [Item] = [
.init(date: "10AM", count: 5),
.init(date: "12AM", count: 4),
.init(date: "2PM", count: 7),
.init(date: "4PM", count: 2),
.init(date: "6PM", count: 9)
]
struct ContentView: View {
@State private var showingConfirmation = false
@State private var backgroundColor = Color.white
@State private var blurAmount = 0.0
@State private var image: Image?
var body: some View {
Chart(data) { item in
LineMark(
x: .value("Date", item.date),
y: .value("Value", item.count)
)
PointMark(
x: .value("Date", item.date),
y: .value("Value", item.count)
)
RuleMark(
x: .value("Value", item.date)
)
}
.chartYAxis(.hidden)
}
}