Deneb/Vega-Lite can be used to create custom gauge visuals. This exercise explores 4 different options (2 linear gauges and 2 circular gauges), each of which display the percentage in a different manner. As well, the 2nd and 4th visuals display data-driven colour ranges.
These examples illustrate a number of Deneb/Vega-Lite features, including:
1-Linear Gauge (gradient):
- use of three overlapping (layered) marks (2x bar [background & foreground] and 1x text [data value])
- use of rounded corners on the bar marks
- use of transparent-to-blue gradient colours for the foreground bar
2-Linear Gauge (scale):
- use of four overlapping (layered) marks (bar, text [range], point [inverted triangle symbol], text [data value])
- use of a “transform” block to extend the dataset with in-visual calculations of the range mid points
- use of data values for the range colours
- use of black border and white fill for the “pointer” symbol
3-Circular Gauge (radial):
- use of a “transform” block to extend the dataset with in-visual calculations of the start-and-end degrees and radians for the background and foreground arc marks
- use of a “params” block to enhance the visual with configuration settings and calculations for arc position and size
- use of three overlapping (layered) marks (2x bar [background & foreground] and 1x text [data value])
- use of transparent-to-blue gradient colours for the foreground bar
4-Circular Gauge (speedometer):
- use of a “transform” block to extend the dataset with in-visual calculations of the start-and-end degrees and radians for the scale size and needle position
- use of a “params” block to enhance the visual with configuration settings and calculations for scale position and size
- use of five overlapping (layered) marks (2x arc [background & scale], 1x point [pointer; shape=wedge], 1x circle [black border and white fill], and 1x text [data value])
- use of data values for the scale sizes and colours
The intent of this example 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 sample data for linear and circular ranges.
This example 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 Examples - Gauges.pbix (1.4 MB)