Knowledge Base Article

Chart Type - Gauge Chart

Everyone loves to see values relative to benchmarks in a Gauge Chart format. The speedometer gauge is such a common way of people ingesting information that it has become commonplace in the Business Intelligence world. I'm not going to hate it as the term dashboard stems directly from the use of the metric display in cars.

Here's a Parameterized Snippet to transform data to make a stacked bar chart that simulates the look and feel of a gauge chart.

Base: Number Overlay

Series Settings:
  • Value = Scatter
  • Top = Bar (Green optional: #00ff00)
  • Middle = Bar (Yellow optional: #ffff00)
  • Red = Bar (Red optional: #ff0000)

Name: gauge_chart(table,name,value_field,lower_bound,middle_bound,upper_bound)
select
  *
from
  (
    select
      '[name]' as x
      , 'Lower' as bound
      , [lower_bound] as y
    union
    select
      '[name]' as x
      , 'Middle'
      , [middle_bound] - [lower_bound]
    union
    select
      '[name]' as x
      , 'Top'
      , [upper_bound] - [middle_bound]
    union
    select
      '[name]' as x
      , 'Value'
      , [value_field] as y
    from
      [table]
  )
  as t
order by
  case
    when bound = 'Value'
      then 1
    when bound = 'Top'
      then 2
    when bound = 'Middle'
      then 3
    when bound = 'Lower'
      then 4
  end
Fun fact, from the Stack Exchange post:
It has recently stepped even further away from its origins by being borrowed for a computer display that shows useful real-time data such as the time, weather, news headlines, stock prices and phone numbers. It’s a long way from horse-drawn carriages on muddy roads.
Updated 03-02-2023
No CommentsBe the first to comment