@@ -75,6 +75,11 @@ class PeriodDataViewController: UIViewController, IndicatorInfoProvider {
7575 super. viewDidAppear ( animated)
7676 reloadAllFields ( )
7777 }
78+
79+ override func viewDidDisappear( _ animated: Bool ) {
80+ super. viewDidDisappear ( animated)
81+ clearChartMarkers ( )
82+ }
7883}
7984
8085
@@ -176,7 +181,7 @@ extension PeriodDataViewController: ChartViewDelegate {
176181 func chartValueSelected( _ chartView: ChartViewBase , entry: ChartDataEntry , highlight: Highlight ) {
177182 guard entry. y != 0.0 else {
178183 // Do not display the marker if the Y-value is zero
179- chartView . highlightValue ( nil , callDelegate : false )
184+ clearChartMarkers ( )
180185 return
181186 }
182187
@@ -209,8 +214,7 @@ extension PeriodDataViewController: IAxisValueFormatter {
209214 }
210215 case . week:
211216 if let periodDate = DateFormatter . Stats. statsWeekFormatter. date ( from: item. period) {
212- let firstMonday = Calendar . current. date ( byAdding: . day, value: 1 , to: periodDate) ?? periodDate
213- dateString = DateFormatter . Charts. chartsWeekFormatter. string ( from: firstMonday)
217+ dateString = DateFormatter . Charts. chartsWeekFormatter. string ( from: periodDate)
214218 }
215219 case . month:
216220 if let periodDate = DateFormatter . Stats. statsMonthFormatter. date ( from: item. period) {
@@ -292,6 +296,10 @@ private extension PeriodDataViewController {
292296 if lastUpdated != nil { lastUpdated. text = summaryDateUpdated }
293297 }
294298
299+ func clearChartMarkers( ) {
300+ barChartView. highlightValue ( nil , callDelegate: false )
301+ }
302+
295303 func generateBarDataSet( ) -> BarChartData ? {
296304 guard let orderStats = orderStats, let statItems = orderStats. items, !statItems. isEmpty else {
297305 return nil
0 commit comments