Apple docs does not have a sample that does this. What do i need to use. My line chart has too many points in the x axis. How to lessen them?
I saw something about
Chart {
}
.chartXAxis {
// Is this the right property? What should go in here?
}
Apple docs does not have a sample that does this. What do i need to use. My line chart has too many points in the x axis. How to lessen them?
I saw something about
Chart {
}
.chartXAxis {
// Is this the right property? What should go in here?
}
This is the chart data
struct ChartData : Identifiable {
var id = UUID()
var date: String
var rainfallTo: Int
var tempMean: Int
}
and the chart code
Chart(createChartData(city)) {
LineMark(
x: .value(StringTool.localize("date"), $0.date),
y: .value("Rainfall mm", $0.rainfallTo),
series: .value("type", StringTool.localize("rainfall_mm"))
)
.foregroundStyle(by: .value("type", StringTool.localize("rainfall_mm")))
LineMark(
x: .value(StringTool.localize("date"), $0.date),
y: .value(StringTool.localize("temperature"), $0.tempMean),
series: .value("type", StringTool.localize("temperature"))
)
.foregroundStyle(by: .value("type", StringTool.localize("temperature")))
}