Skip to Content

Linear Gauge

A Linear Gauge in REAVIZ uses a linear scale to display a specific data point using a dial over a linear scale with defined limits. This type of gauge is ideal for showing how a value fits within a range.

Types supported by reaviz:

Where to use:

  • Display Single Values: Ideal for showing specific data points within a range.
  • Track Metrics: Useful for tracking metrics such as risk scores or performance indicators.
  • Compare Multiple Values: Great for comparing multiple values in a clear, linear format.

Quick Start

To create a Linear Gauge, use import the LinearGauge and give it data. The chart will automatically configure itself with the default options exposed via props.

In this example, we only pass one data object, however, we can pass multiples and it will distribute the values across them.

Examples

Single-series gauges

Multi-series gauges

API

LinearGaugeΒ 

NameTypeDefault
dataChartShallowDataShape | ChartShallowDataShape[]

Data the chart will receive to render.

seriesReactElement<LinearGaugeSeriesProps, FC<Partial<LinearGaugeSeriesProps>>>

The series component that renders the bar components.

`<LinearGaugeSeries />`
minValuenumber

Min value to scale on. Only applicable for single-series.

0
maxValuenumber

Max value to scale on. Only applicable for single-series.

100
idstring

Id of the chart.

widthnumber

Width of the chart. If not provided will autosize.

heightnumber

Height of the chart. If not provided will autosize.

marginsMargins

Margins for the chart.

classNamestring

Classnames for the chart.

containerClassNamestring

Classnames for the chart.

styleStyleHTMLAttributes<SVGSVGElement>

Additional css styles.

centerboolean

Center the chart. Used mainly internally.

centerXboolean

Center chart on X Axis only. Used mainly internally.

centerYboolean

Center chart on Y Axis only. Used mainly internally.

LinearGaugeSeriesΒ 

NameTypeDefault
heightnumber

Height of the chart. Set by LinearGauge component.

widthnumber

Width of the chart. Set by LinearGauge component.

isMultiSeriesboolean

Whether its a multi-series or not. Set by LinearGauge component.

barReactElement<BarProps, FC<Partial<BarProps>>>

Bar element. Only applicable for single series.

`<LinearGaugeBar />`
outerBarReactElement<LinearGaugeOuterBarProps, FC<Partial<LinearGaugeOuterBarProps>>>

Outer bar element. Only applicable for single series.

`<LinearGaugeOuterBar />`
dataChartInternalDataShape[]

Parsed data shape. Set internally by BarChart.

idstring

Id of the bar chart. Set internally by BarChart.

xScaleany

D3 scale for X Axis. Set internally by BarChart.

yScaleany

D3 scale for Y Axis. Set internally by BarChart.

xScale1any

D3 scale for X Multi-Group Axis. Set internally by BarChart.

typeBarType

Type of the chart.

'standard'
colorSchemeColorSchemeType

Color scheme for the chart.

'cybertron'
animatedboolean

Whether the chart is animated or not.

true
paddingnumber

Amount of padding between each bar.

0.1
groupPaddingnumber

Amount of padding between each group.

16
isCategoricalboolean

Whether the chart is categorical or not. Set internally by BarChart.

layoutDirection

Direction of the chart

'vertical'
binSizenumber

The size of each bin/bucket in the bar chart.

tooltipReactElement<TooltipAreaProps, ForwardRefExoticComponent<Partial<TooltipAreaProps> & RefAttributes<any>>> | null

Tooltip for the chart area.

`<TooltipArea tooltip={<ChartTooltip followCursor modifiers={[offset(5)]} />} />`
valueMarkersReactElement<LinearValueMarkerProps, FC<LinearValueMarkerProps>>[] | null

Value markers line for the chart.

LinearGaugeBarΒ 

NameTypeDefault
activeboolean

Whether the bar is active or not.

activeBrightnessnumber

Chroma brightness factor to brighten the active bar. See https://gka.github.io/chroma.js/#color-brightenΒ  for more info.

0.5
xScaleany

D3 scale for X Axis. Set internally by BarChart.

yScaleany

D3 scale for Y Axis. Set internally by BarChart.

xScale1any

D3 scale for X Multi-Group Axis. Set internally by BarChart.

dataChartInternalShallowDataShape

Parsed data shape. Set internally by BarChart.

idstring

Id set internally by BarChart.

gradientReactElement<GradientProps, FC<Partial<GradientProps>>> | null

Gradient shades for the bar.

`<Gradient />`
rxnumber

SVG rx attribute for the bar.

0
rynumber

SVG ry attribute for the bar.

0
widthnumber

Width of the bar. Set internally by BarSeries.

paddingnumber

Padding for the bar groups.

barCountnumber

Total number of bars used for animation. Set internally by BarSeries.

colorany

Color callback for the bar.

cursorstring

Cursor for the bar element.

'auto'
barIndexnumber

Index of the bar. Set internally by BarSeries.

groupIndexnumber

Index of the group. Set internally by BarSeries.

animatedboolean

Whether to animate the enter/update/exit. Set internally by BarSeries.

isCategoricalboolean

Whether this is categorical chart or not. Set internally by BarSeries.

rangeLinesReactElement<RangeLinesProps, FC<Partial<RangeLinesProps>>> | null

Rangelines element. for the bar.

maskReactElement<MaskProps, FC<MaskProps>> | null

Mask element for the bar.

tooltipReactElement<ChartTooltipProps, FC<Partial<ChartTooltipProps>>> | null

Tooltip element.

layoutDirection

Direction of the chart. Set internally by BarSeries.

'vertical'
typeBarType

Type of bar chart. Set internally by BarSeries.

labelReactElement<BarLabelProps, FC<Partial<BarLabelProps>>> | null

Label element.

targetMarkerReactElement<BarTargetMarkerProps, FC<Partial<BarTargetMarkerProps>>> | null

Target marker element.

`<BarTargetMarker />`
guideReactElement<GuideBarProps, FC<Partial<GuideBarProps>>> | null

Guide bar component.

minHeightnumber

Force a min height on the bar.

glowGlow

Glow styling for the bar.

onClick(event: ClickEvent) => void

Event for when the bar is clicked.

onMouseEnter(event: any) => void

Event for when the bar has mouse enter.

onMouseLeave(event: any) => void

Event for when the bar has mouse leave.

onMouseMove(event: any) => void

Event for when a bar has mouse move.

classNameany

Classnames to apply to the element.

styleany

CSS styles to apply to the element.

LinearGaugeOuterBarΒ 

NameTypeDefault
heightnumber

Height of the chart. Set by LinearGauge component.

widthnumber

Width of the chart. Set by LinearGauge component.

fillstring

Fill for the bar element.

'#484848'
Last updated on