Deneb Template - Thermometer Gauge

A thermometer visual is often used to display temperature or to showcase progress. The native visuals in Power BI can be used, but have some formatting limitations and may require multiple precisely-sized visuals layered on top of one-another (AFAIK … I’d be happy to be proven wrong). Another option is to use the automatic application of axes inherent in Vega-Lite to ease (or eliminate) the layout burden, and I enclose a Deneb/Vega-Lite template for such a temperature gauge.

deneb.thermometer.0.3

This template illustrates a number of Deneb/Vega-Lite features, including:

  • a “transform” block to extend the values provided in the dataset by Power BI
  • a “params” block to enhance the visual with common values for border and y-axis labels
  • 5 layered marks (bulb border - circle; gauge border - bar; bulb fill - circle; gauge fill - bar; temperature label - text)
  • use of the “stroke” property to set the border colour
  • use of dual y-values (“y” and “y2”) to set the ranged bar sizes
  • a Deneb custom tooltip showing the temperature and range
  • use of multiple condition tests to select the gauge fill colour
  • use of multiple condition tests to select the temperature label colour

Here’s one of the multi-conditions used for the color blocks in the encoding blocks:

        "color": {
          "condition": [
            {
              "test": "datum['Temperature'] <= -20",
              "value": "#31578C"
            },
            {
              "test": "datum['Temperature'] <= 5",
              "value": "#B7D4EB"
            },
            {
              "test": "datum['Temperature'] <= 25",
              "value": "#0E5358"
            }
          ],
          "value": "#850000"
        }

The intent of this template is not to provide a finished visual, but rather to serve as a starting point for further custom visual development.

Also included is the sample PBIX using a made-up dataset as a demo.

NOTE: This template is provided as-is for information purposes only, and its use is solely at the discretion of the end user; no responsibility is assumed by the author.

Greg
deneb.thermometer_gauge.0.2.json (9.7 KB)
Deneb Templates - Thermometer Gauge.pbix (1.4 MB)

2 Likes

marking as solved