浏览代码

small update to fix radial bar chart (#3468)

* small update to fix radial bar chart

* update add data prop to radar

---------

Co-authored-by: Tom Gotsman <tomgotsman@toms-mbp.lan>
Tom Gotsman 11 月之前
父节点
当前提交
ccf617ba85

+ 6 - 0
reflex/components/recharts/charts.py

@@ -287,6 +287,9 @@ class RadarChart(ChartBase):
 
     alias = "RechartsRadarChart"
 
+    # The source data, in which each element is an object.
+    data: Var[List[Dict[str, Any]]]
+
     # The sizes of whitespace around the chart.
     margin: Var[Dict[str, Any]]
 
@@ -338,6 +341,9 @@ class RadialBarChart(ChartBase):
 
     alias = "RechartsRadialBarChart"
 
+    # The source data which each element is an object.
+    data: Var[List[Dict[str, Any]]]
+
     # The sizes of whitespace around the chart.
     margin: Var[Dict[str, Any]]
 

+ 4 - 0
reflex/components/recharts/charts.pyi

@@ -511,6 +511,7 @@ class RadarChart(ChartBase):
     def create(  # type: ignore
         cls,
         *children,
+        data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None,
         margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None,
         cx: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None,
         cy: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None,
@@ -541,6 +542,7 @@ class RadarChart(ChartBase):
 
         Args:
             *children: The children of the chart component.
+            data: The source data, in which each element is an object.
             margin: The sizes of whitespace around the chart.
             cx: The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage
             cy: The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage
@@ -570,6 +572,7 @@ class RadialBarChart(ChartBase):
     def create(  # type: ignore
         cls,
         *children,
+        data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None,
         margin: Optional[Union[Var[Dict[str, Any]], Dict[str, Any]]] = None,
         cx: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None,
         cy: Optional[Union[Var[Union[int, str]], Union[int, str]]] = None,
@@ -603,6 +606,7 @@ class RadialBarChart(ChartBase):
 
         Args:
             *children: The children of the chart component.
+            data: The source data which each element is an object.
             margin: The sizes of whitespace around the chart.
             cx: The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage
             cy: The The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of height. Number | Percentage

+ 3 - 3
reflex/components/recharts/polar.py

@@ -141,8 +141,8 @@ class RadialBar(Recharts):
 
     alias = "RechartsRadialBar"
 
-    # The source data which each element is an object.
-    data: Var[List[Dict[str, Any]]]
+    # The key of a group of data which should be unique to show the meaning of angle axis.
+    data_key: Var[Union[str, int]]
 
     # Min angle of each bar. A positive value between 0 and 360.
     min_angle: Var[int]
@@ -151,7 +151,7 @@ class RadialBar(Recharts):
     legend_type: Var[str]
 
     # If false set, labels will not be drawn.
-    label: Var[bool]
+    label: Var[Union[bool, Dict[str, Any]]]
 
     # If false set, background sector will not be drawn.
     background: Var[bool]

+ 5 - 3
reflex/components/recharts/polar.pyi

@@ -242,10 +242,12 @@ class RadialBar(Recharts):
     def create(  # type: ignore
         cls,
         *children,
-        data: Optional[Union[Var[List[Dict[str, Any]]], List[Dict[str, Any]]]] = None,
+        data_key: Optional[Union[Var[Union[str, int]], Union[str, int]]] = None,
         min_angle: Optional[Union[Var[int], int]] = None,
         legend_type: Optional[Union[Var[str], str]] = None,
-        label: Optional[Union[Var[bool], bool]] = None,
+        label: Optional[
+            Union[Var[Union[bool, Dict[str, Any]]], Union[bool, Dict[str, Any]]]
+        ] = None,
         background: Optional[Union[Var[bool], bool]] = None,
         style: Optional[Style] = None,
         key: Optional[Any] = None,
@@ -277,7 +279,7 @@ class RadialBar(Recharts):
 
         Args:
             *children: The children of the component.
-            data: The source data which each element is an object.
+            data_key: The key of a group of data which should be unique to show the meaning of angle axis.
             min_angle: Min angle of each bar. A positive value between 0 and 360.
             legend_type: Type of legend
             label: If false set, labels will not be drawn.