Please show me how to get a simple bar chart from simple data

I haven't used a dashboard in years but just wanted a simple bar chart of some cheerlight tweets I've been collecting but I'm stumped as to how to get there

This is example of my data

{"ArmyOfThings":17,"DiscCheerlights":4,"EchoCheerlights":3,"CympleRobot":7,"cymplecy":1}

How do I convert it into something that the chart dashboard node understands to produce a simple bar chart of the values with the appropriate labels

Try this JSONata expression

[{"id":"c9893796.08e33","type":"inject","z":"c791cbc0.84f648","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"ArmyOfThings\":17,\"DiscCheerlights\":4,\"EchoCheerlights\":3,\"CympleRobot\":7,\"cymplecy\":1}","payloadType":"json","x":120,"y":1220,"wires":[["4adc95cf.27063c"]]},{"id":"4adc95cf.27063c","type":"change","z":"c791cbc0.84f648","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"($labels := [$keys($$.payload)];\t[{\t    \"series\": [],\t    \"data\": [[$labels.$lookup($$.payload, $)]] ,\t    \"labels\": [$labels.$substring(0,10)]\t}]\t)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":1180,"wires":[["1dcd707332701bf2","5f2157d0.903098"]]},{"id":"5f2157d0.903098","type":"ui_chart","z":"c791cbc0.84f648","name":"","group":"8b5cde76.edd58","order":9,"width":0,"height":0,"label":"chart","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"step","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"1","removeOlderPoints":"5","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#000000","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":690,"y":1040,"wires":[[]]},{"id":"8b5cde76.edd58","type":"ui_group","name":"default","tab":"8f03e639.85956","order":1,"disp":false,"width":"12","collapse":false},{"id":"8f03e639.85956","type":"ui_tab","name":"Home","icon":"dashboard","order":2,"disabled":false,"hidden":false}]

expression

(
   $labels := [$keys($$.payload)];
   [
       {
           "series": [],
           "data": [[$labels.$lookup($$.payload, $)]] ,
           "labels": [$labels.$substring(0,10)]
        }
   ]
)

Lovely thank you

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.