# How to get Template dimensions

**URL:** <https://discourse.nodered.org/t/how-to-get-template-dimensions/43997>\
**Category:** Dashboard\
**Created:** [11 April 2021 17:24 UTC](https://discourse.nodered.org/t/how-to-get-template-dimensions/43997 "2021-04-11T17:24:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FraSpe](https://avatars.discourse-cdn.com/v4/letter/f/9fc348/32.png) [@FraSpe](https://discourse.nodered.org/u/FraSpe)\
**Post date:** [11 April 2021 17:24 UTC](https://discourse.nodered.org/t/how-to-get-template-dimensions/43997/1 "2021-04-11T17:24:36Z")

</div>

I have a question.  
I want to create in my dashboard a Template with a canvas to draw on it a specific graph.  
I need to know ( form javascript) the dimension of the template (height and width) in order to scale the graph in accordance to the size of the widget template.  
I tried 1000 combinations without success.....  
Can somone help me?  
thanks

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [11 April 2021 18:08 UTC](https://discourse.nodered.org/t/how-to-get-template-dimensions/43997/2 "2021-04-11T18:08:02Z")

</div>

The site config for reference looks like this  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/c/cc5ebd53640142b8efa5ef8e227631f90d91ded5.png)  
And let's say you have ui\_template configured with size 6x2 (units with x height)

units = ui\_template size in direction  
w-size = widget size in direction  
w-space = widget spacing in direction  
Formula for direction:  
size = (units \* w-size) + ((units - 1) \* w-space)

But ... the container has padding

```auto
.nr-dashboard-template {
    padding: 3px 6px;
}

```

So for actual size in pixels you'll need to subtract 12 from width and 6 from height. (in case of nr-theme is in use and you don't override that class anywhere)

---

<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:** [11 May 2021 18:08 UTC](https://discourse.nodered.org/t/how-to-get-template-dimensions/43997/3 "2021-05-11T18:08:41Z")

</div>

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