Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add valueMapping support. #35

Merged
merged 1 commit into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@ animated lines that are controllable via 'direction' and 'duration' attributes.
change adds yaml config to drive these animations off of data. When such config is
present a play/pause button is always added to the panel to ensure the panel is usable
by all. New config terms:
- cells.cell-name.flowAnimation.dataRef
- cells.cell-name.flowAnimation.datapoint
- cells.cell-name.flowAnimation.thresholdOffValue
- cells.cell-name.flowAnimation.thresholdLwrValue
- cells.cell-name.flowAnimation.thresholdLwrDurationSecs
- cells.cell-name.flowAnimation.thresholdUprValue
- cells.cell-name.flowAnimation.thresholdUprDurationSecs
- cells.cell-name.flowAnimation.unidirectional
- cells.cell-name.flowAnimation

As well as provisioning dashboards, the above functionality is demonstrated in example 4:
- svg: https://raw.githubusercontent.com/andymchugh/andrewbmchugh-flow-panel/main/examples/darkThemeSvg4.svg
Expand All @@ -30,6 +23,18 @@ One Datapoint Interpolation fix
-------------------------------
Fixes a bug with timeSeries interpolation which resulted in no data when the timeSeries only had a single datapoint.

Value Mappings Support
----------------------
This allows you to configure a custom value based on data-match criteria. i.e. if your data is 0, 1, 2 you can use
this configuration to replace the 'label' text with 'auto', open', 'closed'. The criteria you can use to match are:
- exact value match
- range match
- partial range match.

New panelConfig terms:
- cells.cell-name.label.valueMappings
- cells.cell-name.label.valueMappingsRef

## 1.10.0
Increases the range of SVG shape support by relaxing the expected DOM element
hierachy.
Expand Down
4 changes: 4 additions & 0 deletions provisioning/dashboardData/dataMappings.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions provisioning/dashboardData/dataMappings.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---

#------------------------------------------------------------------------------
# YAML Aliases to simplify maintenance

test:
testDataExtendedZero: true

anchorLinks:
- valueMappings: &valuemap1
- {value: null, text: "panel null"}
- {value: 0, text: "panel off"}
- {valueMax: 300, text: "panel low"}
- {valueMin: 300, valueMax: 600, text: "panel medium"}
- {valueMin: 600, text: "panel high"}
- thresholds: &thresholds
- {color: "green", level: 0}
- {color: "orange", level: 500}
- {color: "red", level: 1000}

#------------------------------------------------------------------------------
# Panel Config

cellIdPreamble: "cell-"
gradientMode: "hue"
cells:
dbtrans1:
dataRef: "test-data-large-cos"
label:
separator: "replace"
units: "ops"
valueMappings: *valuemap1
labelColor:
thresholds: *thresholds
dbtrans2:
dataRef: "test-data-large-cos"
label:
separator: "cr"
units: "ops"
fillColor:
thresholds: *thresholds
dbtrans3:
dataRef: "test-data-large-cos"
label:
separator: "replace"
units: "ops"
valueMappingsRef: "dbTrans"
labelColor:
thresholds: *thresholds
dbtrans4:
dataRef: "test-data-large-cos"
label:
separator: "cr"
units: "ops"
fillColor:
thresholds: *thresholds
14 changes: 14 additions & 0 deletions provisioning/dashboardData/dataMappingsSite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

colors:
red: "#DD0000"
amber: "#CC8C00"
green: "#00AA00"

valueMappings:
dbTrans:
- {value: null, text: "site null"}
- {value: 0, text: "site off"}
- {valueMax: 300, text: "site low"}
- {valueMin: 300, valueMax: 600, text: "site medium"}
- {valueMin: 600, text: "site high"}
57 changes: 57 additions & 0 deletions provisioning/dashboardData/dataMappings_sparse.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---

#------------------------------------------------------------------------------
# YAML Aliases to simplify maintenance

test:
testDataExtendedZero: true
testDataSparse: true

anchorLinks:
- valueMappings: &valuemap1
- {value: null, text: "panel null"}
- {value: 0, text: "panel off"}
- {valueMax: 300, text: "panel low"}
- {valueMin: 300, valueMax: 600, text: "panel medium"}
- {valueMin: 600, text: "panel high"}
- thresholds: &thresholds
- {color: "green", level: 0}
- {color: "orange", level: 500}
- {color: "red", level: 1000}

#------------------------------------------------------------------------------
# Panel Config

cellIdPreamble: "cell-"
gradientMode: "hue"
cells:
dbtrans1:
dataRef: "test-data-large-cos"
label:
separator: "replace"
units: "ops"
valueMappings: *valuemap1
labelColor:
thresholds: *thresholds
dbtrans2:
dataRef: "test-data-large-cos"
label:
separator: "cr"
units: "ops"
fillColor:
thresholds: *thresholds
dbtrans3:
dataRef: "test-data-large-cos"
label:
separator: "replace"
units: "ops"
valueMappingsRef: "dbTrans"
labelColor:
thresholds: *thresholds
dbtrans4:
dataRef: "test-data-large-cos"
label:
separator: "cr"
units: "ops"
fillColor:
thresholds: *thresholds
Loading
Loading