Chart Legend modification

Making small progress i now have persistent data in charts,

my issue now is with the chart legends as they appear to be stuck as the full topic of the payload charted. this is quite long in my case, along the lines of 'Dashboard/Plant1/Temperature'

And when plotting 7 or more datasets in a single chart it would be great to reduce that down to a simple 'P1', as the chart is already labeled Temperature.. ..

Or do i need to use a root level simple topic to achieve this result?

again many thanks in advance for all input

Yes the legend is whatever topic you send it, do use a change node to change them, or function node to slice out the part you want.

Thanks I am off to look up change nodes now..

Success!! although the once simple flows are getting messy now..

A single function node with something like msg.topic = msg.topic.split("/")[1]; ought to get you close

it was a it more of a copy n paste job,, 4 x graphs each with 7x inputs, monitoring plant status recording/displaying temperature soil moisture level, soil EC level, and the battery level of the sensors feeding the data. so after i had inserted the 1st 7 x functions to set msg,topic to Plantx (x=1..7)
i copied and pasted them amongst the flows of the other 3 charts and hovered the nodes til they joined up in the correct flow. -- been a long night.. only 1 issue left but my google-fu fails me.

I have 7 x global vars set in the dashboard flow and used for conditional tests in the function flow, but come a system restart these get lost?

yes on restart by default globals get reset. Unless either a) you use new persistent context option in version 0.19 settings or b) re-inject new values into global context at start.

You should have only needed one function per chart... as they all feed into the same input so you can manipulate the topic then, but hey, that's just me

@dceejay im sure you would gasp with horror and disbelief with how i have constructed some flows (all perhaps?),, there is no security applied to either node red or the mqtt broker im hosting.

However as I progress i hope to gain a deeper insight as to how im currently going about things incorrectly, First things first though get it all working.. which apart from the global issue is basically there, currently im setting the globals to a default value if not set when fetched within a declaration.

var P4MML = global.get('P4MML')||30;
global.set('P4MML',msg);
return msg;   

this is in a function sat between slider and numeric nodes to update and display current value on the dashboard.

Yes repeated 7x for 7 x MML (Minimum Moisture Level) Globals

the MML values saved as globals are used on another flow to determine if a turn on the water mqtt message is published..

fwiw this patio plant watering project has been on the go for a while it started off as an arduino project with hard wired resistive moisture sensors that electrolysed i then started a rebuild with esp8266 dev boards and spi interface capacitive moisture sensors which got held up with battery and ldo issues, Now its a Pi and ble sensors and its getting close to having a working and informative gui.... completely by standing on the shoulders of others.. i hasten to add.

If you are already using MQTT you might like to consider using retained MQTT values instead of global or flow context. Then feed those into any nodes that need them. Then the nodes automatically get the values on startup and also get notified if the value changes.

Thanks Colin,, I may well employ the retain capacity of the mqtt broker/service, i will need to read up on it. Though i seem to have cracked the global declaration and setting..
It was a long weekend at the codeface..

  [{"id":"ae64b87a.d20a18","type":"ui_slider","z":"bfb29f2b.4dfdb","name":"Plant1 Minimum moisture Level","label":"Plant1 Minimum moisture Level","group":"1c127556.33317b","order":5,"width":"6","height":"1","passthru":false,"topic":"Dashboard/Settings/Plant1M","min":"20","max":"40","step":1,"x":170,"y":420,"wires":[["7fcb1e11.1610c"]]},{"id":"d18edff1.488c6","type":"ui_numeric","z":"bfb29f2b.4dfdb","name":"","label":"P1MML","group":"1c127556.33317b","order":6,"width":"6","height":"1","passthru":false,"topic":"Dashboard/Settings/Plant1M","format":"{{value}}%","min":"20","max":"40","step":1,"x":220,"y":600,"wires":[["7fcb1e11.1610c"]]},{"id":"7fcb1e11.1610c","type":"function","z":"bfb29f2b.4dfdb","name":"Update Plant1 Minimum Moisture Level","func":"var P1MML = global.get('P1MML')||30;\nglobal.set('P1MML',msg.payload);\nreturn msg;","outputs":1,"noerr":0,"x":200,"y":500,"wires":[["d18edff1.488c6","ae64b87a.d20a18"]]},{"id":"1c127556.33317b","type":"ui_group","z":"","name":"Overview","tab":"6152efc3.75cfe","order":2,"disp":false,"width":"12","collapse":false},{"id":"6152efc3.75cfe","type":"ui_tab","z":"","name":"Patio Plant Monitor","icon":"dashboard","order":1}]

Tho the flow bothers me it screams recursion and not the cuddly self terminating type.. but its not..

The goal is a dashboard interface displaying graphs of 4 x sensor sets from a number of plant pot sensors along side with an input control for each plant or perhaps global which can then be referenced after data collection as the level to trigger a conditional execution of a watering period.
for that particular plant/area. ie when moisture as a % drops below 30 water that plant area if its covered by a watering system raise an alert otherwise.

looks like i need to shift my conditional testing into a function node to access the globals..
.