mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-15 00:34:08 +09:00
feat: added a new NetworkChartViewV2 chart. Which merges 2 line charts. Moved the disk and network charts in the popup to the new chart.
This commit is contained in:
@@ -420,7 +420,7 @@ internal class NameView: NSStackView {
|
||||
}
|
||||
|
||||
internal class ChartView: NSStackView {
|
||||
private var chart: NetworkChartView? = nil
|
||||
private var chart: NetworkChartViewV2? = nil
|
||||
private var ready: Bool = false
|
||||
|
||||
private var readColor: NSColor {
|
||||
@@ -436,7 +436,7 @@ internal class ChartView: NSStackView {
|
||||
self.wantsLayer = true
|
||||
self.layer?.cornerRadius = 3
|
||||
|
||||
let chart = NetworkChartView(frame: NSRect(
|
||||
let chart = NetworkChartViewV2(frame: NSRect(
|
||||
x: 0,
|
||||
y: 1,
|
||||
width: self.frame.width,
|
||||
|
||||
@@ -14,7 +14,7 @@ import Kit
|
||||
|
||||
public class Portal: PortalWrapper {
|
||||
private var circle: PieChartView? = nil
|
||||
private var chart: NetworkChartView? = nil
|
||||
private var chart: NetworkChartViewV2? = nil
|
||||
|
||||
private var nameField: NSTextField? = nil
|
||||
private var usedField: NSTextField? = nil
|
||||
@@ -91,7 +91,7 @@ public class Portal: PortalWrapper {
|
||||
self.usedField = portalRow(view, title: "\(localizedString("Used")):")
|
||||
self.freeField = portalRow(view, title: "\(localizedString("Free")):")
|
||||
|
||||
let chart = NetworkChartView(frame: NSRect.zero, num: 120, minMax: false, outColor: self.writeColor, inColor: self.readColor)
|
||||
let chart = NetworkChartViewV2(frame: NSRect.zero, num: 120, minMax: false, outColor: self.writeColor, inColor: self.readColor)
|
||||
chart.heightAnchor.constraint(equalToConstant: 26).isActive = true
|
||||
self.chart = chart
|
||||
view.addArrangedSubview(chart)
|
||||
|
||||
@@ -55,7 +55,7 @@ internal class Popup: PopupWrapper {
|
||||
private var processesInitialized: Bool = false
|
||||
private var connectionInitialized: Bool = false
|
||||
|
||||
private var chart: NetworkChartView? = nil
|
||||
private var chart: NetworkChartViewV2? = nil
|
||||
private var chartScale: Scale = .none
|
||||
private var connectivityChart: GridChartView? = nil
|
||||
private var processes: ProcessesView? = nil
|
||||
@@ -175,11 +175,10 @@ internal class Popup: PopupWrapper {
|
||||
container.layer?.backgroundColor = NSColor.lightGray.withAlphaComponent(0.1).cgColor
|
||||
container.layer?.cornerRadius = 3
|
||||
|
||||
let chart = NetworkChartView(
|
||||
let chart = NetworkChartViewV2(
|
||||
frame: NSRect(x: 0, y: 1, width: container.frame.width, height: container.frame.height - 2),
|
||||
num: 120, outColor: self.uploadColor, inColor: self.downloadColor, toolTip: true, scale: self.chartScale
|
||||
num: 120, reversedOrder: self.reverseOrderState, outColor: self.uploadColor, inColor: self.downloadColor, scale: self.chartScale
|
||||
)
|
||||
chart.setReverseOrder(self.reverseOrderState)
|
||||
chart.base = self.base
|
||||
container.addSubview(chart)
|
||||
self.chart = chart
|
||||
|
||||
@@ -13,7 +13,7 @@ import Cocoa
|
||||
import Kit
|
||||
|
||||
public class Portal: PortalWrapper {
|
||||
private var chart: NetworkChartView? = nil
|
||||
private var chart: NetworkChartViewV2? = nil
|
||||
|
||||
private var publicIPField: NSTextField? = nil
|
||||
|
||||
@@ -73,7 +73,7 @@ public class Portal: PortalWrapper {
|
||||
view.orientation = .vertical
|
||||
view.distribution = .fill
|
||||
view.spacing = Constants.Popup.spacing*2
|
||||
let chart = NetworkChartView(frame: NSRect.zero, num: 120, minMax: true, outColor: self.uploadColor, inColor: self.downloadColor)
|
||||
let chart = NetworkChartViewV2(frame: NSRect.zero, num: 120, outColor: self.uploadColor, inColor: self.downloadColor)
|
||||
self.chart = chart
|
||||
|
||||
view.addArrangedSubview(chart)
|
||||
|
||||
Reference in New Issue
Block a user