Json in Bar-Chart

good morning

I am working with a series of data from the API of a website, I have transformed them to JSON, remaining in this format.

[
    {
        "value": 104.61,
        "hora": "00"
    },
    {
        "value": 104.33,
        "hora": "01"
    },
    {
        "value": 103.2,
        "hora": "02"
    },
    {
        "value": 101.28,
        "hora": "03"
    },
    {
        "value": 99.34,
        "hora": "04"
    }]

They are electricity prices by hourly sections, so for example, the vaule value of the first is the price in € and hor, it is the hour range.

I have tried to make a bar graph but the node does not accept it.
Any idea where to go?

Thanks and a greeting

You need to format the data for the bar chart.
An example.

[{"id":"5d07e053.195108","type":"inject","z":"8d5be6f9.bc3cb","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"value\":104.61,\"hora\":\"00\"},{\"value\":104.33,\"hora\":\"01\"},{\"value\":103.2,\"hora\":\"02\"},{\"value\":101.28,\"hora\":\"03\"},{\"value\":99.34,\"hora\":\"04\"}]","payloadType":"json","x":170,"y":220,"wires":[["683b728f.63125c"]]},{"id":"683b728f.63125c","type":"change","z":"8d5be6f9.bc3cb","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[\t   {\t       \"series\": [\"X\"],\t       \"data\": [[$map(payload,function($v){$v.value})]],\t       \"labels\":  $map(payload,function($v){$v.hora})\t   \t   }\t\t]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":240,"wires":[["a5067d02.810618","c9ce5686.f560f"]]},{"id":"a5067d02.810618","type":"ui_chart","z":"8d5be6f9.bc3cb","name":"","group":"165e1e1a.e752fa","order":1,"width":0,"height":0,"label":"","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":610,"y":300,"wires":[[]]},{"id":"c9ce5686.f560f","type":"debug","z":"8d5be6f9.bc3cb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":610,"y":60,"wires":[]},{"id":"165e1e1a.e752fa","type":"ui_group","z":"","name":"Default","tab":"f9b58883.fa613","order":1,"disp":true,"width":"12","collapse":false},{"id":"f9b58883.fa613","type":"ui_tab","z":"","name":"Home","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

you are a genious! the first time it has worked! I had something similar but mine was not working for me.

I take advantage, is it possible that in that function it returns all the values ​​of "value" divided by 1000?
Thank you very much for the help! very thankful!

[{"id":"683b728f.63125c","type":"change","z":"8d5be6f9.bc3cb","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[\t   {\t       \"series\": [\"X\"],\t       \"data\": [[$map(payload,function($v){$round($v.value /1000, 4)})]],\t       \"labels\":  $map(payload,function($v){$v.hora})\t   \t   }\t\t]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":240,"wires":[["a5067d02.810618","c9ce5686.f560f"]]}]

Is perfect!

Thanks!!

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