node-red-ui-nodes
node-red-ui-nodes copied to clipboard
[node-red-node-ui-vega] Append Data into a Vega Chart
- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
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
- [x] I have read the contribution guidelines
- [ ] For non-bugfix PRs, I have discussed this change on the forum/slack team.
- [ ] I have run
gruntto verify the unit tests pass - [ ] I have added suitable unit tests to cover the new/changed functionality
Hello all, any update on this? Please let me know if you suggest any modifications.
@HiroyasuNishiyama - this looks ok to me - but you guys are the main creators and users of this. OK with you ?