diff --git a/reflex/components/recharts/polar.py b/reflex/components/recharts/polar.py index 2451e224f..5e95fb1cd 100644 --- a/reflex/components/recharts/polar.py +++ b/reflex/components/recharts/polar.py @@ -106,36 +106,50 @@ class Radar(Recharts): # The coordinates of all the vertexes of the radar shape, like [{ x, y }]. points: Var[List[Dict[str, Any]]] - # If false set, dots will not be drawn + # If false set, dots will not be drawn. Default: True dot: Var[bool] - # Stoke color + # Stoke color. Default: rx.color("accent", 9) stroke: Var[Union[str, Color]] = LiteralVar.create(Color("accent", 9)) - # Fill color + # Fill color. Default: rx.color("accent", 3) fill: Var[str] = LiteralVar.create(Color("accent", 3)) - # opacity + # opacity. Default: 0.6 fill_opacity: Var[float] = LiteralVar.create(0.6) - # The type of icon in legend. If set to 'none', no legend item will be rendered. - legend_type: Var[str] + # The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect" + legend_type: Var[LiteralLegendType] - # If false set, labels will not be drawn + # If false set, labels will not be drawn. Default: True label: Var[bool] - # Specifies when the animation should begin, the unit of this option is ms. + # If set false, animation of polygon will be disabled. Default: True in CSR, and False in SSR + 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. + # Specifies the duration of animation, the unit of this option is ms. Default: 1500 animation_duration: Var[int] - # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' + # The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default: "ease" animation_easing: Var[LiteralAnimationEasing] # Valid children components _valid_children: List[str] = ["LabelList"] + def get_event_triggers(self) -> dict[str, Union[Var, Any]]: + """Get the event triggers that pass the component's value to the handler. + + Returns: + A dict mapping the event trigger to the var that is passed to the handler. + """ + return { + EventTriggers.ON_ANIMATION_START: lambda: [], + EventTriggers.ON_ANIMATION_END: lambda: [], + } + class RadialBar(Recharts): """A RadialBar chart component in Recharts.""" diff --git a/reflex/components/recharts/polar.pyi b/reflex/components/recharts/polar.pyi index 0e023f62e..32e7e5b76 100644 --- a/reflex/components/recharts/polar.pyi +++ b/reflex/components/recharts/polar.pyi @@ -126,6 +126,7 @@ class Pie(Recharts): ... class Radar(Recharts): + def get_event_triggers(self) -> dict[str, Union[Var, Any]]: ... @overload @classmethod def create( # type: ignore @@ -137,8 +138,40 @@ class Radar(Recharts): stroke: Optional[Union[Color, Var[Union[Color, str]], str]] = None, fill: Optional[Union[Var[str], str]] = None, fill_opacity: Optional[Union[Var[float], float]] = None, - legend_type: Optional[Union[Var[str], str]] = None, + legend_type: Optional[ + Union[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ], + Var[ + Literal[ + "circle", + "cross", + "diamond", + "line", + "none", + "plainline", + "rect", + "square", + "star", + "triangle", + "wye", + ] + ], + ] + ] = None, label: Optional[Union[Var[bool], bool]] = 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[ @@ -153,39 +186,10 @@ class Radar(Recharts): class_name: Optional[Any] = None, autofocus: Optional[bool] = None, custom_attrs: Optional[Dict[str, Union[Var, str]]] = 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[ + on_animation_end: Optional[ Union[EventHandler, EventSpec, list, Callable, Var] ] = None, - on_double_click: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_mouse_down: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_enter: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_leave: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_move: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_out: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_over: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_mouse_up: Optional[ - Union[EventHandler, EventSpec, list, Callable, Var] - ] = None, - on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None, - on_unmount: Optional[ + on_animation_start: Optional[ Union[EventHandler, EventSpec, list, Callable, Var] ] = None, **props, @@ -196,15 +200,16 @@ class Radar(Recharts): *children: The children of the component. data_key: The key of a group of data which should be unique in a radar chart. points: The coordinates of all the vertexes of the radar shape, like [{ x, y }]. - dot: If false set, dots will not be drawn - stroke: Stoke color - fill: Fill color - fill_opacity: opacity - legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. - label: If false set, labels will not be drawn - animation_begin: Specifies when the animation should begin, the unit of this option is ms. - animation_duration: Specifies the duration of animation, the unit of this option is ms. - animation_easing: The type of easing function. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' + dot: If false set, dots will not be drawn. Default: True + stroke: Stoke color. Default: rx.color("accent", 9) + fill: Fill color. Default: rx.color("accent", 3) + fill_opacity: opacity. Default: 0.6 + legend_type: The type of icon in legend. If set to 'none', no legend item will be rendered. Default: "rect" + label: If false set, labels will not be drawn. Default: True + is_animation_active: If set false, animation of polygon will be disabled. Default: True in CSR, and False in SSR + 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. 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'. Default: "ease" style: The style of the component. key: A unique key for the component. id: The id for the component.