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

Search documentation...

/

Star

12k+

[ Learn ]

[ Concepts ]

[ Reference ]

Pie


Pie is a wrapper component that renders a pie graph.

Data


Pie 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(
    "pie",
    x=["Cats", "Dogs", "Birds", "Fish", "Reptiles"],
    y=[1, 2, 3, 10, 4],
)
Which will render as:
data = [
    {"x": "Cats", "y": 1},
    {"x": "Dogs", "y": 2},
    {"x": "Birds", "y": 3},
    {"x": "Fish", "y": 10},
    {"x": "Reptiles", "y": 4},
]

Examples


The following example shows a basic rx.pie component.
CatsDogsBirdsFishReptiles
rx.pie(
    data=rx.data(
        "pie",
        x=["Cats", "Dogs", "Birds", "Fish", "Reptiles"],
        y=[1, 2, 3, 10, 4],
    ),
)
Pie also accepts a color_scale prop, which is a string that determines the color scale used to color the pie slices.
CatsDogsBirdsFishReptiles
rx.pie(
    data=rx.data(
        "pie",
        x=["Cats", "Dogs", "Birds", "Fish", "Reptiles"],
        y=[1, 2, 3, 10, 4],
    ),
    color_scale="qualitative",
    pad_angle=5.0,
    inner_radius=100.0,
    start_angle=90.0,
)

Pie


Display a victory pie.


  • Base Event Triggers

← HistogramPolar →

Copyright © 2023 Pynecone, Inc.