Improve tooltips in new charts
This commit is contained in:
parent
1ad2f8f759
commit
e06510134f
@ -359,45 +359,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: legend
|
|
||||||
anchors { left: parent.left; bottom: parent.bottom; right: parent.right }
|
|
||||||
anchors.leftMargin: chartView.plotArea.x
|
|
||||||
height: Style.smallIconSize
|
|
||||||
anchors.margins: Style.margins
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
// opacity: selfProductionConsumptionSeries.opacity
|
|
||||||
MouseArea {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.topMargin: -Style.smallMargins
|
|
||||||
anchors.bottomMargin: -Style.smallMargins
|
|
||||||
// onClicked: d.selectSeries(selfProductionConsumptionSeries)
|
|
||||||
}
|
|
||||||
Row {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Style.smallMargins
|
|
||||||
ColorIcon {
|
|
||||||
name: "weathericons/weather-clear-day"
|
|
||||||
size: Style.smallIconSize
|
|
||||||
color: Style.green
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
width: parent.parent.width - x
|
|
||||||
elide: Text.ElideRight
|
|
||||||
visible: legend.width > 500
|
|
||||||
text: qsTr("Produced")
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
font: Style.smallFont
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -526,15 +487,33 @@ Item {
|
|||||||
font: Style.smallFont
|
font: Style.smallFont
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
|
||||||
elide: Text.ElideRight
|
ColorIcon {
|
||||||
text: toolTip.value === null
|
id: icon
|
||||||
? qsTr("No data")
|
size: Style.smallIconSize
|
||||||
: root.stateType.type.toLowerCase() == "bool"
|
name: root.iconSource
|
||||||
? root.stateType.displayName + ": " + (toolTip.value ? qsTr("Yes") : qsTr("No"))
|
color: root.color
|
||||||
: Types.toUiValue(toolTip.value, root.stateType.unit).toFixed(root.roundTo) + Types.toUiUnit(root.stateType.unit)
|
visible: name != ""
|
||||||
font: Style.smallFont
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: Style.extraSmallFont.pixelSize
|
||||||
|
height: width
|
||||||
|
color: root.color
|
||||||
|
visible: !icon.visible
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
elide: Text.ElideRight
|
||||||
|
text: toolTip.value === null
|
||||||
|
? qsTr("No data")
|
||||||
|
: root.stateType.type.toLowerCase() == "bool"
|
||||||
|
? root.stateType.displayName + ": " + (toolTip.value ? qsTr("Yes") : qsTr("No"))
|
||||||
|
: Types.toUiValue(toolTip.value, root.stateType.unit).toFixed(root.roundTo) + Types.toUiUnit(root.stateType.unit)
|
||||||
|
font: Style.extraSmallFont
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -155,6 +155,7 @@ ThingPageBase {
|
|||||||
thing: root.thing
|
thing: root.thing
|
||||||
stateType: parent.stateType
|
stateType: parent.stateType
|
||||||
color: app.interfaceToColor(interfaceName)
|
color: app.interfaceToColor(interfaceName)
|
||||||
|
iconSource: app.interfaceToIcon(interfaceName)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,6 +61,7 @@ Page {
|
|||||||
for (var i = 0; i < vocRepeater.count; i++) {
|
for (var i = 0; i < vocRepeater.count; i++) {
|
||||||
vocRepeater.itemAt(i).logsModel.fetchLogs()
|
vocRepeater.itemAt(i).logsModel.fetchLogs()
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < windowOpenRepeater.count; i++) {
|
for (var i = 0; i < windowOpenRepeater.count; i++) {
|
||||||
windowOpenRepeater.itemAt(i).logsModel.fetchLogs()
|
windowOpenRepeater.itemAt(i).logsModel.fetchLogs()
|
||||||
}
|
}
|
||||||
@ -897,6 +898,7 @@ Page {
|
|||||||
thing: thermostatsRepeater.itemAt(index).thing
|
thing: thermostatsRepeater.itemAt(index).thing
|
||||||
entry: thermostatsRepeater.itemAt(index).logsModel.find(tooltips.timestamp)
|
entry: thermostatsRepeater.itemAt(index).logsModel.find(tooltips.timestamp)
|
||||||
color: app.interfaceToColor("temperaturesensor")
|
color: app.interfaceToColor("temperaturesensor")
|
||||||
|
iconSource: app.interfaceToIcon("temperaturesensor")
|
||||||
valueName: "temperature"
|
valueName: "temperature"
|
||||||
axis: temperatureAxis
|
axis: temperatureAxis
|
||||||
x: tooltips.tooltipX
|
x: tooltips.tooltipX
|
||||||
@ -917,6 +919,7 @@ Page {
|
|||||||
entry: tempRepeater.itemAt(index).logsModel.find(tooltips.timestamp)
|
entry: tempRepeater.itemAt(index).logsModel.find(tooltips.timestamp)
|
||||||
valueName: "temperature"
|
valueName: "temperature"
|
||||||
color: app.interfaceToColor("temperaturesensor")
|
color: app.interfaceToColor("temperaturesensor")
|
||||||
|
iconSource: app.interfaceToIcon("temperaturesensor")
|
||||||
axis: temperatureAxis
|
axis: temperatureAxis
|
||||||
x: tooltips.tooltipX
|
x: tooltips.tooltipX
|
||||||
width: tooltips.tooltipWidth
|
width: tooltips.tooltipWidth
|
||||||
@ -935,6 +938,7 @@ Page {
|
|||||||
thing: humidityRepeater.itemAt(index).thing
|
thing: humidityRepeater.itemAt(index).thing
|
||||||
entry: humidityRepeater.itemAt(index).logsModel.find(tooltips.timestamp)
|
entry: humidityRepeater.itemAt(index).logsModel.find(tooltips.timestamp)
|
||||||
color: app.interfaceToColor("humiditysensor")
|
color: app.interfaceToColor("humiditysensor")
|
||||||
|
iconSource: app.interfaceToIcon("humiditysensor")
|
||||||
valueName: "humidity"
|
valueName: "humidity"
|
||||||
axis: humidityAxis
|
axis: humidityAxis
|
||||||
x: tooltips.tooltipX
|
x: tooltips.tooltipX
|
||||||
@ -955,6 +959,7 @@ Page {
|
|||||||
entry: vocRepeater.itemAt(index).logsModel.find(tooltips.timestamp)
|
entry: vocRepeater.itemAt(index).logsModel.find(tooltips.timestamp)
|
||||||
valueName: "voc"
|
valueName: "voc"
|
||||||
color: app.interfaceToColor("vocsensor")
|
color: app.interfaceToColor("vocsensor")
|
||||||
|
iconSource: app.interfaceToIcon("vocsensor")
|
||||||
axis: vocAxis
|
axis: vocAxis
|
||||||
x: tooltips.tooltipX
|
x: tooltips.tooltipX
|
||||||
width: tooltips.tooltipWidth
|
width: tooltips.tooltipWidth
|
||||||
|
|||||||
@ -15,6 +15,7 @@ NymeaToolTip {
|
|||||||
property Thing thing: null
|
property Thing thing: null
|
||||||
property NewLogEntry entry: null
|
property NewLogEntry entry: null
|
||||||
property string valueName: ""
|
property string valueName: ""
|
||||||
|
property alias iconSource: icon.name
|
||||||
property alias color: rect.color
|
property alias color: rect.color
|
||||||
property ValueAxis axis: null
|
property ValueAxis axis: null
|
||||||
property int unit: Types.UnitNone
|
property int unit: Types.UnitNone
|
||||||
@ -29,10 +30,18 @@ NymeaToolTip {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Style.smallMargins
|
anchors.margins: Style.smallMargins
|
||||||
|
|
||||||
|
ColorIcon {
|
||||||
|
id: icon
|
||||||
|
size: Style.smallIconSize
|
||||||
|
color: root.color
|
||||||
|
visible: name != ""
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: rect
|
id: rect
|
||||||
width: Style.extraSmallFont.pixelSize
|
width: Style.extraSmallFont.pixelSize
|
||||||
height: width
|
height: width
|
||||||
|
visible: !icon.visible
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
text: "%1: %2%3".arg(thing.name).arg(entry ? round(Types.toUiValue(root.value, unit)) : "-").arg(Types.toUiUnit(unit))
|
text: "%1: %2%3".arg(thing.name).arg(entry ? round(Types.toUiValue(root.value, unit)) : "-").arg(Types.toUiUnit(unit))
|
||||||
|
|||||||
Reference in New Issue
Block a user