mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
fix: fixed Line Chart widget size when label option is enabled (#678)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user