sparkline: remove maxSamples, remove bar gaps, always fill width from data
This commit is contained in:
parent
a0a5b907b9
commit
946c3a61d7
5 changed files with 3 additions and 12 deletions
|
|
@ -96,7 +96,6 @@ Column {
|
||||||
history: S.BatteryService.history
|
history: S.BatteryService.history
|
||||||
color: root._stateColor
|
color: root._stateColor
|
||||||
active: root.active
|
active: root.active
|
||||||
maxSamples: 1440
|
|
||||||
backgroundTint: 0.07
|
backgroundTint: 0.07
|
||||||
areaMode: true
|
areaMode: true
|
||||||
thresholds: [
|
thresholds: [
|
||||||
|
|
@ -163,7 +162,6 @@ Column {
|
||||||
history: S.BatteryService.rateHistory
|
history: S.BatteryService.rateHistory
|
||||||
color: root._stateColor
|
color: root._stateColor
|
||||||
active: root.active
|
active: root.active
|
||||||
maxSamples: 60
|
|
||||||
maxValue: null
|
maxValue: null
|
||||||
minValue: null
|
minValue: null
|
||||||
backgroundTint: 0.08
|
backgroundTint: 0.08
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,6 @@ Column {
|
||||||
height: 36
|
height: 36
|
||||||
history: S.SystemStats.gpuHistory
|
history: S.SystemStats.gpuHistory
|
||||||
active: root.active
|
active: root.active
|
||||||
maxSamples: 60
|
|
||||||
colorFunction: v => S.Theme.loadColor(v)
|
colorFunction: v => S.Theme.loadColor(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,6 @@ Column {
|
||||||
history: S.SystemStats.memHistory
|
history: S.SystemStats.memHistory
|
||||||
color: root.accentColor
|
color: root.accentColor
|
||||||
active: root.active
|
active: root.active
|
||||||
maxSamples: 30
|
|
||||||
backgroundTint: 0.15
|
backgroundTint: 0.15
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,6 @@ Canvas {
|
||||||
readonly property real _max: maxValue !== null && maxValue !== undefined ? maxValue : (history.length ? Math.max(...history) : 100)
|
readonly property real _max: maxValue !== null && maxValue !== undefined ? maxValue : (history.length ? Math.max(...history) : 100)
|
||||||
readonly property real _min: minValue !== null && minValue !== undefined ? minValue : (history.length ? Math.min(...history) : 0)
|
readonly property real _min: minValue !== null && minValue !== undefined ? minValue : (history.length ? Math.min(...history) : 0)
|
||||||
|
|
||||||
// Max x-axis slots - bars get narrower as data fills up, then oldest drops off
|
|
||||||
property int maxSamples: 0
|
|
||||||
|
|
||||||
// Logarithmic x-axis: compresses old data on the left, expands recent data on the right.
|
// Logarithmic x-axis: compresses old data on the left, expands recent data on the right.
|
||||||
// logCurve controls strength (0 = linear, 3 = strong compression). Only visual - does not affect data.
|
// logCurve controls strength (0 = linear, 3 = strong compression). Only visual - does not affect data.
|
||||||
property bool logScale: false
|
property bool logScale: false
|
||||||
|
|
@ -69,9 +66,8 @@ Canvas {
|
||||||
const x1 = width * (Math.exp(k * (i + 1) / n) - 1) / expK;
|
const x1 = width * (Math.exp(k * (i + 1) / n) - 1) / expK;
|
||||||
return [x0, x1 - x0];
|
return [x0, x1 - x0];
|
||||||
}
|
}
|
||||||
const step = width / (maxSamples > n ? maxSamples : n);
|
const step = width / n;
|
||||||
const off = maxSamples > n ? (maxSamples - n) * step : 0;
|
return [i * step, step];
|
||||||
return [off + i * step, step];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Background tint
|
// Background tint
|
||||||
|
|
@ -149,7 +145,7 @@ Canvas {
|
||||||
const dy = yOf(d[i]);
|
const dy = yOf(d[i]);
|
||||||
const barTop = Math.min(dy, zy);
|
const barTop = Math.min(dy, zy);
|
||||||
const barH = Math.max(1, Math.abs(dy - zy));
|
const barH = Math.max(1, Math.abs(dy - zy));
|
||||||
ctx.fillRect(bx, barTop, Math.max(1, bw - 0.5), barH);
|
ctx.fillRect(bx, barTop, Math.ceil(bw), barH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,6 @@ Column {
|
||||||
history: root.history
|
history: root.history
|
||||||
color: root.stateColor
|
color: root.stateColor
|
||||||
active: root.active
|
active: root.active
|
||||||
maxSamples: 150
|
|
||||||
backgroundTint: 0.08
|
backgroundTint: 0.08
|
||||||
thresholds: [
|
thresholds: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue