Newb. Q.. get msg.payload in UI template node variable

Hi.
Apologies for this newbie question..
I've made a flow that works fine with the built in gauges from dashboard node.
However I wanted to use a gauge in the UI template node from d3.js.
I put the code from this link in the UI template.

https://stackoverflow.com/questions/47391266/gauge-d3-display-values-positions

However i'm stuck in how to get my flow.get("value") or dynamic numbers into the (var value = 17;) line.. replacing 17 ofcourse..

I've tested a lot of the examples around.. but my lack of javascript knowledge stops me..

isn't there a quick line of code that could fetch my msg.payload into the value variable??