Improve ac charts
This commit is contained in:
parent
0e5619b4f9
commit
edbda7abda
@ -71,12 +71,6 @@ Item {
|
|||||||
|
|
||||||
onEntriesAdded: {
|
onEntriesAdded: {
|
||||||
print("**** entries added", index, entries.length, "entries in series:", valueSeries.count, "in model", logsModel.count)
|
print("**** entries added", index, entries.length, "entries in series:", valueSeries.count, "in model", logsModel.count)
|
||||||
// if (valueSeries.count == 0) {
|
|
||||||
// print("adding zero item", new Date())
|
|
||||||
// valueSeries.insert(0, new Date(), 0)
|
|
||||||
// zeroSeries.ensureValue(new Date())
|
|
||||||
// }
|
|
||||||
|
|
||||||
for (var i = 0; i < entries.length; i++) {
|
for (var i = 0; i < entries.length; i++) {
|
||||||
var entry = entries[i]
|
var entry = entries[i]
|
||||||
// print("entry", entry.timestamp, entry.source, JSON.stringify(entry.values))
|
// print("entry", entry.timestamp, entry.source, JSON.stringify(entry.values))
|
||||||
@ -92,14 +86,6 @@ Item {
|
|||||||
valueSeries.insert(insertIdx, entry.timestamp.getTime() - 500, !value)
|
valueSeries.insert(insertIdx, entry.timestamp.getTime() - 500, !value)
|
||||||
valueSeries.insert(insertIdx+1, entry.timestamp, value)
|
valueSeries.insert(insertIdx+1, entry.timestamp, value)
|
||||||
|
|
||||||
|
|
||||||
// valueSeries.removePoints(0, 1);
|
|
||||||
// if (insertIdx == 0) {
|
|
||||||
// // first index, we'll have to update the "now" value
|
|
||||||
// valueSeries.insert(0, entry.timestamp.getTime() + 2000, value)
|
|
||||||
// zeroSeries.ensureValue(new Date(entry.timestamp.getTime() + 2000))
|
|
||||||
// }
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var value = entry.values[root.stateType.name]
|
var value = entry.values[root.stateType.name]
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
@ -127,9 +113,12 @@ Item {
|
|||||||
onEntriesRemoved: {
|
onEntriesRemoved: {
|
||||||
print("removing:", index, count, valueSeries.count)
|
print("removing:", index, count, valueSeries.count)
|
||||||
if (root.stateType.type.toLowerCase() == "bool") {
|
if (root.stateType.type.toLowerCase() == "bool") {
|
||||||
valueSeries.removePoints((index * 2) /*+ 1*/, count * 2)
|
valueSeries.removePoints(index * 2, count * 2)
|
||||||
|
if (valueSeries.count == 1) {
|
||||||
|
valueSeries.removePoints(0, 1);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
valueSeries.removePoints(index /*+ 1*/, count)
|
valueSeries.removePoints(index, count)
|
||||||
}
|
}
|
||||||
|
|
||||||
zeroSeries.shrink()
|
zeroSeries.shrink()
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -9,31 +9,37 @@ import QtCharts 2.3
|
|||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
property Thing thing: null
|
implicitHeight: Style.smallIconSize + Style.smallMargins
|
||||||
property string iconName: ""
|
property alias text: textLabel.text
|
||||||
|
property alias iconName: icon.name
|
||||||
property color color: "white"
|
property color color: "white"
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
// opacity: selfProductionConsumptionSeries.opacity
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.topMargin: -Style.smallMargins
|
anchors.topMargin: -Style.smallMargins
|
||||||
anchors.bottomMargin: -Style.smallMargins
|
anchors.bottomMargin: -Style.smallMargins
|
||||||
// onClicked: d.selectSeries(selfProductionConsumptionSeries)
|
|
||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Style.smallMargins
|
spacing: Style.smallMargins
|
||||||
ColorIcon {
|
ColorIcon {
|
||||||
name: root.iconName
|
id: icon
|
||||||
size: Style.smallIconSize
|
size: Style.smallIconSize
|
||||||
color: root.color
|
color: root.color
|
||||||
|
visible: root.iconName != ""
|
||||||
}
|
}
|
||||||
|
Rectangle {
|
||||||
|
width: Style.smallIconSize
|
||||||
|
height: Style.smallIconSize
|
||||||
|
color: root.color
|
||||||
|
visible: root.iconName == ""
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
id: textLabel
|
||||||
width: parent.parent.width - x
|
width: parent.parent.width - x
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
visible: root.width > 60
|
visible: root.width > 60
|
||||||
text: root.thing.name
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
font: Style.smallFont
|
font: Style.smallFont
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user