node-red-contrib-data-view
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -7,2 +7,3 @@ module.exports = function(RED) { | ||
this.passthru = config.passthru; | ||
this.property = config.property || 'payload'; | ||
@@ -44,3 +45,5 @@ var node = this; | ||
if (this.active !== true) { return; } | ||
if (msg.payload == null) { // null or undefined | ||
let value = msg[node.property]; | ||
if (value == null) { // null or undefined | ||
clearError(); | ||
@@ -50,4 +53,4 @@ sendDataToClient(null, msg); // delete chart | ||
} | ||
if (typeof msg.payload !== 'number') { | ||
handleError('payload is not a number', msg, 'payload is not a number'); | ||
if (typeof value !== 'number') { | ||
handleError(`msg.${node.property} is not a number`, msg, `msg.${node.property} is not a number`); | ||
return; | ||
@@ -58,3 +61,3 @@ } | ||
data = { | ||
value: msg.payload, | ||
value, | ||
time: new Date() | ||
@@ -61,0 +64,0 @@ } |
{ | ||
"name": "node-red-contrib-data-view", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Easy way of previewing live data in your flows", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# node-red-contrib-data-view | ||
Node-RED node to preview data with a simple line chart inside the Node-RED flow editor. This node was inspired by the simple image preview node `node-red-contrib-image-output`. | ||
Currently the node expects the input `msg.payload` to contain a number value. The node will then create a line chart in the flow editor under the node displaying values received over time. | ||
The node expects the input `msg.payload` or other specified property of the input message to contain a number value. The node will then generate a line chart in the flow editor under the node displaying values received over time. | ||
@@ -19,3 +19,3 @@ > NOTE: This node is a work in progress. The intended use case for this node is for simple demos and debugging. The state of the chart is currently maintained in the client, so that refreshing the page, or opening a new view on the flow will cause the chart to reset. I expect to add additional chart options, chart types and support different shapes of data. Feedback is welcome. | ||
The following example demonstrates how to inject numbers into the node to generate charts. To clear a chart, send a null or undefined <code>msg.payload</code> value as shown. | ||
The following example demonstrates how to inject numbers into the node to generate charts. To clear a chart, send a null or undefined <code>msg.payload</code> value as shown, or click on the trash button in the top right corner. | ||
@@ -29,2 +29,5 @@ ``` | ||
## Node configuration | ||
### Property | ||
Choose the message property containing the value to plot, `msg.payload` by default. | ||
### Height | ||
@@ -31,0 +34,0 @@ The height (in pixels) of the chart. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37259
83
46