Deneb Template - Linear Gauge

A speedometer visual, due to its inherent layout, takes-up a notable amount of space. A linear gauge visual is an alternative that requires less screen real estate, and I enclose a Deneb/Vega-Lite template for such a linear gauge.

deneb.linear_gauge.0.2

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

  • “transform” blocks to filter the supplied dataset to only the rows relevant to the current mark
  • a Vega-Lite setting of the approximate number of x-axis labels
  • a Vega-Lite sorting of the range labels
  • a Deneb custom tooltip showing only the desired dataset fields

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 1: 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.

NOTE 2: This template was prepared using a beta version of Deneb version 1.3 (a standalone version) for illustrative purposes only, and, as such, may contain development features that will not be in the final production release.

Greg

deneb.linear_gauge.0.2.json (5.1 KB)
Deneb Templates - Linear Gauge.pbix (2.8 MB)

6 Likes

I was a bit rushed yesterday when I posted the initial linear gauge Deneb/Vega-Lite template, and didn’t include one of the new features that is slated to be available in the upcoming Deneb version 1.3 release, namely the direct access to the colours in the current color theme of the Power BI report.

I’ve modified my original linear gauge Deneb/Vega-Lite code to conform to the 2nd, 4th, 6th, and 8th colours of the current Power BI theme.

deneb.linear_gauge.0.21

Here’s an example of the colour block Deneb JSON code to set the colours based on the Power BI theme:

        "color": {
          "field": "Name",
          "type": "nominal",
          "title": "Range",
          "sort": {
            "op": "sum",
            "field": "ID"
          },
          "scale": {
            "range": [
              {"expr": "pbiColor(1)"},
              {"expr": "pbiColor(3)"},
              {"expr": "pbiColor(5)"},
              {"expr": "pbiColor(7)"}
            ]
          }
        }

(Deneb uses a zero-based index to access the theme colours, so to get the 2nd, 4th, 6th, and 8th colours one must use indexes of 1, 3, 5, and 7.)

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

NOTE: This template was prepared using a beta version of Deneb version 1.3 (a standalone version) for illustrative purposes only, and, as such, may contain development features that will not be in the final production release.

Greg

Deneb Templates - Linear Gauge - V2.pbix (2.8 MB)

2 Likes