feat: graphs now properly sized + port static graphs to c++
This commit is contained in:
@@ -101,6 +101,7 @@ orientation: Qt.Vertical
|
||||
line1Color: card.accent
|
||||
line1FillAlpha: 0.15
|
||||
maxValue: 1.0
|
||||
slideInterval: Config.dashboard.resourceUpdateInterval
|
||||
slideProgress: 1
|
||||
|
||||
Connections {
|
||||
@@ -114,9 +115,14 @@ orientation: Qt.Vertical
|
||||
NumberAnimation {
|
||||
id: slideAnim
|
||||
|
||||
// Only drives frames; the slide phase is the sample
|
||||
// clock inside SparklineItem. It must not stop at the
|
||||
// end of a cycle, or the newest value is held on the
|
||||
// clipped edge until the next sample arrives.
|
||||
duration: Config.dashboard.resourceUpdateInterval
|
||||
easing.type: Easing.Linear
|
||||
from: 0
|
||||
loops: Animation.Infinite
|
||||
property: "slideProgress"
|
||||
target: sparkline
|
||||
to: 1
|
||||
|
||||
@@ -25,14 +25,6 @@ SnapLayout {
|
||||
return ZUtils.snap(d.getHours() + d.getMinutes() / 60, root);
|
||||
}
|
||||
|
||||
function formatHour(h) {
|
||||
if (root.useTwelveHourClock) {
|
||||
const hr = h % 12 === 0 ? 12 : h % 12;
|
||||
return hr + (h < 12 ? " AM" : " PM");
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 60000
|
||||
repeat: true
|
||||
@@ -78,8 +70,10 @@ SnapLayout {
|
||||
minHorizontalLines: 3
|
||||
yPaddingTop: horizontalLineStep
|
||||
yPaddingBottom: horizontalLineStep
|
||||
xLabel: i => root.formatHour(i)
|
||||
yLabel: v => Math.round(v) + "°"
|
||||
xLabelMode: LineGraph.Hour
|
||||
useTwelveHourClock: root.useTwelveHourClock
|
||||
yLabelMode: LineGraph.Value
|
||||
yLabelSuffix: "°"
|
||||
|
||||
markerX: root.markerX
|
||||
smoothing: root.smoothing
|
||||
@@ -133,8 +127,10 @@ SnapLayout {
|
||||
verticalLineStep: 3
|
||||
lastXLine: false
|
||||
horizontalLineStep: 30
|
||||
xLabel: i => root.formatHour(i)
|
||||
yLabel: v => v + "%"
|
||||
xLabelMode: LineGraph.Hour
|
||||
useTwelveHourClock: root.useTwelveHourClock
|
||||
yLabelMode: LineGraph.Value
|
||||
yLabelSuffix: "%"
|
||||
|
||||
markerX: root.markerX
|
||||
smoothing: root.smoothing
|
||||
|
||||
@@ -50,7 +50,6 @@ CustomRect {
|
||||
SparklineItem {
|
||||
id: sparkline
|
||||
|
||||
property bool initialized: false
|
||||
property real smoothMax: targetMax * 1.6
|
||||
property real targetMax: 1024
|
||||
|
||||
@@ -63,20 +62,15 @@ CustomRect {
|
||||
line2Color: Colors.palette.m3tertiary
|
||||
line2FillAlpha: 0.2
|
||||
maxValue: smoothMax
|
||||
slideInterval: Config.dashboard.resourceUpdateInterval
|
||||
slideProgress: 1
|
||||
|
||||
Behavior on smoothMax {
|
||||
enabled: sparkline.initialized
|
||||
|
||||
Anim {}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
sparkline.targetMax = Math.max(NetworkUsage.downloadBuffer.maximum, NetworkUsage.uploadBuffer.maximum, 1024);
|
||||
|
||||
sparkline.smoothMax = Qt.binding(() => sparkline.targetMax * 1.6);
|
||||
|
||||
sparkline.initialized = true;
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -94,6 +88,7 @@ CustomRect {
|
||||
duration: Config.dashboard.resourceUpdateInterval
|
||||
easing.type: Easing.Linear
|
||||
from: 0
|
||||
loops: Animation.Infinite
|
||||
property: "slideProgress"
|
||||
target: sparkline
|
||||
to: 1
|
||||
|
||||
@@ -120,6 +120,12 @@ Item {
|
||||
label: qsTr("Video memory")
|
||||
icon: "memory_alt"
|
||||
}
|
||||
|
||||
StateLayer {
|
||||
onClicked: {
|
||||
ZUtils.logPlacement(card, "card");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WrappedLoader {
|
||||
|
||||
Reference in New Issue
Block a user