Reflex Logo

Intro

Gallery

Hosting

Components

New

Learn

Components

API Reference

Onboarding

Library

/

Graphing

/

Funnelchart

A funnel chart is a graphical representation used to visualize how data moves through a process. In a funnel chart, the dependent variable’s value diminishes in the subsequent stages of the process. It can be used to demonstrate the flow of users through for example a business or sales process.

rx.recharts.funnel_chart(
    rx.recharts.funnel(
        rx.recharts.label_list(
            position="right",
            data_key="name",
            fill="#000",
            stroke="none",
        ),
        rx.recharts.label_list(
            position="right",
            data_key="name",
            fill="#000",
            stroke="none",
        ),
        data_key="value",
        data=data,
    ),
    rx.recharts.graphing_tooltip(),
    width=730,
    height=250,
)

Here is an example of a funnel chart with a State. Here we have defined a function randomize_data, which randomly changes the data when the graph is clicked on using on_click=FunnelState.randomize_data.

class FunnelState(rx.State):
    data = data

    def randomize_data(self):
        self.data[0]["value"] = 100
        for i in range(len(self.data) - 1):
            self.data[i + 1]["value"] = self.data[i][
                "value"
            ] - random.randint(0, 20)


def index():
    return rx.recharts.funnel_chart(
        rx.recharts.funnel(
            rx.recharts.label_list(
                position="right",
                data_key="name",
                fill="#000",
                stroke="none",
            ),
            data_key="value",
            data=FunnelState.data,
            on_click=FunnelState.randomize_data,
        ),
        rx.recharts.graphing_tooltip(),
        width=1000,
        height=250,
    )

A Funnel chart component in Recharts.

PropTypeDescriptionValues
dataList

The source data, in which each element is an object.

sync_idstr

If any two categorical charts(rx.line_chart, rx.area_chart, rx.bar_chart, rx.composed_chart) have the same sync_id, these two charts can sync the position GraphingTooltip, and the start_index, end_index of Brush.

sync_methodstr

When sync_id is provided, allows customisation of how the charts will synchronize GraphingTooltips and brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array. In cases where data does not have the same length, this might yield unexpected results. In that case use 'value' which will try to match other charts values, or a fully custom function which will receive tick, data as argument and should return an index. 'index' | 'value' | function

widthUnion

The width of chart container. String or Integer

heightUnion

The height of chart container.

layoutstr

The layout of area in the chart. 'horizontal' | 'vertical'

marginDict

The sizes of whitespace around the chart.

stack_offsetLiteral

The type of offset function used to generate the lower and upper values in the series array. The four types are built-in offsets in d3-shape. 'expand' | 'none' | 'wiggle' | 'silhouette'

layoutstr

The layout of bars in the chart. centeric

Valid Children

  • Legend
  • GraphingTooltip
  • Funnel

A Funnel component in Recharts.

PropTypeDescriptionValues
dataList

The source data, in which each element is an object.

animation_beginint

Specifies when the animation should begin, the unit of this option is ms.

animation_durationint

Specifies the duration of animation, the unit of this option is ms.

animation_easingLiteral

The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'

layoutLiteral

The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'

data_keyUnion

The key of a group of data which should be unique in an area chart.

x_axis_idUnion

The id of x-axis which is corresponding to the data.

y_axis_idUnion

The id of y-axis which is corresponding to the data.

Valid Children

  • LabelList
  • Cell
← ErrorbarLabel →

Did you find this useful?

HomeGalleryChangelogIntroductionHosting