Skip to content

Commit 5bd091f

Browse files
committed
feat: refactored Charts
1 parent 731b8ba commit 5bd091f

File tree

14 files changed

+386
-354
lines changed

14 files changed

+386
-354
lines changed

Kit/Widgets/LineChart.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public class LineChart: WidgetWrapper {
116116
for _ in 0..<16 {
117117
list.append(DoubleValue(Double.random(in: 0..<1)))
118118
}
119-
self.chart.points = list
119+
self.chart.setPoints(list)
120120
self._value = 0.38
121121
}
122122

@@ -218,21 +218,21 @@ public class LineChart: WidgetWrapper {
218218
(isDarkMode ? NSColor.white : NSColor.black).set()
219219
box.stroke()
220220
box.fill()
221-
self.chart.transparent = false
221+
self.chart.setTransparent(false)
222222
} else if self.frameState {
223-
self.chart.transparent = true
223+
self.chart.setTransparent(true)
224224
} else {
225-
self.chart.transparent = true
225+
self.chart.setTransparent(true)
226226
}
227-
227+
228228
context.saveGState()
229229
context.translateBy(x: x+offset+lineWidth, y: offset)
230230

231231
let chartSize = NSSize(
232232
width: box.bounds.width - (offset*2+lineWidth),
233233
height: box.bounds.height - offset
234234
)
235-
self.chart.color = color
235+
self.chart.setColor(color)
236236
self.chart.setFrameSize(chartSize)
237237
self.chart.draw(NSRect(origin: .zero, size: chartSize))
238238

Kit/Widgets/PieChart.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public class PieChart: WidgetWrapper {
8383
self.addSubview(self.labelView!)
8484
self.addSubview(self.chart)
8585

86-
self.chart.setFrame(NSRect(x: x, y: 0, width: self.frame.size.height, height: self.frame.size.height))
86+
self.chart.frame = NSRect(x: x, y: 0, width: self.frame.size.height, height: self.frame.size.height)
8787

8888
self.setFrameSize(NSSize(width: self.size + x, height: self.frame.size.height))
8989
self.setWidth(self.size + x)

Kit/Widgets/Tachometer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public class Tachometer: WidgetWrapper {
6565
self.addSubview(self.labelView!)
6666
self.addSubview(self.chart)
6767

68-
self.chart.setFrame(NSRect(x: x, y: 0, width: self.frame.size.height, height: self.frame.size.height))
68+
self.chart.frame = NSRect(x: x, y: 0, width: self.frame.size.height, height: self.frame.size.height)
6969

7070
self.setFrameSize(NSSize(width: self.size + x, height: self.frame.size.height))
7171
self.setWidth(self.size + x)

0 commit comments

Comments
 (0)