I have a simple graph (made using Swift Charts framework) where I am showing the percentage of something over time. The x-axis is the time here and y-axis is the percentage. Ergo, I think if the values in y-axis would be like 25%, 50%, etc., it would make more sense to the user.
How can I customize the y-axis values and add a symbol (in this case a %
) at the end?
This is the code so far:
Chart(data, id: \.date) { datum in
LineMark(
x: .value("Date", datum.date, unit: .day),
y: .value("Done", datum.doneCount * 100 / (datum.doneCount + datum.notDoneCount))
)
.interpolationMethod(.catmullRom)
.foregroundStyle(Color.orange)
}
.chartXAxis {
AxisMarks(values: .stride(by: .day))
}