node-red / node-red-ui-nodes

Additional nodes for Node-RED Dashboard
Apache License 2.0
117 stars 81 forks source link

[node-red-node-ui-vega] Append Data into a Vega Chart #65

Open yasithdev opened 3 years ago

yasithdev commented 3 years ago

Proposed changes

In node-red charts, when new data is received, it automatically appends that to the chart. However, in ui_vega, it requires sending a new vega spec (with the updated data) to achieve this. This introduces a severe lag for a complex spec.

In this PR I added a new function to push just the data into a ui_vega node. This enables adding new data without triggering a full redraw.

How I've done it (at this point) is by sending messages into the node in two forms: templates and data. Initially, I wanted to differentiate between them using msg.topic, but for some reason, it showed up as undefined. For now, I've hacked around it by checking if msg.payload.$schema is present in the payload.

Any design revisions would be appreciated!

Checklist

yasithdev commented 3 years ago

Hello all, any update on this? Please let me know if you suggest any modifications.

dceejay commented 3 years ago

@HiroyasuNishiyama - this looks ok to me - but you guys are the main creators and users of this. OK with you ?