diff --git a/reflex/components/recharts/cartesian.py b/reflex/components/recharts/cartesian.py index 372a662b5..641f25e9d 100644 --- a/reflex/components/recharts/cartesian.py +++ b/reflex/components/recharts/cartesian.py @@ -67,6 +67,9 @@ class Axis(Recharts): # Reverse the ticks or not. reversed: Var[bool] + # The label of axis, which appears next to the axis. + label: Var[Union[str, int, Dict[str, Any]]] + # If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function scale: Var[LiteralScale] diff --git a/reflex/components/recharts/cartesian.pyi b/reflex/components/recharts/cartesian.pyi index d4808739f..28ba7927d 100644 --- a/reflex/components/recharts/cartesian.pyi +++ b/reflex/components/recharts/cartesian.pyi @@ -36,6 +36,9 @@ class Axis(Recharts): axis_line: Optional[Union[Var[bool], bool]] = None, mirror: Optional[Union[Var[bool], bool]] = None, reversed: Optional[Union[Var[bool], bool]] = None, + label: Optional[ + Union[Var[Union[Dict[str, Any], int, str]], str, int, Dict[str, Any]] + ] = None, scale: Optional[ Union[ Var[ @@ -157,6 +160,7 @@ class Axis(Recharts): axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. reversed: Reverse the ticks or not. + label: The label of axis, which appears next to the axis. scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function unit: The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. name: The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. @@ -205,6 +209,9 @@ class XAxis(Axis): axis_line: Optional[Union[Var[bool], bool]] = None, mirror: Optional[Union[Var[bool], bool]] = None, reversed: Optional[Union[Var[bool], bool]] = None, + label: Optional[ + Union[Var[Union[Dict[str, Any], int, str]], str, int, Dict[str, Any]] + ] = None, scale: Optional[ Union[ Var[ @@ -328,6 +335,7 @@ class XAxis(Axis): axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. reversed: Reverse the ticks or not. + label: The label of axis, which appears next to the axis. scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function unit: The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. name: The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. @@ -375,6 +383,9 @@ class YAxis(Axis): axis_line: Optional[Union[Var[bool], bool]] = None, mirror: Optional[Union[Var[bool], bool]] = None, reversed: Optional[Union[Var[bool], bool]] = None, + label: Optional[ + Union[Var[Union[Dict[str, Any], int, str]], str, int, Dict[str, Any]] + ] = None, scale: Optional[ Union[ Var[ @@ -497,6 +508,7 @@ class YAxis(Axis): axis_line: If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line. mirror: If set true, flips ticks around the axis line, displaying the labels inside the chart instead of outside. reversed: Reverse the ticks or not. + label: The label of axis, which appears next to the axis. scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. 'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' | 'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function unit: The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart. name: The name of data displayed in the axis. This option will be used to represent an index in a scatter chart. diff --git a/reflex/components/recharts/general.py b/reflex/components/recharts/general.py index 8e2685914..5a6841c64 100644 --- a/reflex/components/recharts/general.py +++ b/reflex/components/recharts/general.py @@ -5,6 +5,7 @@ from __future__ import annotations from typing import Any, Dict, List, Union from reflex.components.component import MemoizationLeaf +from reflex.constants.colors import Color from reflex.event import EventHandler from reflex.vars import Var @@ -215,6 +216,12 @@ class LabelList(Recharts): # The offset to the specified "position" offset: Var[int] + # The color of the line stroke. + stroke: Var[Union[str, Color]] + + # The width of the line stroke. + fill: Var[Union[str, Color]] + responsive_container = ResponsiveContainer.create legend = Legend.create diff --git a/reflex/components/recharts/general.pyi b/reflex/components/recharts/general.pyi index f995bb7ee..7a0aa1071 100644 --- a/reflex/components/recharts/general.pyi +++ b/reflex/components/recharts/general.pyi @@ -6,6 +6,7 @@ from typing import Any, Callable, Dict, Literal, Optional, Union, overload from reflex.components.component import MemoizationLeaf +from reflex.constants.colors import Color from reflex.event import EventHandler, EventSpec from reflex.style import Style from reflex.vars import BaseVar, Var @@ -540,6 +541,8 @@ class LabelList(Recharts): ] ] = None, offset: Optional[Union[Var[int], int]] = None, + stroke: Optional[Union[Var[Union[Color, str]], str, Color]] = None, + fill: Optional[Union[Var[Union[Color, str]], str, Color]] = None, style: Optional[Style] = None, key: Optional[Any] = None, id: Optional[Any] = None, @@ -600,6 +603,8 @@ class LabelList(Recharts): data_key: The key of a group of label values in data. position: The position of each label relative to it view box。"Top" | "left" | "right" | "bottom" | "inside" | "outside" | "insideLeft" | "insideRight" | "insideTop" | "insideBottom" | "insideTopLeft" | "insideBottomLeft" | "insideTopRight" | "insideBottomRight" | "insideStart" | "insideEnd" | "end" | "center" offset: The offset to the specified "position" + stroke: The color of the line stroke. + fill: The width of the line stroke. style: The style of the component. key: A unique key for the component. id: The id for the component. diff --git a/reflex/utils/pyi_generator.py b/reflex/utils/pyi_generator.py index 942f1c201..f385796bd 100644 --- a/reflex/utils/pyi_generator.py +++ b/reflex/utils/pyi_generator.py @@ -159,7 +159,10 @@ def _get_type_hint(value, type_hint_globals, is_optional=True) -> str: ] ) - if value.__name__ not in type_hint_globals: + if ( + value.__module__ not in ["builtins", "__builtins__"] + and value.__name__ not in type_hint_globals + ): raise TypeError( f"{value.__module__ + '.' + value.__name__} is not a default import, " "add it to DEFAULT_IMPORTS in pyi_generator.py"