Просмотр исходного кода

scatter z-axis range fix (#4800)

* scatter z-axis range fix

* add needed name prop for scatter chart

* fix pyi

* change default message

---------

Co-authored-by: Tom Gotsman <tomgotsman@Toms-MacBook-Pro.local>
Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
Tom Gotsman 2 месяцев назад
Родитель
Сommit
30d20afbc9

+ 5 - 2
reflex/components/recharts/cartesian.py

@@ -183,8 +183,8 @@ class ZAxis(Recharts):
     # The unique id of z-axis. Default: 0
     z_axis_id: Var[str | int]
 
-    # The range of axis. Default: [10, 10]
-    range: Var[Sequence[int]]
+    # The range of axis. Default: [60, 400]
+    range: Var[Sequence[int]] = LiteralVar.create([60, 400])
 
     # The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart.
     unit: Var[str | int]
@@ -486,6 +486,9 @@ class Scatter(Recharts):
     # The source data, in which each element is an object.
     data: Var[Sequence[dict[str, Any]]]
 
+    # The name of the data. It is used to represent the scatter in legend.
+    name: Var[str]
+
     # The type of icon in legend. If set to 'none', no legend item will be rendered. 'line' | 'plainline' | 'square' | 'rect'| 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | 'none'. Default: "circle"
     legend_type: Var[LiteralLegendType]
 

+ 3 - 1
reflex/components/recharts/cartesian.pyi

@@ -598,7 +598,7 @@ class ZAxis(Recharts):
             *children: The children of the component.
             data_key: The key of data displayed in the axis.
             z_axis_id: The unique id of z-axis. Default: 0
-            range: The range of axis. Default: [10, 10]
+            range: The range of axis. Default: [60, 400]
             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.
             scale: If 'auto' set, the scale function is decided by the type of chart, and the props type. Default: "auto"
@@ -1272,6 +1272,7 @@ class Scatter(Recharts):
         cls,
         *children,
         data: Sequence[dict[str, Any]] | Var[Sequence[dict[str, Any]]] | None = None,
+        name: Var[str] | str | None = None,
         legend_type: Literal[
             "circle",
             "cross",
@@ -1352,6 +1353,7 @@ class Scatter(Recharts):
         Args:
             *children: The children of the component.
             data: The source data, in which each element is an object.
+            name: The name of the data. It is used to represent the scatter in legend.
             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' | 'square' | 'star' | 'triangle' | 'wye' | 'none'. Default: "circle"
             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