Improve ac charts
parent
0e5619b4f9
commit
edbda7abda
|
|
@ -71,12 +71,6 @@ Item {
|
|||
|
||||
onEntriesAdded: {
|
||||
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++) {
|
||||
var entry = entries[i]
|
||||
// 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+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 {
|
||||
var value = entry.values[root.stateType.name]
|
||||
if (value == null) {
|
||||
|
|
@ -127,9 +113,12 @@ Item {
|
|||
onEntriesRemoved: {
|
||||
print("removing:", index, count, valueSeries.count)
|
||||
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 {
|
||||
valueSeries.removePoints(index /*+ 1*/, count)
|
||||
valueSeries.removePoints(index, count)
|
||||
}
|
||||
|
||||
zeroSeries.shrink()
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -9,31 +9,37 @@ import QtCharts 2.3
|
|||
|
||||
Item {
|
||||
id: root
|
||||
property Thing thing: null
|
||||
property string iconName: ""
|
||||
implicitHeight: Style.smallIconSize + Style.smallMargins
|
||||
property alias text: textLabel.text
|
||||
property alias iconName: icon.name
|
||||
property color color: "white"
|
||||
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: root.iconName
|
||||
id: icon
|
||||
size: Style.smallIconSize
|
||||
color: root.color
|
||||
visible: root.iconName != ""
|
||||
}
|
||||
Rectangle {
|
||||
width: Style.smallIconSize
|
||||
height: Style.smallIconSize
|
||||
color: root.color
|
||||
visible: root.iconName == ""
|
||||
}
|
||||
|
||||
Label {
|
||||
id: textLabel
|
||||
width: parent.parent.width - x
|
||||
elide: Text.ElideRight
|
||||
visible: root.width > 60
|
||||
text: root.thing.name
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font: Style.smallFont
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue