Skip to main content
TypeScript types specific to chart components and graphical elements.

Axis types

AxisDomainTypeInput

The type of axis, provided by users in props.
Options:
  • category - Treats data as distinct values. Each value is in the same distance from its neighbors, regardless of their actual numeric difference.
  • number - Treats data as continuous range. Values that are numerically closer are placed closer together on the axis.
  • auto - The type is inferred based on the chart layout.
Example:

AxisInterval

Defines how ticks are placed and whether/how tick collisions are handled.
Options:
  • number - Show every nth tick
  • preserveStart - Keeps the left tick on collision, ensures first tick is always shown
  • preserveEnd - Keeps the right tick on collision, ensures last tick is always shown
  • preserveStartEnd - Keeps the left tick on collision, ensures first and last ticks always show
  • equidistantPreserveStart - Selects a number N such that every nth tick will be shown without collision
  • equidistantPreserveEnd - Selects a number N such that every nth tick will be shown, ensuring the last tick is always visible
Example:

TickItem

Represents a single tick on an axis.
Properties:
  • value - The data value of this tick
  • coordinate - The pixel coordinate where this tick is rendered
  • index - The index of this tick in the ticks array
  • offset - How far this tick is offset from the start of a category band (always zero for non-band axes)
Example:

Scale types

ScaleType

String shortcuts for scale types.
Example:

Dot and shape types

ActiveDotType

The type of activeDot prop on Area, Line, and Radar components.
Options:
  • boolean - true or false turns the default active dot on or off
  • function - Custom React component (should return an SVG element)
  • object - Props appended to the default active dot
  • ReactElement - Element that will be cloned with new props
Example:

DotType

The type of dot prop on Area, Line, and Radar components.
Example:

ActiveShape

Type for active shapes in Pie, RadialBar, and other components.
Example:

Data types

DataKey

Extracts values from data objects.
Can be:
  • string - The name of the field in the data object
  • number - The index of the field in the data
  • function - A function that receives the data object and returns the value
Example:

TooltipEventType

Determines how tooltip interacts with the chart.
Options:
  • axis - All graphical items belonging to this axis tick will be highlighted, and all will be present in the tooltip. Tooltip displays when hovering on the chart background.
  • item - Only the one graphical item being hovered will show in the tooltip. Tooltip displays when hovering over individual graphical items.

ViewBox types

CartesianViewBox

PolarViewBox

ViewBox

Union of Cartesian and Polar view boxes with all properties required.