|
@@ -6,7 +6,21 @@ from typing import Any, Dict, List, Union
|
|
from reflex.constants import EventTriggers
|
|
from reflex.constants import EventTriggers
|
|
from reflex.vars import Var
|
|
from reflex.vars import Var
|
|
|
|
|
|
-from .recharts import Recharts
|
|
|
|
|
|
+from .recharts import (
|
|
|
|
+ LiteralAnimationEasing,
|
|
|
|
+ LiteralAreaType,
|
|
|
|
+ LiteralDirection,
|
|
|
|
+ LiteralIfOverflow,
|
|
|
|
+ LiteralInterval,
|
|
|
|
+ LiteralLayout,
|
|
|
|
+ LiteralLineType,
|
|
|
|
+ LiteralOrientationTopBottom,
|
|
|
|
+ LiteralOrientationTopBottomLeftRight,
|
|
|
|
+ LiteralPolarRadiusType,
|
|
|
|
+ LiteralScale,
|
|
|
|
+ LiteralShape,
|
|
|
|
+ Recharts,
|
|
|
|
+)
|
|
|
|
|
|
|
|
|
|
class Axis(Recharts):
|
|
class Axis(Recharts):
|
|
@@ -19,10 +33,10 @@ class Axis(Recharts):
|
|
hide: Var[bool]
|
|
hide: Var[bool]
|
|
|
|
|
|
# The orientation of axis 'top' | 'bottom'
|
|
# The orientation of axis 'top' | 'bottom'
|
|
- orientation: Var[str]
|
|
|
|
|
|
+ orientation: Var[LiteralOrientationTopBottom]
|
|
|
|
|
|
# The type of axis 'number' | 'category'
|
|
# The type of axis 'number' | 'category'
|
|
- type_: Var[str]
|
|
|
|
|
|
+ type_: Var[LiteralPolarRadiusType]
|
|
|
|
|
|
# Allow the ticks of XAxis to be decimals or not.
|
|
# Allow the ticks of XAxis to be decimals or not.
|
|
allow_decimals: Var[bool]
|
|
allow_decimals: Var[bool]
|
|
@@ -46,7 +60,7 @@ class Axis(Recharts):
|
|
reversed: Var[bool]
|
|
reversed: Var[bool]
|
|
|
|
|
|
# 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
|
|
# 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[str]
|
|
|
|
|
|
+ scale: Var[LiteralScale]
|
|
|
|
|
|
# The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart.
|
|
# The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart.
|
|
unit: Var[Union[str, int]]
|
|
unit: Var[Union[str, int]]
|
|
@@ -109,7 +123,7 @@ class ZAxis(Recharts):
|
|
name: Var[Union[str, int]]
|
|
name: Var[Union[str, int]]
|
|
|
|
|
|
# If 'auto' set, the scale function is decided by the type of chart, and the props type.
|
|
# If 'auto' set, the scale function is decided by the type of chart, and the props type.
|
|
- scale: Var[str]
|
|
|
|
|
|
+ scale: Var[LiteralScale]
|
|
|
|
|
|
|
|
|
|
class Brush(Recharts):
|
|
class Brush(Recharts):
|
|
@@ -167,7 +181,7 @@ class Cartesian(Recharts):
|
|
"""A base class for cartesian charts in Recharts."""
|
|
"""A base class for cartesian charts in Recharts."""
|
|
|
|
|
|
# The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'
|
|
# The layout of bar in the chart, usually inherited from parent. 'horizontal' | 'vertical'
|
|
- layout: Var[str]
|
|
|
|
|
|
+ layout: Var[LiteralLayout]
|
|
|
|
|
|
# The key of a group of data which should be unique in an area chart.
|
|
# The key of a group of data which should be unique in an area chart.
|
|
data_key: Var[Union[str, int]]
|
|
data_key: Var[Union[str, int]]
|
|
@@ -178,8 +192,8 @@ class Cartesian(Recharts):
|
|
# The id of y-axis which is corresponding to the data.
|
|
# The id of y-axis which is corresponding to the data.
|
|
y_axis_id: Var[Union[str, int]]
|
|
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' | 'square' | 'star' | 'triangle' | 'wye' | 'none'optional
|
|
|
|
- legend_type: 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' | 'star' | 'triangle' | 'wye' | 'none'optional
|
|
|
|
+ # legend_type: Var[LiteralLegendType]
|
|
|
|
|
|
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
|
|
def get_event_triggers(self) -> dict[str, Union[Var, Any]]:
|
|
"""Get the event triggers that pass the component's value to the handler.
|
|
"""Get the event triggers that pass the component's value to the handler.
|
|
@@ -214,7 +228,7 @@ class Area(Cartesian):
|
|
fill: Var[str]
|
|
fill: Var[str]
|
|
|
|
|
|
# The interpolation type of area. And customized interpolation function can be set to type. 'basis' | 'basisClosed' | 'basisOpen' | 'bumpX' | 'bumpY' | 'bump' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter' |
|
|
# The interpolation type of area. And customized interpolation function can be set to type. 'basis' | 'basisClosed' | 'basisOpen' | 'bumpX' | 'bumpY' | 'bump' | 'linear' | 'linearClosed' | 'natural' | 'monotoneX' | 'monotoneY' | 'monotone' | 'step' | 'stepBefore' | 'stepAfter' |
|
|
- type_: Var[str]
|
|
|
|
|
|
+ type_: Var[LiteralAreaType]
|
|
|
|
|
|
# If false set, dots will not be drawn. If true set, dots will be drawn which have the props calculated internally.
|
|
# If false set, dots will not be drawn. If true set, dots will be drawn which have the props calculated internally.
|
|
dot: Var[bool]
|
|
dot: Var[bool]
|
|
@@ -275,7 +289,7 @@ class Line(Cartesian):
|
|
alias = "RechartsLine"
|
|
alias = "RechartsLine"
|
|
|
|
|
|
# The interpolation type of line. And customized interpolation function can be set to type. It's the same as type in Area.
|
|
# The interpolation type of line. And customized interpolation function can be set to type. It's the same as type in Area.
|
|
- type_: Var[str]
|
|
|
|
|
|
+ type_: Var[LiteralAreaType]
|
|
|
|
|
|
# The color of the line stroke.
|
|
# The color of the line stroke.
|
|
stroke: Var[str]
|
|
stroke: Var[str]
|
|
@@ -319,10 +333,10 @@ class Scatter(Cartesian):
|
|
line: Var[bool]
|
|
line: Var[bool]
|
|
|
|
|
|
# If a string set, specified symbol will be used to show scatter item. 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye'
|
|
# If a string set, specified symbol will be used to show scatter item. 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye'
|
|
- shape: Var[str]
|
|
|
|
|
|
+ shape: Var[LiteralShape]
|
|
|
|
|
|
# If 'joint' set, line will generated by just jointing all the points. If 'fitting' set, line will be generated by fitting algorithm. 'joint' | 'fitting'
|
|
# If 'joint' set, line will generated by just jointing all the points. If 'fitting' set, line will be generated by fitting algorithm. 'joint' | 'fitting'
|
|
- line_type: Var[str]
|
|
|
|
|
|
+ line_type: Var[LiteralLineType]
|
|
|
|
|
|
# The fill
|
|
# The fill
|
|
fill: Var[str]
|
|
fill: Var[str]
|
|
@@ -351,7 +365,7 @@ class Funnel(Cartesian):
|
|
animation_duration: Var[int]
|
|
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'
|
|
- animation_easing: Var[str]
|
|
|
|
|
|
+ animation_easing: Var[LiteralAnimationEasing]
|
|
|
|
|
|
# Valid children components
|
|
# Valid children components
|
|
valid_children: List[str] = ["LabelList", "Cell"]
|
|
valid_children: List[str] = ["LabelList", "Cell"]
|
|
@@ -365,7 +379,7 @@ class ErrorBar(Recharts):
|
|
alias = "RechartsErrorBar"
|
|
alias = "RechartsErrorBar"
|
|
|
|
|
|
# The direction of error bar. 'x' | 'y' | 'both'
|
|
# The direction of error bar. 'x' | 'y' | 'both'
|
|
- direction: Var[str]
|
|
|
|
|
|
+ direction: Var[LiteralDirection]
|
|
|
|
|
|
# The key of a group of data which should be unique in an area chart.
|
|
# The key of a group of data which should be unique in an area chart.
|
|
data_key: Var[Union[str, int]]
|
|
data_key: Var[Union[str, int]]
|
|
@@ -396,7 +410,7 @@ class Reference(Recharts):
|
|
y: Var[str]
|
|
y: Var[str]
|
|
|
|
|
|
# Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas.
|
|
# Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas.
|
|
- if_overflow: Var[str]
|
|
|
|
|
|
+ if_overflow: Var[LiteralIfOverflow]
|
|
|
|
|
|
# If set true, the line will be rendered in front of bars in BarChart, etc.
|
|
# If set true, the line will be rendered in front of bars in BarChart, etc.
|
|
is_front: Var[bool]
|
|
is_front: Var[bool]
|
|
@@ -477,7 +491,7 @@ class ReferenceArea(Recharts):
|
|
y2: Var[Union[str, int]]
|
|
y2: Var[Union[str, int]]
|
|
|
|
|
|
# Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas.
|
|
# Defines how to draw the reference line if it falls partly outside the canvas. If set to 'discard', the reference line will not be drawn at all. If set to 'hidden', the reference line will be clipped to the canvas. If set to 'visible', the reference line will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be extended such that the reference line fits into the canvas.
|
|
- if_overflow: Var[str]
|
|
|
|
|
|
+ if_overflow: Var[LiteralIfOverflow]
|
|
|
|
|
|
# If set true, the line will be rendered in front of bars in BarChart, etc.
|
|
# If set true, the line will be rendered in front of bars in BarChart, etc.
|
|
is_front: Var[bool]
|
|
is_front: Var[bool]
|
|
@@ -533,7 +547,7 @@ class CartesianAxis(Grid):
|
|
alias = "RechartsCartesianAxis"
|
|
alias = "RechartsCartesianAxis"
|
|
|
|
|
|
# The orientation of axis 'top' | 'bottom' | 'left' | 'right'
|
|
# The orientation of axis 'top' | 'bottom' | 'left' | 'right'
|
|
- orientation: Var[str]
|
|
|
|
|
|
+ orientation: Var[LiteralOrientationTopBottomLeftRight]
|
|
|
|
|
|
# If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line.
|
|
# If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line.
|
|
axis_line: Var[bool]
|
|
axis_line: Var[bool]
|
|
@@ -545,7 +559,7 @@ class CartesianAxis(Grid):
|
|
tick_size: Var[int]
|
|
tick_size: Var[int]
|
|
|
|
|
|
# If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically.
|
|
# If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd", the ticks which is to be shown or hidden will be calculated automatically.
|
|
- interval: Var[str]
|
|
|
|
|
|
+ interval: Var[LiteralInterval]
|
|
|
|
|
|
# If set false, no ticks will be drawn.
|
|
# If set false, no ticks will be drawn.
|
|
ticks: Var[bool]
|
|
ticks: Var[bool]
|