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

Search documentation...

/

Star

12k+

[ Learn ]

[ Concepts ]

[ Reference ]

BoxPlot


BoxPlot is a wrapper component that renders a box plot graph.

Data


BoxPlot accepts a data prop, which is an array of dictionaries with x and y keys. The y key should be a list of lists, where each list represents a box plot. Repeat x values will be grouped together. 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(
    "box_plot",
    x=[1, 2, 3, 4, 5],
    y=[
        [1, 2, 3, 4, 10],
        [5, 12, 4, 6, 1],
        [1, 2, 3, 4, 10],
        [5, 12, 4, 6, 1],
        [1, 2, 3, 4, 10],
    ],
)
Which will render as:
data = [
    {"x": 1, "y": [1, 2, 3, 4, 10]},
    {"x": 2, "y": [5, 12, 4, 6, 1]},
    {"x": 3, "y": [1, 2, 3, 4, 10]},
    {"x": 4, "y": [5, 12, 4, 6, 1]},
    {"x": 5, "y": [1, 2, 3, 4, 10]},
]

Examples


The following example shows a basic rx.box_plot component.
1.02.03.04.05.024681012
rx.chart(
    rx.box_plot(
        data=rx.data(
            "box_plot",
            x=[1, 2, 3, 4, 5],
            y=[
                [1, 2, 3, 4, 10],
                [5, 12, 4, 6, 1],
                [1, 2, 3, 4, 10],
                [5, 12, 4, 6, 1],
                [1, 2, 3, 4, 10],
            ],
        ),
    ),
    domain_padding={"x": 15, "y": 5},
)
BoxPlot also accepts a style prop, which is an object of style properties.
1.02.03.04.05.024681012
rx.chart(
    rx.box_plot(
        data=rx.data(
            "box_plot",
            x=[1, 2, 3, 4, 5],
            y=[
                [1, 2, 3, 4, 10],
                [5, 12, 4, 6, 1],
                [1, 2, 3, 4, 10],
                [5, 12, 4, 6, 1],
                [1, 2, 3, 4, 10],
            ],
        ),
        style={
            "min": {"stroke": "tomato"},
            "max": {"stroke": "orange"},
            "q1": {"fill": "tomato"},
            "q3": {"fill": "orange"},
            "median": {"stroke": "white", "strokeWidth": 5},
        },
    ),
    domain_padding={"x": 15, "y": 5},
)

BoxPlot


Display a victory boxplot.


  • Base Event Triggers

← AreaCandlestick →

Copyright © 2023 Pynecone, Inc.