feat: renamed BarChart to ColumnChart

This commit is contained in:
Serhiy Mytrovtsiy
2026-03-16 21:42:15 +01:00
parent f55bcc4f4b
commit e6bdb2df2b
3 changed files with 39 additions and 21 deletions
+31 -13
View File
@@ -157,9 +157,10 @@ public class LineChartView: NSView {
self.addTrackingArea(NSTrackingArea(
rect: CGRect(x: 0, y: 0, width: self.frame.width, height: self.frame.height),
options: [
NSTrackingArea.Options.activeAlways,
NSTrackingArea.Options.mouseEnteredAndExited,
NSTrackingArea.Options.mouseMoved
.activeAlways,
.mouseEnteredAndExited,
.mouseMoved,
.inVisibleRect
],
owner: self, userInfo: nil
))
@@ -346,11 +347,12 @@ public class LineChartView: NSView {
public override func updateTrackingAreas() {
self.trackingAreas.forEach({ self.removeTrackingArea($0) })
self.addTrackingArea(NSTrackingArea(
rect: CGRect(x: 0, y: 0, width: self.frame.width, height: self.frame.height),
rect: .zero,
options: [
NSTrackingArea.Options.activeAlways,
NSTrackingArea.Options.mouseEnteredAndExited,
NSTrackingArea.Options.mouseMoved
.activeAlways,
.mouseEnteredAndExited,
.mouseMoved,
.inVisibleRect
],
owner: self, userInfo: nil
))
@@ -538,7 +540,7 @@ public class PieChartView: NSView {
private var segments: [circle_segment] = []
private var queue: DispatchQueue = DispatchQueue(label: "eu.exelban.Stats.charts.pie")
public init(frame: NSRect, segments: [circle_segment], filled: Bool = false, drawValue: Bool = false) {
public init(frame: NSRect = .zero, segments: [circle_segment] = [], filled: Bool = false, drawValue: Bool = false) {
self.filled = filled
self.drawValue = drawValue
self.segments = segments
@@ -817,10 +819,10 @@ internal class TachometerGraphView: NSView {
}
}
public class BarChartView: NSView {
public class ColumnChartView: NSView {
private var values: [ColorValue] = []
private var cursor: CGPoint? = nil
private var queue: DispatchQueue = DispatchQueue(label: "eu.exelban.Stats.charts.bar")
private var queue: DispatchQueue = DispatchQueue(label: "eu.exelban.Stats.charts.column")
public init(frame: NSRect = NSRect.zero, num: Int) {
super.init(frame: frame)
@@ -829,9 +831,10 @@ public class BarChartView: NSView {
self.addTrackingArea(NSTrackingArea(
rect: CGRect(x: 0, y: 0, width: self.frame.width, height: self.frame.height),
options: [
NSTrackingArea.Options.activeAlways,
NSTrackingArea.Options.mouseEnteredAndExited,
NSTrackingArea.Options.mouseMoved
.activeAlways,
.mouseEnteredAndExited,
.mouseMoved,
.inVisibleRect
],
owner: self, userInfo: nil
))
@@ -936,6 +939,21 @@ public class BarChartView: NSView {
self.cursor = nil
self.display()
}
public override func updateTrackingAreas() {
self.trackingAreas.forEach({ self.removeTrackingArea($0) })
self.addTrackingArea(NSTrackingArea(
rect: .zero,
options: [
.activeAlways,
.mouseEnteredAndExited,
.mouseMoved,
.inVisibleRect
],
owner: self, userInfo: nil
))
super.updateTrackingAreas()
}
}
public class GridChartView: NSView {
+4 -4
View File
@@ -69,7 +69,7 @@ internal class Popup: PopupWrapper {
private var sliderView: NSView? = nil
private var lineChart: LineChartView? = nil
private var barChart: BarChartView? = nil
private var columnChart: ColumnChartView? = nil
private var circle: PieChartView? = nil
private var temperatureCircle: HalfCircleGraphView? = nil
private var frequencyCircle: HalfCircleGraphView? = nil
@@ -244,13 +244,13 @@ internal class Popup: PopupWrapper {
box.layer?.backgroundColor = NSColor.lightGray.withAlphaComponent(0.1).cgColor
box.layer?.cornerRadius = 3
let chart = BarChartView(frame: NSRect(
let chart = ColumnChartView(frame: NSRect(
x: Constants.Popup.spacing,
y: Constants.Popup.spacing,
width: view.frame.width - (Constants.Popup.spacing*2),
height: box.frame.height - (Constants.Popup.spacing*2)
), num: Int(cores))
self.barChart = chart
self.columnChart = chart
box.addSubview(chart)
@@ -396,7 +396,7 @@ internal class Popup: PopupWrapper {
usagePerCore.append(ColorValue(value.usagePerCore[i], color: NSColor.systemBlue))
}
}
self.barChart?.setValues(usagePerCore)
self.columnChart?.setValues(usagePerCore)
self.initialized = true
}
+4 -4
View File
@@ -14,7 +14,7 @@ import Kit
public class Portal: PortalWrapper {
private var circle: PieChartView? = nil
private var barChart: BarChartView? = nil
private var columnChart: ColumnChartView? = nil
private var initialized: Bool = false
@@ -99,8 +99,8 @@ public class Portal: PortalWrapper {
box.layer?.backgroundColor = NSColor.lightGray.withAlphaComponent(0.1).cgColor
box.layer?.cornerRadius = 3
let chart = BarChartView(num: Int(cores))
self.barChart = chart
let chart = ColumnChartView(num: Int(cores))
self.columnChart = chart
box.addArrangedSubview(chart)
return box
@@ -163,7 +163,7 @@ public class Portal: PortalWrapper {
usagePerCore.append(ColorValue(value.usagePerCore[i], color: NSColor.systemBlue))
}
}
self.barChart?.setValues(usagePerCore)
self.columnChart?.setValues(usagePerCore)
self.initialized = true
}