✨ Announcing our seed funding led by Lux Capital! Read more about it on our blog
DocsBlogChangelog

Search documentation...

/

Star

12k+

[ Learn ]

[ Concepts ]

[ Reference ]

Area


Area is a wrapper component that renders an area graph.

Data


Area accepts a data prop, which is an array of dictionaries with x and y keys. You can contruct your own data as input, or use the rx.data helper function to generate a data array from a x and y list.
data = rx.data(
    "area", x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 10]
)
Which will render as:
data = [
    {"x": 1, "y": 1},
    {"x": 2, "y": 2},
    {"x": 3, "y": 3},
    {"x": 4, "y": 4},
    {"x": 5, "y": 10},
]

Examples


The following example shows a basic rx.area component.
rx.area(
    data=rx.data(
        "area", x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 10]
    ),
)
Area also accepts a style prop, which is an object of style properties. Additionally you can specify the interpolation prop, which determines how data points should be connected when creating a path.
1.02.03.04.05.024681012
rx.chart(
    rx.area(
        data=rx.data(
            "area", x=[1, 2, 3, 4, 5], y=[1, 2, 3, 4, 10]
        ),
        style={
            "data": {
                "fill": "orange",
                "stroke": "black",
                "strokeWidth": 2,
            }
        },
    ),
    rx.area(
        data=rx.data(
            "area", x=[1, 2, 3, 4, 5], y=[5, 12, 4, 6, 1]
        ),
        style={
            "data": {
                "fill": "rgb(107,99,246)",
                "stroke": "black",
                "strokeWidth": 2,
                "opacity": 0.5,
            }
        },
        interpolation="natural",
    ),
    domain_padding={"y": 5},
)

Area


Display a victory area.


  • Base Event Triggers

← ChartBoxPlot →

Copyright © 2023 Pynecone, Inc.