2022年2月27日 星期日

Node-RED-Dashboard Charts

 Node-RED-Dashboard Charts

源自於 https://github.com/node-red/node-red-dashboard/blob/master/Charts.md#stored-data



[{"id":"50a1210db09651cd","type":"function","z":"7a7c463842e7e83e","name":"","func":"var m={};\nvar max=100,min=1;\nvar numbers = [0,0,0,0,0,0,0,\n               0,0,0,0,0,0,0,\n               0,0,0,0,0,0,0 ];    \n \nfor (let i = 0; i < 21 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\nm.labels = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\"];\nm.series = ['Series A', 'Series B', 'Series C'];\nm.data = [\n    [numbers[0], numbers[1],numbers[2],numbers[3], numbers[4], numbers[5], numbers[6]],\n    [numbers[7], numbers[8],numbers[9],numbers[10], numbers[11], numbers[12], numbers[13]],\n    [numbers[14], numbers[5],numbers[16],numbers[17], numbers[18], numbers[19], numbers[20]]\n  ];\nreturn {payload:[m]};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":380,"wires":[["a5eb6044d0f6684c","dfa48a2208ec804e","4a7cd4e2e4544212","07faa46aad4cfc35"]]},{"id":"a5eb6044d0f6684c","type":"ui_chart","z":"7a7c463842e7e83e","name":"","group":"89749fb7.87f01","order":1,"width":0,"height":0,"label":"line chart","chartType":"line","legend":"false","xformat":"auto","interpolate":"linear","nodata":"No Data","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":580,"y":120,"wires":[[]]},{"id":"0f12d543c08262aa","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=100,min=1;\nvar numbers = [0,0,0,0,0,0,0,0,0];\nfor (let i = 0; i < 10 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar chart = [{\n    \"series\":[\"A\",\"B\",\"C\"],\n    \"data\":[[{\"x\":1504029632890,\"y\":numbers[0]},\n    {\"x\":1504029636001,\"y\":numbers[1]},\n    {\"x\":1504029638656,\"y\":numbers[2]}],\n    [{\"x\":1504029633514,\"y\":numbers[3]},\n    {\"x\":1504029636622,\"y\":numbers[4]},\n    {\"x\":1504029639539,\"y\":numbers[5]}],\n    [{\"x\":1504029634400,\"y\":numbers[6]},\n    {\"x\":1504029637959,\"y\":numbers[7]},\n    {\"x\":1504029640317,\"y\":numbers[8]}]],\n    \"labels\":[\"\"]\n}];\nmsg.payload = chart;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":220,"wires":[["a5eb6044d0f6684c"]]},{"id":"ad467b317b1f8f86","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":1,"width":0,"height":0,"passthru":false,"label":"Time Line 1","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":170,"y":220,"wires":[["0f12d543c08262aa"]]},{"id":"dfa48a2208ec804e","type":"ui_chart","z":"7a7c463842e7e83e","name":"","group":"89749fb7.87f01","order":2,"width":0,"height":0,"label":"bar chart","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"No Data","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"x":580,"y":180,"wires":[[]]},{"id":"41aea532fe90fff1","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":5,"width":0,"height":0,"passthru":false,"label":"array","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":150,"y":380,"wires":[["50a1210db09651cd"]]},{"id":"0414f8cd74349a8f","type":"random","z":"7a7c463842e7e83e","name":"","low":"1","high":"10000000","inte":"true","x":340,"y":580,"wires":[["a5eb6044d0f6684c"]]},{"id":"cb1a82121119b1ed","type":"inject","z":"7a7c463842e7e83e","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"str","x":170,"y":580,"wires":[["0414f8cd74349a8f"]]},{"id":"b8381988437dbd67","type":"function","z":"7a7c463842e7e83e","name":"","func":"var m={};\nm.labels = [10,20,30,40,50,60,70];\nm.series = ['Series A', 'Series B', 'Series C', 'Series D'];\nm.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:[m]};","outputs":1,"noerr":0,"x":310,"y":420,"wires":[["a5eb6044d0f6684c","dfa48a2208ec804e","4a7cd4e2e4544212","07faa46aad4cfc35"]]},{"id":"35afc255ab9e508f","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":6,"width":0,"height":0,"passthru":false,"label":"array2","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":150,"y":420,"wires":[["b8381988437dbd67"]]},{"id":"c64cd847625ed238","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=100,min=1;\nvar numbers = [0,0,0,0,0,0,0,0,0];\nfor (let i = 0; i < 10 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar chart = [{\n    \"series\":[\"A\",\"B\",\"C\"],\n        \"data\":[[{\"x\":1,\"y\":numbers[0]},\n        {\"x\":2,\"y\":numbers[1]},\n        {\"x\":3,\"y\":numbers[2]}],\n        [{\"x\":4,\"y\":numbers[3]},\n        {\"x\":5,\"y\":numbers[4]},\n        {\"x\":6,\"y\":numbers[5]}],\n        [{\"x\":7,\"y\":numbers[6]},\n        {\"x\":8,\"y\":numbers[7]},\n        {\"x\":9,\"y\":numbers[8]}]],\n    \"labels\":[\"\"]\n}];\nmsg.payload = chart;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":260,"wires":[["a5eb6044d0f6684c"]]},{"id":"a4f25167d6ad788c","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":2,"width":0,"height":0,"passthru":false,"label":"Time Line 2","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":170,"y":260,"wires":[["c64cd847625ed238"]]},{"id":"05803022ed50a92b","type":"function","z":"7a7c463842e7e83e","name":"","func":"var m = {};\nm.labels = [\"Download\", \"In-Store\", \"Mail-Order\"];\nm.data = [[300, 500, 100]];\nm.series = [\"Sales\"];\nreturn {payload:[m],topic:msg.topic};","outputs":1,"noerr":0,"x":330,"y":620,"wires":[["07faa46aad4cfc35","dfa48a2208ec804e","a5eb6044d0f6684c","0e2a31d593ad4b65","d12e7d99388993cb","4a7cd4e2e4544212"]]},{"id":"07faa46aad4cfc35","type":"ui_chart","z":"7a7c463842e7e83e","name":"pie chart","group":"89749fb7.87f01","order":3,"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":"30","useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":620,"y":360,"wires":[[],[]]},{"id":"3e3832632da2a429","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":10,"width":0,"height":0,"passthru":false,"label":"array for pie","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"Pie 4 T","x":170,"y":620,"wires":[["05803022ed50a92b"]]},{"id":"40bcc2be7c742c2e","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=10,min=1;\nvar numbers = [0,0,0,0,0,0,0,0,0];\nfor (let i = 0; i < 10 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar chart = [{\n    \"series\":[\"A\",\"B\",\"C\"],\n        \"data\":[[{\"x\":1000000,\"y\":numbers[0]},\n        {\"x\":2000000,\"y\":numbers[1]},\n        {\"x\":3000000,\"y\":numbers[2]}],\n        [{\"x\":4000000,\"y\":numbers[3]},\n        {\"x\":5000000,\"y\":numbers[4]},\n        {\"x\":6000000,\"y\":numbers[5]}],\n        [{\"x\":7000000,\"y\":numbers[6]},\n        {\"x\":8000000,\"y\":numbers[7]},\n        {\"x\":9000000,\"y\":numbers[8]}]],\n    \"labels\":[\"\"]\n}];\nmsg.payload = chart;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":300,"wires":[["a5eb6044d0f6684c"]]},{"id":"8ae991f172c90b69","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":3,"width":0,"height":0,"passthru":false,"label":"Time Line 3","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":170,"y":300,"wires":[["40bcc2be7c742c2e"]]},{"id":"abb8842ceb107df1","type":"function","z":"7a7c463842e7e83e","name":"","func":"var chart = [{\n    \"series\":[\"A\",\"B\",\"C\"],\n        \"data\":[[{\"x\":1000000000,\"y\":5},\n        {\"x\":2000000000,\"y\":4},\n        {\"x\":3000000000,\"y\":2}],\n        [{\"x\":4000000000,\"y\":6},\n        {\"x\":5000000000,\"y\":7},\n        {\"x\":6000000000,\"y\":6}],\n        [{\"x\":7000000000,\"y\":7},\n        {\"x\":8000000000,\"y\":9},\n        {\"x\":9000000000,\"y\":7}]],\n    \"labels\":[\"\"]\n}];\nmsg.payload = chart;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":340,"wires":[["a5eb6044d0f6684c"]]},{"id":"585ca190f53a05e9","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":4,"width":0,"height":0,"passthru":false,"label":"Time Line 4","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":170,"y":340,"wires":[["abb8842ceb107df1"]]},{"id":"6e0e17374faa2658","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=10,min=1;\nvar numbers = [0,0,0,0,0,0,0,0,0];\nfor (let i = 0; i < 10 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar m={\n    \"series\":[\"X\",\"Y\",\"Z\"],\n    \"data\":[ [ numbers[0],numbers[1],numbers[2] ],[numbers[3],numbers[4],numbers[5]], [numbers[6],numbers[7],numbers[8]]],\n    \"labels\":[\"Jan\",\"Feb\",\"Mar\"]\n};\nreturn {payload:[m]};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":540,"wires":[["a5eb6044d0f6684c","dfa48a2208ec804e","07faa46aad4cfc35","0e2a31d593ad4b65","d12e7d99388993cb","4a7cd4e2e4544212"]]},{"id":"830bfd76d9dc12a2","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":9,"width":0,"height":0,"passthru":false,"label":"array3c","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":160,"y":540,"wires":[["6e0e17374faa2658"]]},{"id":"65d10c57fbcbafae","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":11,"width":0,"height":0,"passthru":false,"label":"array 2 for pie","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"Pie Hole","x":180,"y":660,"wires":[["bce1e6436342529a"]]},{"id":"bce1e6436342529a","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=100,min=10;\nvar numbers = [0,0,0,0,0,0,0];\nfor (let i = 0; i < 8 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar m = {};\nm.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];\n//m.data = [[28, 48, 40, 19, 86, 27, 90]];\nm.data = [[numbers[0],numbers[1],numbers[2],numbers[3],numbers[4],numbers[5],numbers[6]]];\nm.series = ['Series A'];\nreturn {payload:[m],topic:msg.topic};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":330,"y":660,"wires":[["07faa46aad4cfc35","dfa48a2208ec804e","d12e7d99388993cb","0e2a31d593ad4b65","a5eb6044d0f6684c","4a7cd4e2e4544212"]]},{"id":"dac9efd322e462ed","type":"function","z":"7a7c463842e7e83e","name":"topic","func":"var max=100,min=0;\nvar numbers = [0,0,0];\nfor (let i = 0; i < 3 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\nvar m = [\n    {topic:\"X\", payload:numbers[0]},\n    {topic:\"Y\", payload:numbers[1]},\n    {topic:\"Z\", payload:numbers[2]}\n    ];\nreturn [m];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":180,"wires":[["dfa48a2208ec804e","07faa46aad4cfc35","a5eb6044d0f6684c","4a7cd4e2e4544212"]]},{"id":"3246eac28d45a1ac","type":"inject","z":"7a7c463842e7e83e","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":160,"y":180,"wires":[["dac9efd322e462ed"]]},{"id":"46aecae17ebde3f2","type":"function","z":"7a7c463842e7e83e","name":"label","func":"var max=100,min=0;\nvar numbers = [0,0,0];\nfor (let i = 0; i < 3 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\nvar m = [\n    {label:\"A\", payload:numbers[0]},\n    {label:\"B\", payload:numbers[1]},\n    {label:\"C\", payload:numbers[2]},\n    ];\nreturn [m];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":140,"wires":[["dfa48a2208ec804e","07faa46aad4cfc35","a5eb6044d0f6684c","4a7cd4e2e4544212"]]},{"id":"ec57a2f242284dc5","type":"inject","z":"7a7c463842e7e83e","name":"","repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":160,"y":140,"wires":[["46aecae17ebde3f2"]]},{"id":"13e657299cd01203","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=10,min=1;\nvar numbers = [0,0,0];\nfor (let i = 0; i < 3 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\n\nvar m={\n    \"series\":[\"X\",\"Y\",\"Z\"],\n    \"data\":[[numbers[0]],[numbers[1]],[numbers[2]]],\n    \"labels\":[\"Jan\"]\n};\nreturn {payload:[m]};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":460,"wires":[["dfa48a2208ec804e","0e2a31d593ad4b65","d12e7d99388993cb","a5eb6044d0f6684c","4a7cd4e2e4544212","07faa46aad4cfc35"]]},{"id":"19e86961f4358cf1","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":7,"width":0,"height":0,"passthru":false,"label":"array3a","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":160,"y":460,"wires":[["13e657299cd01203"]]},{"id":"b3dde2e55b6321c8","type":"function","z":"7a7c463842e7e83e","name":"","func":"var max=10,min=1;\nvar numbers = [0,0,0];\nfor (let i = 0; i < 3 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\nvar m={\n    \"series\":[\"X\"],\n    \"data\":[[numbers[0],numbers[1],numbers[2]]],\n    \"labels\":[\"Jan\",\"Feb\",\"Mar\"]\n};\nreturn {payload:[m]};","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":500,"wires":[["dfa48a2208ec804e","a5eb6044d0f6684c","d12e7d99388993cb","0e2a31d593ad4b65","4a7cd4e2e4544212","07faa46aad4cfc35"]]},{"id":"6ab2d58ff7dbd6a9","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":8,"width":0,"height":0,"passthru":false,"label":"array3b","color":"","bgcolor":"","icon":"","payload":"","payloadType":"str","topic":"","x":160,"y":500,"wires":[["b3dde2e55b6321c8"]]},{"id":"4a7cd4e2e4544212","type":"ui_chart","z":"7a7c463842e7e83e","name":"","group":"4e7edda4.417004","order":2,"width":0,"height":0,"label":"horizontal bar","chartType":"horizontalBar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":"30","colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":600,"y":240,"wires":[[],[]]},{"id":"0e2a31d593ad4b65","type":"ui_chart","z":"7a7c463842e7e83e","name":"","group":"4e7edda4.417004","order":3,"width":0,"height":0,"label":"polar chart","chartType":"polar-area","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":"30","colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":630,"y":480,"wires":[[],[]]},{"id":"d12e7d99388993cb","type":"ui_chart","z":"7a7c463842e7e83e","name":"","group":"4e7edda4.417004","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":"30","colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":2,"x":630,"y":540,"wires":[[],[]]},{"id":"ca54e373fccde137","type":"function","z":"7a7c463842e7e83e","name":"label","func":"var max=100,min=0;\nvar numbers = [0,0,0,0,0,0,0,0,0];\nfor (let i = 0; i < 10 ; i++) {\n  numbers[i]=Math.floor(Math.random()*(max-min+1))+min;\n}\n\nvar m = [\n    {label:\"A\", payload:numbers[0], series:\"X\"},\n    {label:\"B\", payload:numbers[1], series:\"X\"},\n    {label:\"C\", payload:numbers[2], series:\"X\"},\n    {label:\"A\", payload:numbers[3], series:\"Y\"},\n    {label:\"B\", payload:numbers[4], series:\"Y\"},\n    {label:\"C\", payload:numbers[5], series:\"Y\"},\n    {label:\"A\", payload:numbers[6], series:\"Z\"},\n    {label:\"B\", payload:numbers[7], series:\"Z\"},\n    {label:\"C\", payload:numbers[8], series:\"Z\"}\n    ];\n    \nreturn [m];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":310,"y":100,"wires":[["07faa46aad4cfc35","dfa48a2208ec804e","a5eb6044d0f6684c","4a7cd4e2e4544212"]]},{"id":"48cb59cf4938ba17","type":"inject","z":"7a7c463842e7e83e","name":"","props":[{"p":"payload","v":"","vt":"date"},{"p":"topic","v":"","vt":"string"}],"repeat":"","crontab":"","once":false,"topic":"","payload":"","payloadType":"date","x":160,"y":100,"wires":[["ca54e373fccde137"]]},{"id":"5c4be17ddfb58ec0","type":"ui_button","z":"7a7c463842e7e83e","name":"","group":"ab397e95.29ebe","order":11,"width":0,"height":0,"passthru":false,"label":"Clear All","color":"","bgcolor":"","icon":"","payload":"[]","payloadType":"json","topic":"","x":300,"y":60,"wires":[["d12e7d99388993cb","0e2a31d593ad4b65","07faa46aad4cfc35","4a7cd4e2e4544212","dfa48a2208ec804e","a5eb6044d0f6684c"]]},{"id":"89749fb7.87f01","type":"ui_group","name":"Charts","tab":"d7901f40.2659d","order":2,"disp":false,"width":"6"},{"id":"ab397e95.29ebe","type":"ui_group","name":"Inputs","tab":"d7901f40.2659d","order":1,"disp":false,"width":"6"},{"id":"4e7edda4.417004","type":"ui_group","name":"Group 3","tab":"d7901f40.2659d","order":3,"disp":false,"width":"6"},{"id":"d7901f40.2659d","type":"ui_tab","name":"Charts","icon":"dashboard","order":2}]

沒有留言:

張貼留言

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...