The BarChart component. Loaded by the Chart renderer and displayed by passing type "bar".

Parameters:
NameTypeDescription
animationDurationnumber

The duration of the reveal animation in milliseconds.

barChartPropsobject

The props to pass to the BarChart container (can also override the presets we use). Check Recharts docs for all available.

barPropsobject

The props to pass to each Bar (can also override the presets we use). Recharts event handlers are composed with the chart-level callback props rather than replaced. Check Recharts docs for all available.

cartesianGridPropsobject

The props to pass to the CartesianGrid (can also override the presets we use). Check Recharts docs for all available.

checkboxPropsobject

The props to pass to each Checkbox. Check our docs for all available.

childrennode

Any additional content to display below the chart.

customAttributesobject

Custom attributes to apply to the chart wrapper.

customClassesstring | array | object

Custom classes to apply to the chart wrapper.

customIntervalfunction

Custom function to calculate the x-axis tick interval.

dataarray

The data to display in the chart. Check Recharts docs for formats.

gridColorstring

The color of the grid lines and the x and y axis.

heightnumber | string

The height of the chart.

legendPropsobject

The props to pass to the Legend (can also override the presets we use). Check Recharts docs for all available.

normalizedboolean

Whether to render a normalized (100%) stacked chart.

onBarClickfunction

Callback fired when a bar is clicked. Receives { data, index, dataKey, event }.

onMouseEnterfunction

Callback fired when a bar is hovered. Receives { data, index, dataKey, event }.

onMouseLeavefunction

Callback fired when the mouse leaves a bar. Receives { data, index, dataKey, event }.

onMouseDownfunction

Callback fired when a bar is pressed. Receives { data, index, dataKey, event }.

onMouseUpfunction

Callback fired when a bar press ends. Receives { data, index, dataKey, event }.

optionsarray

The options to display as checkboxes to toggle the visibility of each data set. Supports per-series color, hoverColor, stackId, name, legendType, hide, radius, activeBar (object or false), barLabel, and barProps (Recharts event handlers are composed with chart-level callbacks).

showCheckboxesboolean

Whether to show the checkboxes to toggle the visibility of each data set.

showLegendboolean

Whether to show the legend.

stackedboolean

Whether to stack bars or display them side by side.

tooltipPropsobject

The props to pass to the Tooltip (can also override the presets we use). Check Recharts docs for all available.

tooltipSharedboolean

Whether the tooltip is shared across series at the same category.

widthnumber | string

The width of the chart.

xAxisPropsobject

The props to pass to the XAxis (can also override the presets we use). Check Recharts docs for all available.

yAxisPropsobject

The props to pass to the YAxis (can also override the presets we use). Check Recharts docs for all available.

refobject

The reference to the chart component.

Since
  • 6.6.3
Returns:

The BarChart component.

Type: 
JSX.Element | null

Methods

(inner) handleCheckboxChange(dataKey) → {void}

Toggles visibility of a data series via checkbox.

Parameters:
NameTypeDescription
dataKeystring

The data key to toggle.

Since
  • 6.6.3
Returns:
Type: 
void

(inner) updateInterval() → {void}

Updates the x-axis tick interval based on viewport width.

Since
  • 6.6.3
Returns:
Type: 
void