Question

Thermometer Chart/ Slider Chart

  • 10 December 2020
  • 6 replies
  • 180 views

Hello Experts, 

I have a requirement to show the KPI in a slider format/thermometer chart, like the image below.

I do have KPI/measure created in my Explore for: “Total Spend” , “Needed for Next Tier”. 

The values displayed above the Thermometer bar are the Tiers, on which the the “Total Spend” value has to fall. 

These Tiers have to be built as a Dimension with Tier type? 
Can someone help me with ideas/suggestions in getting this layout designed? 

 

 


6 replies

Hi @brecht ,

Can you suggest this with your expertise? :slight_smile:

Hello Experts,

 

Any possible suggestions here? 

Will this reference can be tweaked or helpful for my type of layout - https://looker.com/platform/blocks/viz/liquid-fill-gauge

Userlevel 3
Badge

Hi @DickyMohanty,

You potentially could do something like this:
 

  measure: count {
type: count
html:
{% if value < 100 %}
<div class="vis" style="width: 400px; background-color: #808080; border: 2px solid #000;
border-radius: 15px; -moz-border-radius: 15px">

<div class="vis-single-value" style="background-color: red; font-color:white; width: 200px; border: 2px solid #000;
border-radius: 15px; -moz-border-radius: 15px;">{{ rendered_value }}</div></div>

{% elsif value >1000 %}
<div class="vis" style="width: 400px; background-color:#808080; border: 2px solid #000;
border-radius: 15px; -moz-border-radius: 15px">
<div class="vis-single-value" style="background-color: blue; font-color:white; width: 300px; border: 2px solid #000;
border-radius: 15px; -moz-border-radius: 15px;">{{ rendered_value }}
</div></div>
{% else %}
<div class="vis" style="width: 400px; background-color: #808080; border: 2px solid #000;
border-radius: 15px; -moz-border-radius: 15px">
<div class="vis-single-value" style="background-color: black; font-color:white; width: 400px; border: 2px solid #000;
border-radius: 15px; -moz-border-radius: 15px;">{{ rendered_value }}
</div></div>
{% endif %};;
}
}

This dynamically sets which div we use based on the value of the count. The result looks like this, but you can definitely add more styling. 


Please let me know if you have any questions!

 

Thanks,

Eric

Hi @Eric_Lyons ,

Thanks much for helping with a start. I am quite new to Looker and learning now. Also is there any good learning portal to how to use HTML for LookML? 

Can you also help in how to mark those scale on the bar and the arrow with KPI (as shown in the design) ?

Can you also help in explaining/details of each line of script? 

Regards!

Hi @Eric_Lyons ,

Happy New Year and hope you are keeping safe!

 

Can you help me in how to mark those scales on the bar and the upwards arrow with KPI (as shown in the design) ?

Userlevel 3
Badge

Hi @DickyMohanty,

 

You would most likely need to place an image of the arrow based on the value. Similar to conditional we have based on value which alters which div we use, you would want to place the arrow n pixels away from the left axis. 

 

Thanks,

Eric

Reply