From 51bf0b40910aad5ef258717dd6b873a070940fb1 Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Sun, 22 Oct 2023 13:34:01 +0200 Subject: [PATCH] fix: moved from frame to dirtyRect origin for line chart --- Kit/plugins/Charts.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Kit/plugins/Charts.swift b/Kit/plugins/Charts.swift index f37f4b79..496ff612 100644 --- a/Kit/plugins/Charts.swift +++ b/Kit/plugins/Charts.swift @@ -125,13 +125,13 @@ public class LineChartView: NSView { context.setShouldAntialias(true) let offset: CGFloat = 1 / (NSScreen.main?.backingScaleFactor ?? 1) - let height: CGFloat = self.frame.height - self.frame.origin.y - offset + let height: CGFloat = self.frame.height - dirtyRect.origin.y - offset let xRatio: CGFloat = self.frame.width / CGFloat(points.count-1) let list = points.enumerated().compactMap { (i: Int, v: Double) -> (value: Double, point: CGPoint) in return (v, CGPoint( - x: (CGFloat(i) * xRatio) + self.frame.origin.x, - y: scaleValue(scale: self.scale, value: v, maxValue: maxValue, maxHeight: height) + self.frame.origin.y + offset + x: (CGFloat(i) * xRatio) + dirtyRect.origin.x, + y: scaleValue(scale: self.scale, value: v, maxValue: maxValue, maxHeight: height) + dirtyRect.origin.y + offset )) }