Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ui_gauge.js 883B

12345678910111213141516171819202122232425262728
  1. module.exports = function (RED) {
  2. function GaugeNode (config) {
  3. RED.nodes.createNode(this, config)
  4. const node = this
  5. // which group are we rendering this widget
  6. const group = RED.nodes.getNode(config.group)
  7. const evts = {
  8. onChange: true
  9. }
  10. // ensure values are numerical, not strings
  11. config.min = Number(config.min)
  12. config.max = Number(config.max)
  13. config.sizeThickness = Number(config.sizeThickness)
  14. config.sizeGap = Number(config.sizeGap)
  15. config.sizeKeyThickness = Number(config.sizeKeyThickness)
  16. config.segments.forEach(segment => {
  17. segment.from = Number(segment.from)
  18. })
  19. // inform the dashboard UI that we are adding this node
  20. group.register(node, config, evts)
  21. }
  22. RED.nodes.registerType('ui-gauge', GaugeNode)
  23. }