Skip to content

Commit

Permalink
Work on scrollable graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Aug 6, 2024
1 parent 5935fb0 commit 3f98212
Show file tree
Hide file tree
Showing 15 changed files with 496 additions and 266 deletions.
18 changes: 15 additions & 3 deletions qml/ComponentLibrary/controls/ScrollBarThemed.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@ T.ScrollBar {
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
implicitContentHeight + topPadding + bottomPadding)

leftPadding: 0
rightPadding: 0

visible: (policy !== T.ScrollBar.AlwaysOff)
minimumSize: (orientation === Qt.Horizontal) ? height / width : width / height

minimumSize: (orientation === Qt.Horizontal) ? (height / width) : (width / height)

property int radius: isDesktop ? 0 : 8

property color colorBackground: Theme.colorBackground
property color colorMoving: Theme.colorForeground
property color colorPressed: Theme.colorPrimary

////////////////

Expand Down Expand Up @@ -45,7 +55,8 @@ T.ScrollBar {
y: control.topPadding
height: control.height - control.topPadding - control.bottomPadding

color: Theme.colorBackground
radius: control.radius
color: control.colorBackground
opacity: 0.0
}

Expand All @@ -55,7 +66,8 @@ T.ScrollBar {
implicitWidth: control.interactive ? 12 : 6
implicitHeight: control.interactive ? 12 : 6

color: control.pressed ? Theme.colorSecondary : Theme.colorForeground
radius: control.radius
color: control.pressed ? control.colorPressed : control.colorMoving
opacity: 0.0
}

Expand Down
26 changes: 15 additions & 11 deletions qml/DeviceEnvironmental.qml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ Loader {
loadIndicator()
updateHeader()
loadGraph()
updateGraph()
}

////////
Expand Down Expand Up @@ -393,15 +394,23 @@ Loader {
}

function loadGraph() {
//console.log("DeviceEnvironmental // loadGraph() >> " + currentDevice)

if (isAirMonitor) {
if (currentDevice.hasPM1Sensor || currentDevice.hasPM25Sensor || currentDevice.hasPM10Sensor ||
currentDevice.hasVocSensor || currentDevice.hasHchoSensor ||
currentDevice.hasCoSensor || currentDevice.hasCo2Sensor) {
if (primary === "hygrometer") {
graphLoader.source = ""
graphLoader.opacity = 0
if (graphLoader.status !== Loader.Ready ||
graphLoader.source !== "ChartThermometerMinMax.qml") {
graphLoader.source = "ChartThermometerMinMax.qml"
} else {
envChart.loadGraph()
envChart.updateGraph()
}
} else {
if (graphLoader.status !== Loader.Ready) {
if (graphLoader.status !== Loader.Ready ||
graphLoader.source !== "ChartEnvironmentalVoc.qml") {
graphLoader.source = "ChartEnvironmentalVoc.qml"
} else {
envChart.loadGraph()
Expand All @@ -417,13 +426,8 @@ Loader {
if (!currentDevice.isEnvironmentalSensor) return
//console.log("DeviceEnvironmental // updateGraph() >> " + currentDevice)

// GRAPH
if (isAirMonitor) {
if (currentDevice.hasPM25Sensor || currentDevice.hasPM10Sensor) {
currentDevice.updateChartData_environmentalEnv(90)
} else if (currentDevice.hasVocSensor || currentDevice.hasHchoSensor || currentDevice.hasCo2Sensor) {
currentDevice.updateChartData_environmentalVoc(90)
}
if (graphLoader.status === Loader.Ready && isAirMonitor) {
envChart.updateGraph()
}
}

Expand Down Expand Up @@ -1228,7 +1232,7 @@ Loader {
envChart.updateGraph()

graphLoader.opacity = 1
noDataIndicator.visible = (currentDevice.countDataNamed("temperature", envChart.daysVisible) < 1)
noDataIndicator.visible = (currentDevice.countDataNamed(primary, envChart.daysVisible) < 1)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion qml/DevicePlantSensorSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ Flickable {

ColumnLayout {
anchors.fill: parent
spacing: 12
spacing: 8

Row {
spacing: 8
Expand Down
4 changes: 4 additions & 0 deletions qml/DeviceThermometer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ Loader {
}

function loadGraph() {
//console.log("DeviceThermometer // loadGraph() >> " + currentDevice)

var reload = !(settingsManager.graphThermometer === "lines" && graphLoader.source === "ChartPlantDataAio.qml") ||
!(settingsManager.graphThermometer === "minmax" && graphLoader.source === "ChartThermometerMinMax.qml")

Expand All @@ -253,6 +255,8 @@ Loader {
}

function updateGraph() {
//console.log("DeviceThermometer // updateGraph() >> " + currentDevice)

if (graphLoader.status === Loader.Ready) thermoChart.updateGraph()
}

Expand Down
Loading

0 comments on commit 3f98212

Please sign in to comment.