Socket
Socket
Sign inDemoInstall

node-red-contrib-dashboard-bar-chart-data

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.3 to 0.9.4

23

bar-chart-data.js

@@ -31,2 +31,3 @@ module.exports = function(RED) {

var topics = store.get('topics')||[];
var topicsOld = store.get('topics')||[];
//maybe only 1 specific topic should be cleared

@@ -40,12 +41,18 @@ if (msg.topic != "") {

store.set(topics[i] + '_data', {});
store.set(topics[i] + '_data_counter', {});
store.set(topics[i] + '_last', {});
}
//clear data_counter array
var dataCounterNew = [];
if (msg.topic != "" && topicsOld.length > 1) {
dataCounterNew = store.get('data_counter')||[];
dataCounterNew.splice(topicsOld.indexOf(msg.topic),1);
}
store.set('data_counter', dataCounterNew);
//clear topic array (or only specific topic)
var topicsNew = [];
var topicsOld = store.get('topics')||[];
if (msg.topic != "" && topicsOld.length > 1) {
topicsNew = topicsOld;
topicsNew.splice(topicsNew.indexOf(msg.topic),1);
topicsNew.splice(topicsOld.indexOf(msg.topic),1);
}

@@ -71,4 +78,4 @@ store.set('topics', topicsNew);

if (topicData === undefined) { topicData = []; };
for (var i2 = 0; i < topicData.length; i++) {
restoredData[keys[i]] = topicData[i2];
for (var i2 = 0; i2 < topicData.length; i2++) {
restoredData[keys[i2]] = topicData[i2];
}

@@ -78,3 +85,5 @@ topic = topics[i];

store.set(topic + '_data_counter', msg.data_counter[i]);
if (msg.hasOwnProperty("last")) {
if (msg.hasOwnProperty(topic + '_last')) {
store.set(topic + '_last', Number(msg[topic + '_last']));
} else if (msg.hasOwnProperty('last')) {
store.set(topic + '_last', Number(msg.last));

@@ -103,3 +112,3 @@ }

store.set(msg.topic + '_last', reading);
msg.last = reading;
msg[msg.topic + '_last'] = reading;
reading = reading - last;

@@ -106,0 +115,0 @@ }

{
"name": "node-red-contrib-dashboard-bar-chart-data",
"version": "0.9.3",
"version": "0.9.4",
"description": "Transforms sensor measurements or meter readings to be displayed in dashboard-chart as bar-chart",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/arneman/node-red-contrib-dashboard-bar-chart-data",

@@ -64,4 +64,4 @@ # node-red-contrib-dashboard-bar-chart-data

<dl>
<dd>A message with the payload "clear" and the same topic like the sensor messages will reset the data for this sensor/topic.
A message with "clear" without a topic (empty string) will delete all data, so that the chart will be blank again.<br>
<dd>A message with the payload "clear" and the same topic like the sensor will reset the data for this specific sensor only.
A message with the payload "clear" without a topic (empty string) will delete all data, so that the chart will be blank again.<br>
If you put the output of this node to the input of this node (via <code>persist node</code>), the data will be restored.

@@ -68,0 +68,0 @@ This could be helpful to avoid getting a blank bar-chart after node-red has been restarted (reboot).

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc