Skip to content

Commit

Permalink
default props comment for Cartesian (#4114)
Browse files Browse the repository at this point in the history
* default props comment for Cartesian

* add animation events

* update
  • Loading branch information
carlosabadia authored Oct 10, 2024
1 parent 4a31439 commit ee3182a
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 16 deletions.
30 changes: 27 additions & 3 deletions reflex/components/recharts/cartesian.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,39 @@ class Cartesian(Recharts):
# The key of a group of data which should be unique in an area chart.
data_key: Var[Union[str, int]]

# The id of x-axis which is corresponding to the data.
# The id of x-axis which is corresponding to the data. Default: 0
x_axis_id: Var[Union[str, int]]

# The id of y-axis which is corresponding to the data.
# The id of y-axis which is corresponding to the data. Default: 0
y_axis_id: Var[Union[str, int]]

# The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional
# The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional
legend_type: Var[LiteralLegendType]

# If set false, animation of bar will be disabled. Default: True
is_animation_active: Var[bool]

# Specifies when the animation should begin, the unit of this option is ms. Default: 0
animation_begin: Var[int]

# Specifies the duration of animation, the unit of this option is ms. Default: 1500
animation_duration: Var[int]

# The type of easing function. Default: "ease"
animation_easing: Var[LiteralAnimationEasing]

# The unit of data. This option will be used in tooltip.
unit: Var[Union[str, int]]

# The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
name: Var[Union[str, int]]

# The customized event handler of animation start
on_animation_start: EventHandler[lambda: []]

# The customized event handler of animation end
on_animation_end: EventHandler[lambda: []]

# The customized event handler of click on the component in this group
on_click: EventHandler[empty_event]

Expand Down
112 changes: 99 additions & 13 deletions reflex/components/recharts/cartesian.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -726,12 +726,29 @@ class Cartesian(Recharts):
],
]
] = None,
is_animation_active: Optional[Union[Var[bool], bool]] = None,
animation_begin: Optional[Union[Var[int], int]] = None,
animation_duration: Optional[Union[Var[int], int]] = None,
animation_easing: Optional[
Union[
Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"],
Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]],
]
] = None,
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
on_animation_end: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_animation_start: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_context_menu: Optional[
Expand Down Expand Up @@ -775,9 +792,15 @@ class Cartesian(Recharts):
*children: The children of the component.
layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'
data_key: The key of a group of data which should be unique in an area chart.
x_axis_id: The id of x-axis which is corresponding to the data.
y_axis_id: The id of y-axis which is corresponding to the data.
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional
x_axis_id: The id of x-axis which is corresponding to the data. Default: 0
y_axis_id: The id of y-axis which is corresponding to the data. Default: 0
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional
is_animation_active: If set false, animation of bar will be disabled. Default: True
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
animation_easing: The type of easing function. Default: "ease"
unit: The unit of data. This option will be used in tooltip.
name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
Expand Down Expand Up @@ -894,12 +917,29 @@ class Area(Cartesian):
],
]
] = None,
is_animation_active: Optional[Union[Var[bool], bool]] = None,
animation_begin: Optional[Union[Var[int], int]] = None,
animation_duration: Optional[Union[Var[int], int]] = None,
animation_easing: Optional[
Union[
Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"],
Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]],
]
] = None,
unit: Optional[Union[Var[Union[int, str]], int, str]] = None,
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
on_animation_end: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_animation_start: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_context_menu: Optional[
Expand Down Expand Up @@ -954,9 +994,15 @@ class Area(Cartesian):
connect_nulls: Whether to connect a graph area across null points. Default: False
layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'
data_key: The key of a group of data which should be unique in an area chart.
x_axis_id: The id of x-axis which is corresponding to the data.
y_axis_id: The id of y-axis which is corresponding to the data.
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional
x_axis_id: The id of x-axis which is corresponding to the data. Default: 0
y_axis_id: The id of y-axis which is corresponding to the data. Default: 0
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional
is_animation_active: If set false, animation of bar will be disabled. Default: True
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
animation_easing: The type of easing function. Default: "ease"
unit: The unit of data. This option will be used in tooltip.
name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
Expand Down Expand Up @@ -1029,12 +1075,27 @@ class Bar(Cartesian):
],
]
] = None,
is_animation_active: Optional[Union[Var[bool], bool]] = None,
animation_begin: Optional[Union[Var[int], int]] = None,
animation_duration: Optional[Union[Var[int], int]] = None,
animation_easing: Optional[
Union[
Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"],
Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]],
]
] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
on_animation_end: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_animation_start: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_context_menu: Optional[
Expand Down Expand Up @@ -1084,15 +1145,19 @@ class Bar(Cartesian):
stack_id: The stack id of bar, when two bars have the same value axis and same stack_id, then the two bars are stacked in order.
unit: The unit of data. This option will be used in tooltip.
min_point_size: The minimal height of a bar in a horizontal BarChart, or the minimal width of a bar in a vertical BarChart. By default, 0 values are not shown. To visualize a 0 (or close to zero) point, set the minimal point size to a pixel value like 3. In stacked bar charts, minPointSize might not be respected for tightly packed values. So we strongly recommend not using this prop in stacked BarCharts.
name: The name of data. This option will be used in tooltip and legend to represent a bar. If no value was set to this option, the value of dataKey will be used alternatively.
name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
bar_size: Size of the bar (if one bar_size is set then a bar_size must be set for all bars)
max_bar_size: Max size of the bar
radius: If set a value, the option is the radius of all the rounded corners. If set a array, the option are in turn the radiuses of top-left corner, top-right corner, bottom-right corner, bottom-left corner. Default: 0
layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'
data_key: The key of a group of data which should be unique in an area chart.
x_axis_id: The id of x-axis which is corresponding to the data.
y_axis_id: The id of y-axis which is corresponding to the data.
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional
x_axis_id: The id of x-axis which is corresponding to the data. Default: 0
y_axis_id: The id of y-axis which is corresponding to the data. Default: 0
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional
is_animation_active: If set false, animation of bar will be disabled. Default: True
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
animation_easing: The type of easing function. Default: "ease"
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
Expand Down Expand Up @@ -1207,12 +1272,28 @@ class Line(Cartesian):
],
]
] = None,
is_animation_active: Optional[Union[Var[bool], bool]] = None,
animation_begin: Optional[Union[Var[int], int]] = None,
animation_duration: Optional[Union[Var[int], int]] = None,
animation_easing: Optional[
Union[
Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"],
Var[Literal["ease", "ease-in", "ease-in-out", "ease-out", "linear"]],
]
] = None,
name: Optional[Union[Var[Union[int, str]], int, str]] = None,
style: Optional[Style] = None,
key: Optional[Any] = None,
id: Optional[Any] = None,
class_name: Optional[Any] = None,
autofocus: Optional[bool] = None,
custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
on_animation_end: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_animation_start: Optional[
Union[EventHandler, EventSpec, list, Callable, Var]
] = None,
on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
on_context_menu: Optional[
Expand Down Expand Up @@ -1267,9 +1348,14 @@ class Line(Cartesian):
stroke_dasharray: The pattern of dashes and gaps used to paint the line.
layout: The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'
data_key: The key of a group of data which should be unique in an area chart.
x_axis_id: The id of x-axis which is corresponding to the data.
y_axis_id: The id of y-axis which is corresponding to the data.
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none'optional
x_axis_id: The id of x-axis which is corresponding to the data. Default: 0
y_axis_id: The id of y-axis which is corresponding to the data. Default: 0
legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye' | 'none' optional
is_animation_active: If set false, animation of bar will be disabled. Default: True
animation_begin: Specifies when the animation should begin, the unit of this option is ms. Default: 0
animation_duration: Specifies the duration of animation, the unit of this option is ms. Default: 1500
animation_easing: The type of easing function. Default: "ease"
name: The name of data. This option will be used in tooltip and legend to represent the component. If no value was set to this option, the value of dataKey will be used alternatively.
style: The style of the component.
key: A unique key for the component.
id: The id for the component.
Expand Down

0 comments on commit ee3182a

Please sign in to comment.