Reflex Cloud - Fast, secure & scalable hosting. One command to deploy.

Area Chart

A Recharts area chart displays quantitative data using filled areas between a line connecting data points and the axis.

Basic Example

Syncing Charts

The sync_id prop allows you to sync two graphs. In the example, it is set to "1" for both charts, indicating that they should be synchronized. This means that any interactions (such as brushing) performed on one chart will be reflected in the other chart.

Stacking Charts

The stack_id prop allows you to stack multiple graphs on top of each other. In the example, it is set to "1" for both charts, indicating that they should be stacked together. This means that the bars or areas of the charts will be vertically stacked, with the values of each chart contributing to the total height of the stacked areas or bars.

This is similar to the sync_id prop, but instead of synchronizing the interaction between the charts, it just stacks the charts on top of each other.

Multiple Axis

Multiple axes can be used for displaying different data series with varying scales or units on the same chart. This allows for a more comprehensive comparison and analysis of the data.

Layout

Use the layout prop to set the orientation to either "horizontal" (default) or "vertical".

Include margins around your graph to ensure proper spacing and enhance readability. By default, provide margins on all sides of the chart to create a visually appealing and functional representation of your data.

Stateful Example

Here is an example of an area graph with a State. Here we have defined a function randomize_data, which randomly changes the data for both graphs when the first defined area is clicked on using on_click=AreaState.randomize_data.

Curve Type:

API Reference

rx.recharts.AreaChart

An Area chart component in Recharts.

PropType | ValuesDefault
base_value
"dataMin" | "dataMax" | ...
"auto"
data
List
margin
Dict[str, Any]
sync_id
str
sync_method
"index" | "value"
"index"
layout
"vertical" | "horizontal"
"horizontal"
stack_offset
"expand" | "none" | ...
width
Union[str, int]
"100%"
height
Union[str, int]
"100%"

Valid Children

XAxisYAxisReferenceAreaReferenceDotReferenceLineBrushCartesianGridLegendGraphingTooltipAreaDefs

rx.recharts.Area

An Area component in Recharts.

PropType | ValuesDefault
stroke
Union[str, Color]
rx.color("accent", 9)
stroke_width
int
1
fill
Union[str, Color]
rx.color("accent", 5)
type_
"basis" | "basisClosed" | ...
"monotone"
dot
Union[Dict, bool]
False
active_dot
Union[Dict, bool]
{stroke: rx.color("accent", 2), fill: rx.color("accent", 10)}
label
bool
False
base_line
Union[str, List]
points
List
stack_id
Union[str, int]
connect_nulls
bool
False
layout
"vertical" | "horizontal"
data_key
Union[str, int]
x_axis_id
Union[str, int]
0
y_axis_id
Union[str, int]
0
legend_type
"line" | "plainline" | ...
is_animation_active
bool
True
animation_begin
int
0
animation_duration
int
1500
animation_easing
"ease" | "ease-in" | ...
"ease"
unit
Union[str, int]
name
Union[str, int]

Valid Children

LabelList

Event Triggers

See the full list of default event triggers
TriggerDescription
on_animation_start The customized event handler of animation start
on_animation_end The customized event handler of animation end