Skip to Content
Docsβš™οΈ ⏐ UtilsAxis

Axis

In REAVIZ, an axis is a fundamental component of a chart, providing a reference framework for plotting data points. Axes help in organizing and displaying data in a clear and structured manner, allowing for easy interpretation and analysis.

Types supported by reaviz:

  • Linear Axis - A linear axis is used in most charts to represent data along horizontal (x-axis) and vertical (y-axis) lines.
  • Radial Axis - A radial axis is used in radial charts to represent data in a circular format.

Where to use:

  • Linear Axes: Use linear axes for charts that require data to be displayed along straight lines, such as line charts, bar charts, and scatter plots.
  • Radial Axes: Use radial axes for charts that display data in a circular layout, such as radial bar charts and radial area charts.

Examples

Linear

Advanced Label Positioning

Radial

API

LinearAxisΒ 

NameTypeDefault
heightnumber

Height of the axis. Set internally by the parent chart.

widthnumber

Width of the axis. Set internally by the parent chart.

domainChartDataTypes[]

Explicit domain to use for the axis.

scaledboolean

Whether the axis is already scaled.

false
roundDomainsboolean

Whether to round the domain values.

false
type"value" | "time" | "category" | "duration"

Type of the axis.

position"start" | "end" | "center"

Position of the axis relative to the chart area.

tickSeriesReactElement<LinearAxisTickSeriesProps, FC<Partial<LinearAxisTickSeriesProps>>>

The tick series component for the axis.

axisLineReactElement<LinearAxisLineProps, FC<Partial<LinearAxisLineProps>>> | null

The axis line component.

`<LinearAxisLine />`
scaleany

D3 scale for the axis. Set internally by the parent chart.

visibility"visible" | "hidden"

Visibility of the axis.

'visible'
orientation"horizontal" | "vertical"

Orientation of the axis.

onDimensionsChange(event: LinearAxisDimensionChanged) => void

Fires when the axis dimensions change.

LinearAxisLineΒ 

NameTypeDefault
heightnumber
widthnumber
strokeColorstring

Stroke color of the axis line.

'#8F979F'
strokeWidthnumber

Stroke width of the axis line.

1
strokeGradientReactElement<GradientProps, FC<Partial<GradientProps>>> | null

Optional gradient to apply to the axis line stroke.

scaleany
orientation"horizontal" | "vertical"
classNamestring

LinearAxisTickLabelΒ 

NameTypeDefault
textstring

Text content (possibly ellipsized) for the label. Set internally by LinearAxisTickSeries.

fullTextstring

Original, unellipsized text for the label. Set internally by LinearAxisTickSeries.

dataany

The raw data value for this tick (e.g., Date object, number, string).

anglenumber

Rotation angle of the label in degrees. Set internally by LinearAxisTickSeries.

orientation"horizontal" | "vertical"

Orientation of the axis. Set internally by LinearAxisTickSeries.

half"start" | "end" | "center"

Which half of the axis this label belongs to. Set internally by LinearAxisTickSeries.

lineReactElement<LinearAxisTickLineProps, FC<Partial<LinearAxisTickLineProps>>>

The companion tick line element. Set internally by LinearAxisTickSeries.

format(v: any) => any

Custom formatter for the label value.

formatTooltip(value: any) => any

Format tooltip title on hover label.

fillstring

Text fill color.

'#8F979F'
fontSizenumber

Font size of the label.

11
fontFamilystring

Font family of the label.

'sans-serif'
rotationnumber | boolean

Whether to rotate the label.

true
paddingnumber | { fromAxis: number; alongAxis: number; }

Padding between the axis and the label.

5
textAnchor"start" | "end" | "middle"

Optional override for the text anchor.

position"start" | "end" | "center"

Position of the label relative to the tick.

align"start" | "end" | "center" | "inside" | "outside"

Alignment of the label relative to the axis.

'center'
classNamestring

CSS class to apply.

onClick(event: MouseEvent<SVGGElement, MouseEvent>, data: any) => void

Click handler for the label.

LinearAxisTickLineΒ 

NameTypeDefault
heightnumber

Height of the axis. Set internally by the parent component.

widthnumber

Width of the axis. Set internally by the parent component.

orientation"horizontal" | "vertical"

Orientation of the axis. Set internally by the parent component.

sizenumber

Size of the tick line.

5
strokeColorstring

Stroke color of the tick line.

'#8F979F'
strokeWidthnumber

Stroke width of the tick line.

1
position"start" | "end" | "center"

Position of the tick line relative to the axis.

classNamestring

CSS class to apply.

LinearAxisTickSeriesΒ 

NameTypeDefault
heightnumber

Height of the axis. Set internally by LinearAxis.

widthnumber

Width of the axis. Set internally by LinearAxis.

scaleany

D3 scale for the axis. Set internally by LinearAxis.

intervalnumber | TimeInterval

Optional interval used to override the tick count.

tickSizenumber

Size of each tick interval.

30
tickValuesany[]

Explicit tick values. When provided, overrides automatic tick selection.

orientation"horizontal" | "vertical"

Orientation of the axis. Set internally by LinearAxis.

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

The tick label component.

`<LinearAxisTickLabel />`
lineReactElement<LinearAxisTickLineProps, FC<Partial<LinearAxisTickLineProps>>> | null

The tick line component.

`<LinearAxisTickLine height={10} width={10} orientation="horizontal" position="center" />`
axisLinearAxisProps

Parent axis props. Set internally by LinearAxis.

ellipsisLengthnumber

The maximum length for ellipsizing tick labels.

18

RadialAxisΒ 

NameTypeDefault
heightnumber

Height of the axis.

widthnumber

Width of the axis.

xScaleany

Scale to use for the axis.

innerRadiusnumber

Inner radius of the axis.

10
type"value" | "time" | "category"

Type of the axis.

'value'
arcsReactElement<RadialAxisArcSeriesProps, FC<Partial<RadialAxisArcSeriesProps>>> | null

Arc element to render.

`<RadialAxisArcSeries />`
ticksReactElement<RadialAxisTickSeriesProps, FC<Partial<RadialAxisTickSeriesProps>>> | null

Tick element to render.

`<RadialAxisTickSeries />`
startAnglenumber

Start angle for the first value.

0
endAnglenumber

End angle for the last value.

2 * Math.PI

RadialAxisTickΒ 

NameTypeDefault
scaleany

Scale to use for the tick.

outerRadiusnumber

Outer radius of the arc.

innerRadiusnumber

Inner radius of the arc.

paddingnumber

Padding between the tick and the label.

0
dataany

Data to render.

indexnumber

Index of the tick.

lineReactElement<RadialAxisTickLineProps, FC<Partial<RadialAxisTickLineProps>>> | null

Line element to render.

`<RadialAxisTickLine />`
labelReactElement<RadialAxisTickLabelProps, FC<Partial<RadialAxisTickLabelProps>>> | null

Label element to render.

`<RadialAxisTickLabel />`
startAnglenumber

Start angle for the first value.

endAnglenumber

End angle for the last value.

RadialAxisTickLabelΒ 

NameTypeDefault
dataany

Data to render.

lineSizenumber

Size of the line.

fillstring

Color of the text.

'#71808d'
fontSizenumber

Font size of the text.

11
rotationnumber

Rotation of the text.

fontFamilystring

Font family of the text.

'sans-serif'
indexnumber

Index of the tick.

paddingnumber

Padding of the tick.

15
pointany

Point of the tick.

autoRotateboolean

Auto rotate the text.

true
format(value: any, index: number) => any

Format of the label.

formatTooltip(value: any, index: number) => any

Format tooltip title on hover label.

onClick(event: MouseEvent<SVGGElement, MouseEvent>, value: any) => void

Click handler for the label.

RadialAxisTickLineΒ 

NameTypeDefault
sizenumber

Size of the tick line.

10
strokestring

Stroke color of the tick line.

'rgba(113, 128, 141, .5)'
innerRadiusnumber

Inner radius of the arc.

outerRadiusnumber

Outer radius of the arc.

position"inside" | "outside"

Position of the tick line.

'inside'

RadialAxisTickSeriesΒ 

NameTypeDefault
scaleany

Scale to use for the tick.

countnumber

Number of ticks to render.

12
intervalnumber | TimeInterval

Interval between ticks.

tickValuesany[]

Tick values to render.

outerRadiusnumber

Outer radius of the arc.

type"value" | "category" | "time" | "duration"

Type of the axis.

'time'
innerRadiusnumber

Inner radius of the arc.

tick((tick: TickCallback) => ReactElement<RadialAxisTickProps, FC<Partial<RadialAxisTickProps>>>) | ReactElement<...>

Tick element to render.

`<RadialAxisTick />`
startAnglenumber

Start angle for the first value.

0
endAnglenumber

End angle for the last value.

2 * Math.PI

RadialAxisArcΒ 

NameTypeDefault
indexnumber

Index of the arc.

scaleany

Scale to use for the arc.

strokestring | ((index: number) => string)

Stroke color of the arc.

'#71808d'
strokeDasharraystring | ((index: number) => string)

Stroke dash array of the arc.

'1,4'
startAnglenumber

Start angle for the first value.

0
endAnglenumber

End angle for the last value.

2 * Math.PI

RadialAxisArcLineΒ 

NameTypeDefault
strokestring | ((index: number) => string)

Stroke color of the arc.

'#71808d'
data{ x: number; y: number; }[]

Data to render the line.

indexnumber

Index of the arc.

RadialAxisArcSeriesΒ 

NameTypeDefault
arcReactElement<RadialAxisArcProps, FC<Partial<RadialAxisArcProps>>>

Arc element to render.

`<RadialAxisArc />`
lineReactElement<RadialAxisArcLineProps, FC<Partial<RadialAxisArcLineProps>>>

Line element to render.

countnumber

Number of arcs to render.

12
innerRadiusnumber

Inner radius of the arc.

outerRadiusnumber

Outer radius of the arc.

tickValuesany[]

Calculated tick values by the Radial Axis.

startAnglenumber

Start angle for the first value.

0
endAnglenumber

End angle for the last value.

2 * Math.PI
Last updated on