Skip to content

Commit 114afa1

Browse files
committed
marker updated to have + sign when increase is positive
1 parent 4c17cb9 commit 114afa1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

WordPress/Classes/ViewRelated/Stats/Insights/ViewsVisitors/ViewsVisitorsChartMarker.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ final class ViewsVisitorsChartMarker: MarkerView {
249249
}
250250

251251
let entryPrevWeek = lineChartDataSetPrevWeek.entries[Int(entry.x)]
252-
let difference = entry.y - entryPrevWeek.y
252+
let difference = Int(entry.y - entryPrevWeek.y)
253+
let differenceStr = difference < 0 ? "\(difference)" : "+\(difference)"
253254

254255
var roundedPercentage = 0
255256
if entryPrevWeek.y > 0 {
@@ -264,7 +265,7 @@ final class ViewsVisitorsChartMarker: MarkerView {
264265
.paragraphStyle: paragraphStyle,
265266
.foregroundColor: UIColor.white]
266267

267-
let topRowStr = NSMutableAttributedString(string: "\(Int(difference)) (\(roundedPercentage)%)\n", attributes: topRowAttributes)
268+
let topRowStr = NSMutableAttributedString(string: "\(differenceStr) (\(roundedPercentage)%)\n", attributes: topRowAttributes)
268269
let bottomRowStr = NSAttributedString(string: "\(yValue) \(name)", attributes: bottomRowAttributes)
269270

270271
topRowStr.append(bottomRowStr)

0 commit comments

Comments
 (0)