Indicator
Overview
The indicator
trace type is used to create key performance indicator (KPI) visualizations, allowing you to display single or aggregated values in a gauge or numeric format. Indicators are great for showing metrics like progress, performance, or key values at a glance.
You can customize the gauge, delta values, colors, and text annotations to represent your data effectively. Indicator plots are widely used in dashboards and reporting.
Common Uses
- KPI Dashboards: Displaying key metrics, progress, or performance indicators.
- Gauges: Visualizing values as a gauge to track goals or targets.
- Highlighting Change: Showing the difference between two points in time.
Check out the Attributes for the full set of configuration options
Examples
Common Configurations
Here's a simple indicator
plot displaying a single numeric value:
You can copy this code below to create this chart in your project:
models:
- name: indicator-data
args:
- echo
- |
value
75
traces:
- name: Simple Numeric Indicator
model: ${ref(indicator-data)}
columns:
val: value
sign: case when value > 0 then '<sup>+</sup>' else '<sup>-</sup>' end
props:
type: indicator
mode: "number"
value: column(val)[0]
number:
suffix: '<sub>hrs</sub>'
prefix: column(sign)[0]
font:
size: 100
charts:
- name: Simple Numeric Indicator Chart
traces:
- ${ref(Simple Numeric Indicator)}
layout:
title:
text: Simple Numeric Indicator<br><sub>Displaying a Single Value</sub>
margin:
l: 0
r: 0
b: 50
This example shows a gauge
indicator to represent a value and its progress toward a goal:
Here's the code:
models:
- name: indicator-data-gauge
args:
- echo
- |
value
65
traces:
- name: Gauge Indicator
model: ${ref(indicator-data-gauge)}
columns:
val: value
props:
type: indicator
mode: "gauge+number"
value: column(val)[0]
gauge:
axis:
range: [0, 100]
bar:
color: "#17becf"
charts:
- name: Gauge Indicator Chart
traces:
- ${ref(Gauge Indicator)}
layout:
title:
text: Gauge Indicator<br><sub>Progress Towards a Target</sub>
This example demonstrates an indicator
plot with delta values, comparing the current value to a previous value:
Here's the code:
models:
- name: indicator-data-delta
args:
- echo
- |
sort,value
3,85
2,75
1,65
0,55
traces:
- name: Delta Indicator with Comparison
model: ${ref(indicator-data-delta)}
columns:
val: value
props:
type: indicator
mode: "number+delta"
value: column(val)[0]
delta:
reference: column(val)[1]
order_by:
- ?{sort desc}
charts:
- name: Delta Indicator with Comparison Chart
traces:
- ${ref(Delta Indicator with Comparison)}
layout:
title:
text: Delta Indicator with Comparison<br><sub>Showing Change from Previous Value</sub>
A schema to validate plotly trace properties
Attributes
These attributes apply to traces where trace.props.type
is set to indicator
. You would configure these attributes on the trace with the trace.props
object.
align: any
customdata: array
customdatasrc: 'string' #(1)!
delta:
decreasing:
color: any
symbol: 'string' #(2)!
font:
color: any
family: 'string' #(3)!
lineposition: any
shadow: 'string' #(4)!
size: number
style: any
textcase: any
variant: any
weight: integer
increasing:
color: any
symbol: 'string' #(5)!
position: any
prefix: 'string' #(6)!
reference: number
relative: boolean
suffix: 'string' #(7)!
valueformat: 'string' #(8)!
domain:
column: integer
row: integer
x: array
y: array
gauge:
axis:
exponentformat: any
minexponent: number
nticks: integer
range: array
separatethousands: boolean
showexponent: any
showticklabels: boolean
showtickprefix: any
showticksuffix: any
tickangle: number
tickcolor: any
tickfont:
color: any
family: 'string' #(9)!
lineposition: any
shadow: 'string' #(10)!
size: number
style: any
textcase: any
variant: any
weight: integer
tickformat: 'string' #(11)!
tickformatstops: array
ticklabelstep: integer
ticklen: number
tickmode: any
tickprefix: 'string' #(12)!
ticks: any
ticksuffix: 'string' #(13)!
ticktext: array
ticktextsrc: 'string' #(14)!
tickvals: array
tickvalssrc: 'string' #(15)!
tickwidth: number
visible: boolean
bar:
color: any
line:
color: any
width: number
thickness: number
bgcolor: any
bordercolor: any
borderwidth: number
shape: any
steps: array
threshold:
line:
color: any
width: number
thickness: number
value: number
ids: array
idssrc: 'string' #(16)!
legend: string
legendgrouptitle:
font:
color: any
family: 'string' #(17)!
lineposition: any
shadow: 'string' #(18)!
size: number
style: any
textcase: any
variant: any
weight: integer
text: 'string' #(19)!
legendrank: number
legendwidth: number
metasrc: 'string' #(20)!
mode: string
name: 'string' #(21)!
number:
font:
color: any
family: 'string' #(22)!
lineposition: any
shadow: 'string' #(23)!
size: number
style: any
textcase: any
variant: any
weight: integer
prefix: 'string' #(24)!
suffix: 'string' #(25)!
valueformat: 'string' #(26)!
stream:
maxpoints: number
token: 'string' #(27)!
title:
align: any
font:
color: any
family: 'string' #(28)!
lineposition: any
shadow: 'string' #(29)!
size: number
style: any
textcase: any
variant: any
weight: integer
text: 'string' #(30)!
type: indicator
uid: 'string' #(31)!
value: number
visible: any
- Sets the source reference on Chart Studio Cloud for
customdata
. - Sets the symbol to display for increasing value
- HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the symbol to display for increasing value
- Sets a prefix appearing before the delta.
- Sets a suffix appearing next to the delta.
- Sets the value formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format.
- HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: %h for half of the year as a decimal number as well as %{n}f for fractional seconds with n digits. For example, 2016-10-13 09:15:23.456 with tickformat %H~%M~%S.%2f would display 09~15~23.46
- Sets a tick label prefix.
- Sets a tick label suffix.
- Sets the source reference on Chart Studio Cloud for
ticktext
. - Sets the source reference on Chart Studio Cloud for
tickvals
. - Sets the source reference on Chart Studio Cloud for
ids
. - HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the title of the legend group.
- Sets the source reference on Chart Studio Cloud for
meta
. - Sets the trace name. The trace name appears as the legend item and on hover.
- HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets a prefix appearing before the number.
- Sets a suffix appearing next to the number.
- Sets the value formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format.
- The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details.
- HTML font family - the typeface that will be applied by the web browser. The web browser can only apply a font if it is available on the system where it runs. Provide multiple font families, separated by commas, to indicate the order in which to apply fonts if they aren't available.
- Sets the shape and color of the shadow behind text. auto places minimal shadow and applies contrast text font color. See https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow for additional options.
- Sets the title of this indicator.
- Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.