Skip to content

Commit

Permalink
Add "cases" and "deaths" text to the lollipop
Browse files Browse the repository at this point in the history
  • Loading branch information
atrinh0 committed Nov 6, 2022
1 parent ab21ee2 commit bd9d541
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions covid19/covid19/Charts/CasesChart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct CasesChart: View {

let lineX = startPositionX1 + geo[proxy.plotAreaFrame].origin.x
let lineHeight = geo[proxy.plotAreaFrame].maxY
let boxWidth: CGFloat = 110
let boxWidth: CGFloat = 130
let boxOffset = max(0, min(geo.size.width - boxWidth, lineX - boxWidth / 2))

Rectangle()
Expand All @@ -68,11 +68,12 @@ struct CasesChart: View {
VStack(alignment: .center) {
Text("\(selectedElement.day, format: .dateTime.year().month().day())")
.font(.callout.bold())
.foregroundStyle(.primary)
Text("\(selectedElement.cases, format: .number)")
.font(.title2.bold())
.foregroundColor(.primary)
.font(.title2.bold()) +
Text(" cases")
.font(.callout.bold())
}
.foregroundStyle(.primary)
.accessibilityElement(children: .combine)
.frame(width: boxWidth, alignment: .center)
.background {
Expand Down
9 changes: 5 additions & 4 deletions covid19/covid19/Charts/DeathsChart.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct DeathsChart: View {

let lineX = startPositionX1 + geo[proxy.plotAreaFrame].origin.x
let lineHeight = geo[proxy.plotAreaFrame].maxY
let boxWidth: CGFloat = 110
let boxWidth: CGFloat = 130
let boxOffset = max(0, min(geo.size.width - boxWidth, lineX - boxWidth / 2))

Rectangle()
Expand All @@ -68,11 +68,12 @@ struct DeathsChart: View {
VStack(alignment: .center) {
Text("\(selectedElement.day, format: .dateTime.year().month().day())")
.font(.callout.bold())
.foregroundStyle(.primary)
Text("\(selectedElement.deaths, format: .number)")
.font(.title2.bold())
.foregroundColor(.primary)
.font(.title2.bold()) +
Text(" deaths")
.font(.callout.bold())
}
.foregroundStyle(.primary)
.accessibilityElement(children: .combine)
.frame(width: boxWidth, alignment: .center)
.background {
Expand Down

0 comments on commit bd9d541

Please sign in to comment.