
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)
}
}
Подробнее здесь: https://stackoverflow.com/questions/784 ... otted-line
Мобильная версия