# Level with Dashboard Template

**URL:** <https://discourse.nodered.org/t/level-with-dashboard-template/82037>\
**Category:** General\
**Created:** [14 October 2023 23:53 UTC](https://discourse.nodered.org/t/level-with-dashboard-template/82037 "2023-10-14T23:53:51Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [17 October 2023 10:30 UTC](https://discourse.nodered.org/t/level-with-dashboard-template/82037/21 "2023-10-17T10:30:34Z")

</div>

> [@pinie\_pinie](#):
>
> I definitely won't take an HTML course.

Me neither, horrible language!

> [@pinie\_pinie](#):
>
> Maybe I can get the flow of "jbudd" adjusted. He's already heading in the right direction.

Thanks for the encouragement.

I'm currently looking at SVG so I coded it as SVG text and rectangles with some styling in CSS because inline styling is horrible.  
I have used simple named colours for the rectangle outlines but for the fill I chose HSL in order to tone down the vibrancy. You can use hex codes or named colours if you want to simplify it.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/2/12206a87e35e4487311df991d4cd730cdbd33aa8.png)

```auto
[{"id":"4846f1fc87161f68","type":"group","z":"49865e23ad9648f2","style":{"stroke":"#0722fc","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#0722fc"},"nodes":["abd23fb48ed36ac6","695cb4a29d66f302","f1b333c82e6225bf","2a9ac5606e99e527"],"x":34,"y":199,"w":572,"h":122},{"id":"abd23fb48ed36ac6","type":"ui_template","z":"49865e23ad9648f2","g":"4846f1fc87161f68","group":"149d3845ab5f0780","name":"Vertical level","order":14,"width":"0","height":"0","format":"<div class=\"myrectangles\">\n<?xml version=\"1.0\" standalone=\"no\"?>\n<svg width=\"240\" height=\"200\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n\n<!-- Labels \nOriginally I had eg <text x=\"25\" y=\"146\" font-size=\"12\" text-anchor=\"middle\" fill=\"black\">50%</text> \nbut moved as much as possible to CSS template -->\n<text x=\"25\" y=\"26\">100%</text>\n<text x=\"25\" y=\"66\">80%</text>\n<text x=\"25\" y=\"106\">75%</text>\n<text x=\"25\" y=\"146\">50%</text>\n<text x=\"25\" y=\"186\">25%</text>\n\n<!-- Rectangles \nwidth and height controlled by CSS. Corner radius can't be defined in CSS for SVG v1.1 -->\n<rect x=\"60\" y=\"6\" rx=\"3\" ry=\"3\" stroke={{msg.outline[4]}} fill={{msg.color[4]}}></rect>\n<rect x=\"60\" y=\"48\" rx=\"3\" ry=\"3\" stroke={{msg.outline[3]}} fill={{msg.color[3]}}></rect>\n<rect x=\"60\" y=\"88\" rx=\"3\" ry=\"3\" stroke={{msg.outline[2]}} fill={{msg.color[2]}}></rect>\n<rect x=\"60\" y=\"128\" rx=\"3\" ry=\"3\" stroke={{msg.outline[1]}} fill={{msg.color[1]}}></rect>\n<rect x=\"60\" y=\"168\" rx=\"3\" ry=\"3\" stroke={{msg.outline[0]}} fill={{msg.color[0]}}></rect>\n\n</svg>\n</div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","className":"","x":510,"y":280,"wires":[[]]},{"id":"695cb4a29d66f302","type":"ui_template","z":"49865e23ad9648f2","g":"4846f1fc87161f68","group":"be8cd6b09a8d7d5d","name":"CSS","order":14,"width":0,"height":0,"format":"<style>\n .myrectangles {\n background: white;\n }\n .myrectangles svg rect {\n stroke-width: 2;\n rx: 3;\n ry: 3;\n width: 120px;\n height: 25px;\n }\n .myrectangles svg text {\n font-size: 12px;\n text-anchor: middle;\n stroke: black;\n }\n</style>\n","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"global","className":"","x":490,"y":240,"wires":[[]]},{"id":"f1b333c82e6225bf","type":"ui_slider","z":"49865e23ad9648f2","g":"4846f1fc87161f68","name":"Slider","label":"Value","tooltip":"","group":"149d3845ab5f0780","order":6,"width":0,"height":0,"passthru":false,"outs":"all","topic":"topic","topicType":"msg","min":0,"max":"100","step":1,"className":"","x":110,"y":280,"wires":[["2a9ac5606e99e527"]]},{"id":"2a9ac5606e99e527","type":"function","z":"49865e23ad9648f2","g":"4846f1fc87161f68","name":"Set levels and colours ","func":"msg.color = [\"none\",\"none\",\"none\",\"none\",\"none\"]\nmsg.outline = [\"green\", \"green\", \"green\", \"orange\", \"red\"]\nif (msg.payload >= 100) msg.color[4] = \"hsl(0, 100%, 70%)\" // fifth bar at 100\nif (msg.payload >= 80) msg.color[3] =\"hsl(50, 100%, 70%)\" // fourth bar at 80\nif (msg.payload >= 75) msg.color[2] = \"hsl(120, 100%, 70%)\" // third bar at 75\nif (msg.payload >= 50) msg.color[1] = \"hsl(120, 100%, 70%)\" // second bar at 50\nif (msg.payload >= 25) msg.color[0] = \"hsl(120, 100%, 70%)\" // first bar at 25\nreturn msg;\n","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":280,"wires":[["abd23fb48ed36ac6"]]},{"id":"149d3845ab5f0780","type":"ui_group","name":"SVG4","tab":"ebc8e3375c3f2aa1","order":4,"disp":true,"width":"6","collapse":false,"className":""},{"id":"be8cd6b09a8d7d5d","type":"ui_group","name":"Labels","tab":"704020d306ae5506","order":1,"disp":false,"width":2,"collapse":false,"className":""},{"id":"ebc8e3375c3f2aa1","type":"ui_tab","name":"SVG","icon":"dashboard","disabled":false,"hidden":false},{"id":"704020d306ae5506","type":"ui_tab","name":"ESP BME","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/e/3e64b27b8451dfeea832536032d4123fd40a5f39.png)

---

<div class="post-metadata">

**Author:** ![pinie\_pinie](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@pinie\_pinie](https://discourse.nodered.org/u/pinie_pinie)\
**Post date:** [17 October 2023 10:36 UTC](https://discourse.nodered.org/t/level-with-dashboard-template/82037/22 "2023-10-17T10:36:50Z")

</div>

Hello,  
Great, that's the luxury version. Everything in one template.  
I even see some logic. Of course I have to get used to it.  
Would it be possible to place a text (e.g. 25%) next to the bars?  
Thanks alot!!!

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [17 October 2023 10:39 UTC](https://discourse.nodered.org/t/level-with-dashboard-template/82037/23 "2023-10-17T10:39:36Z")

</div>

Yes.

> [@E1cid](#):
>
> You will need to learn a little css/html if you wish to modify it.

Time to do some googling and learn a little.

---

<div class="post-metadata">

**Author:** ![pinie\_pinie](https://avatars.discourse-cdn.com/v4/letter/p/ccd318/32.png) [@pinie\_pinie](https://discourse.nodered.org/u/pinie_pinie)\
**Post date:** [17 October 2023 11:04 UTC](https://discourse.nodered.org/t/level-with-dashboard-template/82037/24 "2023-10-17T11:04:57Z")

</div>

Hello,

Exactly you're right. I'll look into it. Now I have a great template!!!

Many thanks also to “jbudd”!!!! I can also use this template.

Thank you!!!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 December 2023 11:05 UTC](https://discourse.nodered.org/t/level-with-dashboard-template/82037/25 "2023-12-16T11:05:41Z")

</div>

Closed on 16 December 2023 11:05 UTC

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

[Previous page](https://discourse.nodered.org/t/level-with-dashboard-template/82037.md?page=1)
