-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #194 from flowforge/122-chart-server-state
Adds ui-chart history-based state recording, adding time-axis, duration limit & fix line overshoot
- Loading branch information
Showing
16 changed files
with
624 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
--- | ||
props: | ||
Group: Defines which group of the UI Dashboard this widget will render in. | ||
Size: Controls the width of the button with respect to the parent group. Maximum value is the width of the group. | ||
Label: The text shown within the button. | ||
Class: The text shown within the button. | ||
Chart Type: Line | Bar | Scatter | ||
X-Axis Type: Timescale | Linear | Categorical | ||
X-Axis Limit: Any data that is before the specific time limit (for time charts) or where there are more data points than the limit specified will be removed from the chart. | ||
--- | ||
|
||
# Chart `ui-chart` | ||
|
||
Provides configuration options to create the following chart types: | ||
|
||
- [Line Chart](#line-chart) | ||
- [Scatter Plot](#scatter-plot) | ||
- [Bar Chart](#bar-graph) | ||
|
||
## Properties | ||
|
||
<PropsTable/> | ||
|
||
## Controls | ||
|
||
### Removing Data | ||
|
||
In order to remove all data from a chart you can send a `msg.payload` of `[]` to the node. | ||
|
||
Most commonly, this is done by wiring a `ui-button` to the `ui-chart` node and configuring the button to send a JSON payload with a value of `[]`. | ||
|
||
|
||
## Chart Types | ||
|
||
### Line Chart | ||
|
||
![Example of a Line Chart](../../assets/images/node-examples/ui-chart-line.png "Example of a Line Chart"){data-zoomable} | ||
*Example of a rendered line chart with a "time" x-axis.* | ||
|
||
#### Payloads | ||
|
||
Line Charts accept a variety of payload formats. The following are all valid: | ||
|
||
- `msg.payload = <value>` | ||
- In this case, the value received by the chart will be used as a `y` value, and the `x` value will be automatically added as the current date/time. | ||
- `msg.payload = { y: <value> }` | ||
- In this case, the `y` value will be used as defined, and the `x` value will be calculated as the current date/time. | ||
- `msg.payload = { x: <value>, y: <value> }` | ||
- In this case, the `x` and `y` values will be used as the `x` and `y` values of the data point. | ||
|
||
#### Multiple Lines | ||
|
||
If you would like to plot multiple lines on the same chart, you can do so by including a `msg.topic` alongside the relevant `msg.payload`, e.g: | ||
|
||
```json | ||
{ | ||
"topic": "line-1", | ||
"payload": 1 | ||
} | ||
``` | ||
|
||
```json | ||
{ | ||
"topic": "line-2", | ||
"payload": 2 | ||
} | ||
``` | ||
|
||
### Scatter Plot | ||
|
||
![Example of a Scatter Plot](../../assets/images/node-examples/ui-chart-scatter.png "Example of a Scatter Plot"){data-zoomable} | ||
*Example of a rendered scatter plot with a "time" x-axis.* | ||
|
||
#### Payloads | ||
|
||
Scatter Plots accept a variety of payload formats. The following are all valid: | ||
|
||
- `msg.payload = <value>` | ||
- In this case, the value received by the chart will be used as a `y` value, and the `x` value will be automatically added as the current date/time. | ||
- `msg.payload = { y: <value> }` | ||
- In this case, the `y` value will be used as defined, and the `x` value will be calculated as the current date/time. | ||
- `msg.payload = { x: <value>, y: <value> }` | ||
- In this case, the `x` and `y` values will be used as the `x` and `y` values of the data point. | ||
|
||
### Bar Graph | ||
|
||
![Example of a Bar Graph](../../assets/images/node-examples/ui-chart-bar.png "Example of a Bar Graph"){data-zoomable} | ||
*Example of a rendered bar graph.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
<script type="text/html" data-help-name="ui-chart"> | ||
<h3>Properties</h3> | ||
<dl class="message-properties"> | ||
<dt>Label <span class="property-type">str</span></dt> | ||
<dd>Text shown above the rendered chart in the Dashboard.</dd> | ||
<dt>Type <span class="property-type">line | bar | scatter</span></dt> | ||
<dd>Choose the type of graph that you wish to render data with. Note | ||
that different data structures are accepted for different chart types.</dd> | ||
<dt>X-Axis Type <span class="property-type">linear | categorical | time</span></dt> | ||
<dd> For charts with an x-axis, this option allows customisation | ||
of the type of axis to render.</dd> | ||
</dl> | ||
<h3>Input</h3> | ||
<p>Data can be passed into the Chart node in a variety of formats, | ||
depending on the "X-Axis Type" (e.g. linear, categorical, time).</p> | ||
<dl class="message-properties"> | ||
<dt>Numerical <span class="property-type">linear | categorical | time</span></dt> | ||
<dd><pre>msg.payload = 5</pre> A single value, that will be plotted | ||
in the y-axis, and the current time of injection as the x-value.</dd> | ||
<dt>Series <span class="property-type">linear | categorical | time</span></dt> | ||
<dd><pre>msg.topic = 'Series 1'</pre> Multiple series can | ||
be shown on the same chart by using a different msg.topic value on each | ||
input message.</dd> | ||
<dt>Object <span class="property-type">linear</span></dt> | ||
<dd><pre>msg.payload = {x: 10, y: 15}</pre>This type of data is only | ||
supported on linear plots, e.g. "Line" or "Scatter" charts.</dd> | ||
</dl> | ||
<h3>Details</h3> | ||
<p></p> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"ui-chart": { | ||
"label": { | ||
"seriesColours": "Series Colors", | ||
"seconds": "Seconds", | ||
"minutes": "Minutes", | ||
"hours": "Hours", | ||
"days": "Days", | ||
"weeks": "Weeks", | ||
"or": "OR", | ||
"points": "points", | ||
"xLimit": "X-Axis Limit", | ||
"xType": "X-Axis Type", | ||
"last": "last" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.