diff --git a/Kit/Widgets/LineChart.swift b/Kit/Widgets/LineChart.swift index 48c83196..60679787 100644 --- a/Kit/Widgets/LineChart.swift +++ b/Kit/Widgets/LineChart.swift @@ -169,7 +169,7 @@ public class LineChart: WidgetWrapper { let box = NSBezierPath(roundedRect: NSRect( x: x+offset, y: offset, - width: self.width - Constants.Widget.margin.x - (x+offset)*2, + width: self.width - Constants.Widget.margin.x*2 - offset*2, height: boxSize.height - (offset*2) ), xRadius: 2, yRadius: 2) @@ -189,7 +189,7 @@ public class LineChart: WidgetWrapper { let chartFrame = NSRect( x: x+offset+lineWidth, y: offset, - width: self.width - (x+offset+lineWidth)*2, + width: box.bounds.width - (offset*2+lineWidth), height: box.bounds.height - offset ) self.chart.color = color diff --git a/Kit/plugins/Charts.swift b/Kit/plugins/Charts.swift index 1e1e2258..4c41f25e 100644 --- a/Kit/plugins/Charts.swift +++ b/Kit/plugins/Charts.swift @@ -39,7 +39,7 @@ public class LineChartView: NSView { public var color: NSColor = controlAccentColor public init(frame: NSRect, num: Int) { - self.points = Array(repeating: 0, count: num) + self.points = Array(repeating: 0.01, count: num) super.init(frame: frame) } @@ -88,7 +88,7 @@ public class LineChartView: NSView { let underLinePath = line.copy() as! NSBezierPath underLinePath.line(to: CGPoint(x: columnXPoint(self.points.count), y: offset)) - underLinePath.line(to: CGPoint(x: 0, y: offset)) + underLinePath.line(to: CGPoint(x: columnXPoint(0), y: offset)) underLinePath.close() underLinePath.addClip()