fix: adjusted network chart baseline

This commit is contained in:
Serhiy Mytrovtsiy
2022-09-03 13:31:49 +02:00
parent 7b9f7a667d
commit 4dbf23b48b

View File

@@ -340,7 +340,6 @@ public class NetworkChartView: NSView {
}
let lineWidth = 1 / (NSScreen.main?.backingScaleFactor ?? 1)
let offset = lineWidth / 2
let zero: CGFloat = (dirtyRect.height/2) + dirtyRect.origin.y
let xRatio: CGFloat = (dirtyRect.width + (lineWidth*3)) / CGFloat(points.count)
@@ -348,10 +347,10 @@ public class NetworkChartView: NSView {
return (CGFloat(point) * xRatio) + (dirtyRect.origin.x - lineWidth)
}
let uploadYPoint = { (point: Int) -> CGFloat in
return scaleValue(scale: self.scale, value: points[point].0, maxValue: uploadMax, maxHeight: dirtyRect.height/2) + (dirtyRect.origin.y + dirtyRect.height/2 - offset)
return scaleValue(scale: self.scale, value: points[point].0, maxValue: uploadMax, maxHeight: dirtyRect.height/2) + (dirtyRect.height/2 + dirtyRect.origin.y)
}
let downloadYPoint = { (point: Int) -> CGFloat in
return (dirtyRect.height/2 + dirtyRect.origin.y + offset) - scaleValue(scale: self.scale, value: points[point].1, maxValue: downloadMax, maxHeight: dirtyRect.height/2)
return (dirtyRect.height/2 + dirtyRect.origin.y) - scaleValue(scale: self.scale, value: points[point].1, maxValue: downloadMax, maxHeight: dirtyRect.height/2)
}
let uploadlinePath = NSBezierPath()