2023年9月30日 星期六

Node-RED Dashboard Chart types

 Node-RED Dashboard Chart types





節點

設定

 function

Fill Single Chart Array

var chart = [{

    "series":["A"],

    "data":[[{"x":1504029632890,"y":5},

             {"x":1504029633514,"y":8},

             {"x":1504029634400,"y":3}]],

    "labels":[""]

}];

msg.payload = chart;

 

return msg;

function

 

Fill Multiple Line Chart Array

var chart = [  {"series":["A","B","C"],

                "data":[

                    [{"x":1504029632890,"y":5},

                     {"x":1504029636001,"y":4},

                     {"x":1504029638656,"y":2}],

                    [{"x":1504029633514,"y":6},

                     {"x":1504029636622,"y":7},

                     {"x":1504029639539,"y":6}],

                    [{"x":1504029634400,"y":7},

                     {"x":1504029637959,"y":9},

                     {"x":1504029640317,"y":7}]

                ],

                "labels":[""]}];

msg.payload = chart;

 

return msg;

function

Fill Pie Chart Array

var pie={};

pie.labels = ["Geo1","Geo2","Geo3","Geo4","Geo5"];

pie.series = ['Sales A', 'Sales B', 'Sales C', 'Sales D'];

pie.data =   [ [16, 27, 42, 65, 89] ];

//return {payload:[pie]};

 

var pie={ "labels" : ["Geo1","Geo2","Geo3","Geo4","Geo5"],

          "series" : ['Sales A', 'Sales B', 'Sales C', 'Sales D'],

          "data"   : [ [16, 27, 42, 65, 89] ]

        };

msg.payload = [pie];

return msg;

function

Fill Bar Chart Array

var bar={};

bar.labels = ["Q1 16","Q2 16","Q3 16","Q4 16","Q1 17","Q2 17","Q3 17"];

bar.series = ['Sales A', 'Sales B', 'Sales C', 'Sales D'];

// An array of 4 arrays of 7 elements

bar.data = [

    [65, 59, 80, 81, 56, 55, 40],

    [28, 48, 40, 19, 86, 27, 90],

    [38, 28, 20, 49, 45, 60, 20],

    [58, 18, 40, 29, 15, 30, 60]

  ];

return {payload:[bar]};

 

[{"id":"38fac2c5.ead426","type":"ui_chart","z":"12c413b5.585494","name":"","group":"89bfd092.f8bc18","order":0,"width":0,"height":0,"label":"Single Line Plot","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":600,"y":120,"wires":[[]]},{"id":"8b1422bb.731af","type":"function","z":"12c413b5.585494","name":"Fill Single Chart Array","func":"var chart = [{\n    \"series\":[\"A\"],\n    \"data\":[[{\"x\":1504029632890,\"y\":5},\n             {\"x\":1504029633514,\"y\":8},\n             {\"x\":1504029634400,\"y\":3}]],\n    \"labels\":[\"\"]\n}];\nmsg.payload = chart;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":120,"wires":[["38fac2c5.ead426","f7e82408.b55a9"]]},{"id":"f7e82408.b55a9","type":"debug","z":"12c413b5.585494","name":"","active":true,"console":"false","complete":"false","x":590,"y":160,"wires":[]},{"id":"ce4074ce.08a8d","type":"comment","z":"12c413b5.585494","name":"Sample Dashboard that plots various Chart types","info":"","x":250,"y":60,"wires":[]},{"id":"40f701a5.4c0628","type":"ui_chart","z":"12c413b5.585494","name":"","group":"89bfd092.f8bc18","order":0,"width":0,"height":0,"label":"Multiple Line Plots","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":610,"y":220,"wires":[[],[]]},{"id":"5ac8ae9e.8497b8","type":"function","z":"12c413b5.585494","name":"Fill Multiple Line Chart Array","func":"var chart = [  {\"series\":[\"A\",\"B\",\"C\"],\n                \"data\":[\n                    [{\"x\":1504029632890,\"y\":5},\n                     {\"x\":1504029636001,\"y\":4},\n                     {\"x\":1504029638656,\"y\":2}],\n                    [{\"x\":1504029633514,\"y\":6},\n                     {\"x\":1504029636622,\"y\":7},\n                     {\"x\":1504029639539,\"y\":6}],\n                    [{\"x\":1504029634400,\"y\":7},\n                     {\"x\":1504029637959,\"y\":9},\n                     {\"x\":1504029640317,\"y\":7}]\n                ],\n                \"labels\":[\"\"]}];\nmsg.payload = chart;\n\nreturn msg;","outputs":1,"noerr":0,"x":340,"y":220,"wires":[["40f701a5.4c0628","2b3c03cd.9670ac"]]},{"id":"2b3c03cd.9670ac","type":"debug","z":"12c413b5.585494","name":"","active":true,"console":"false","complete":"false","x":590,"y":260,"wires":[]},{"id":"b54397da.7d3c2","type":"ui_chart","z":"12c413b5.585494","name":"","group":"d6d5b6c0.39742","order":0,"width":0,"height":0,"label":"Vertical Bar Chart","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":610,"y":540,"wires":[[],[]]},{"id":"80a37865.9a196","type":"inject","z":"12c413b5.585494","name":"","repeat":"","crontab":"","once":true,"topic":"","payload":"true","payloadType":"bool","x":130,"y":120,"wires":[["8b1422bb.731af"]]},{"id":"e1c92e88.851f","type":"inject","z":"12c413b5.585494","name":"","repeat":"","crontab":"","once":true,"topic":"","payload":"true","payloadType":"bool","x":130,"y":220,"wires":[["5ac8ae9e.8497b8"]]},{"id":"2cc30253.462f36","type":"inject","z":"12c413b5.585494","name":"","repeat":"","crontab":"","once":true,"topic":"","payload":"true","payloadType":"bool","x":130,"y":540,"wires":[["8eb046bd.518a18"]]},{"id":"8eb046bd.518a18","type":"function","z":"12c413b5.585494","name":"Fill Bar Chart Array","func":"var bar={};\nbar.labels = [\"Q1 16\",\"Q2 16\",\"Q3 16\",\"Q4 16\",\"Q1 17\",\"Q2 17\",\"Q3 17\"];\nbar.series = ['Sales A', 'Sales B', 'Sales C', 'Sales D'];\n// An array of 4 arrays of 7 elements\nbar.data = [\n    [65, 59, 80, 81, 56, 55, 40],\n    [28, 48, 40, 19, 86, 27, 90],\n    [38, 28, 20, 49, 45, 60, 20],\n    [58, 18, 40, 29, 15, 30, 60]\n  ];\nreturn {payload:[bar]};","outputs":1,"noerr":0,"x":310,"y":540,"wires":[["b54397da.7d3c2","b0740d24.5c6a48","36e16af3.974c66"]]},{"id":"b0740d24.5c6a48","type":"debug","z":"12c413b5.585494","name":"","active":true,"console":"false","complete":"false","x":590,"y":620,"wires":[]},{"id":"36e16af3.974c66","type":"ui_chart","z":"12c413b5.585494","name":"","group":"d6d5b6c0.39742","order":0,"width":0,"height":0,"label":"Horizontal Bar Chart","chartType":"horizontalBar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"100","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":619.0908813476562,"y":580,"wires":[[],[]]},{"id":"de99a184.f909b","type":"ui_chart","z":"12c413b5.585494","name":"","group":"5c2f5188.6d47f8","order":1,"width":0,"height":0,"label":"Pie Chart","chartType":"pie","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":580,"y":320,"wires":[[],[]]},{"id":"6734c083.6a93c","type":"function","z":"12c413b5.585494","name":"Fill Pie Chart Array","func":"var pie={};\npie.labels = [\"Geo1\",\"Geo2\",\"Geo3\",\"Geo4\",\"Geo5\"];\npie.series = ['Sales A', 'Sales B', 'Sales C', 'Sales D'];\npie.data =   [ [16, 27, 42, 65, 89] ];\n//return {payload:[pie]};\n\nvar pie={ \"labels\" : [\"Geo1\",\"Geo2\",\"Geo3\",\"Geo4\",\"Geo5\"],\n          \"series\" : ['Sales A', 'Sales B', 'Sales C', 'Sales D'],\n          \"data\"   : [ [16, 27, 42, 65, 89] ]\n        };\nmsg.payload = [pie];\nreturn msg;","outputs":1,"noerr":0,"x":310,"y":320,"wires":[["de99a184.f909b","61bb503e.6ca1","37648ff7.3d875","74e87c77.7a50dc","ba58094c.aab88"]]},{"id":"c6277148.aa5538","type":"inject","z":"12c413b5.585494","name":"","repeat":"","crontab":"","once":true,"topic":"","payload":"true","payloadType":"bool","x":130,"y":320,"wires":[["6734c083.6a93c"]]},{"id":"61bb503e.6ca1","type":"debug","z":"12c413b5.585494","name":"","active":true,"console":"false","complete":"false","x":590,"y":480,"wires":[]},{"id":"37648ff7.3d875","type":"ui_chart","z":"12c413b5.585494","name":"","group":"5c2f5188.6d47f8","order":3,"width":0,"height":0,"label":"Polar Area Chart","chartType":"polar-area","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":610,"y":400.9090881347656,"wires":[[],[]]},{"id":"ba58094c.aab88","type":"ui_chart","z":"12c413b5.585494","name":"","group":"5c2f5188.6d47f8","order":4,"width":0,"height":0,"label":"Radar Chart","chartType":"radar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":590,"y":440,"wires":[[],[]]},{"id":"74e87c77.7a50dc","type":"ui_chart","z":"12c413b5.585494","name":"","group":"5c2f5188.6d47f8","order":2,"width":0,"height":0,"label":"Donut Chart","chartType":"pie","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":"40","useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":590,"y":360,"wires":[[],[]]},{"id":"89bfd092.f8bc18","type":"ui_group","name":"Line Chart Examples","tab":"642c5bf0.321384","order":1,"disp":true,"width":"8"},{"id":"d6d5b6c0.39742","type":"ui_group","name":"Bar Chart Examples","tab":"642c5bf0.321384","order":3,"disp":true,"width":"8"},{"id":"5c2f5188.6d47f8","type":"ui_group","name":"Pie Chart Examples","tab":"642c5bf0.321384","order":2,"disp":true,"width":"6"},{"id":"642c5bf0.321384","type":"ui_tab","name":"Chart Examples","icon":"fa-area-chart","order":1}]

沒有留言:

張貼留言

WOKWI LED + MQTT Node-Red SQLite

WOKWI LED + MQTT Node-Red SQLite const char *mqtt_broker = "broker.mqtt-dashboard.com" ; const char *topic1 = "alex9ufo/e...