Namespace Recharts + Victory Back With Depreciation Warning (#1928)

This commit is contained in:
Alek Petuskey 2023-10-08 19:09:09 -07:00 committed by GitHub
parent 586822d3be
commit 06103a4d8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 1064 additions and 57 deletions

View File

@ -25,6 +25,7 @@ env:
# - Best effort print lines that contain illegal chars (map to some default char, etc.)
PYTHONIOENCODING: "utf8"
TELEMETRY_ENABLED: false
NODE_OPTIONS: "--max_old_space_size=4096"
jobs:
example-counter:

View File

@ -15,6 +15,7 @@ permissions:
env:
TELEMETRY_ENABLED: false
NODE_OPTIONS: "--max_old_space_size=4096"
jobs:
example-counter-wsl:

View File

@ -14,6 +14,7 @@ from .compiler.utils import get_asset_path
from .components import *
from .components.base.script import client_side
from .components.component import custom_component as memo
from .components.graphing import recharts as recharts
from .config import Config as Config
from .config import DBConfig as DBConfig
from .constants import Env as Env

View File

@ -407,8 +407,8 @@ class App(Base):
console.deprecate(
feature_name="Passing script tags to add_page",
reason="Add script components as children to the page component instead",
deprecation_version="0.3.0",
removal_version="0.3.2",
deprecation_version="0.2.9",
removal_version="0.3.1",
)
component.children.extend(script_tags)

View File

@ -233,43 +233,4 @@ color_mode_button = ColorModeButton.create
color_mode_icon = ColorModeIcon.create
color_mode_switch = ColorModeSwitch.create
area_chart = AreaChart.create
bar_chart = BarChart.create
line_chart = LineChart.create
composed_chart = ComposedChart.create
pie_chart = PieChart.create
radar_chart = RadarChart.create
radial_bar_chart = RadialBarChart.create
scatter_chart = ScatterChart.create
funnel_chart = FunnelChart.create
treemap = Treemap.create
area = Area.create
bar = Bar.create
line = Line.create
scatter = Scatter.create
x_axis = XAxis.create
y_axis = YAxis.create
z_axis = ZAxis.create
brush = Brush.create
cartesian_axis = CartesianAxis.create
cartesian_grid = CartesianGrid.create
reference_line = ReferenceLine.create
reference_dot = ReferenceDot.create
reference_area = ReferenceArea.create
error_bar = ErrorBar.create
funnel = Funnel.create
responsive_container = ResponsiveContainer.create
legend = Legend.create
graphing_tooltip = GraphingTooltip.create
label = Label.create
label_list = LabelList.create
pie = Pie.create
radar = Radar.create
radial_bar = RadialBar.create
polar_angle_axis = PolarAngleAxis.create
polar_grid = PolarGrid.create
polar_radius_axis = PolarRadiusAxis.create
plotly = Plotly.create

View File

@ -91,7 +91,7 @@ def client_side(javascript_code) -> Var[EventChain]:
console.deprecate(
feature_name="rx.client_side",
reason="and has been replaced by rx.call_script, which can be used from backend EventHandler too",
deprecation_version="0.3.0",
removal_version="0.3.1",
deprecation_version="0.2.9",
removal_version="0.3.0",
)
return BaseVar(name=f"...args => {{{javascript_code}}}", type_=EventChain)

View File

@ -241,7 +241,7 @@ class Component(Base, ABC):
feature_name="EventChain",
reason="to avoid confusion, only use yield API",
deprecation_version="0.2.8",
removal_version="0.3.1",
removal_version="0.3.0",
)
events = []
for v in value:
@ -310,7 +310,7 @@ class Component(Base, ABC):
feature_name=f"get_controlled_triggers ({self.__class__.__name__})",
reason="replaced by get_event_triggers",
deprecation_version="0.2.8",
removal_version="0.3.1",
removal_version="0.3.0",
)
return {
@ -943,7 +943,7 @@ class NoSSRComponent(Component):
import_name_parts[0] if import_name_parts[0] != "@" else self.library
)
library_import = f"const {self.tag} = dynamic(() => import('{import_name}')"
library_import = f"const {self.alias if self.alias else self.tag} = dynamic(() => import('{import_name}')"
mod_import = (
# https://nextjs.org/docs/pages/building-your-application/optimizing/lazy-loading#with-named-exports
f".then((mod) => mod.{self.tag})"

View File

@ -1,6 +1,5 @@
"""Convenience functions to define layout components."""
from .plotly import Plotly
from .recharts import *
__all__ = [f for f in dir() if f[0].isupper()] # type: ignore

View File

@ -39,3 +39,44 @@ from .polar import (
Radar,
RadialBar,
)
area_chart = AreaChart.create
bar_chart = BarChart.create
line_chart = LineChart.create
composed_chart = ComposedChart.create
pie_chart = PieChart.create
radar_chart = RadarChart.create
radial_bar_chart = RadialBarChart.create
scatter_chart = ScatterChart.create
funnel_chart = FunnelChart.create
treemap = Treemap.create
area = Area.create
bar = Bar.create
line = Line.create
scatter = Scatter.create
x_axis = XAxis.create
y_axis = YAxis.create
z_axis = ZAxis.create
brush = Brush.create
cartesian_axis = CartesianAxis.create
cartesian_grid = CartesianGrid.create
reference_line = ReferenceLine.create
reference_dot = ReferenceDot.create
reference_area = ReferenceArea.create
error_bar = ErrorBar.create
funnel = Funnel.create
responsive_container = ResponsiveContainer.create
legend = Legend.create
graphing_tooltip = GraphingTooltip.create
label = Label.create
label_list = LabelList.create
pie = Pie.create
radar = Radar.create
radial_bar = RadialBar.create
polar_angle_axis = PolarAngleAxis.create
polar_grid = PolarGrid.create
polar_radius_axis = PolarRadiusAxis.create

View File

@ -75,12 +75,16 @@ class XAxis(Axis):
tag = "XAxis"
alias = "RechartsXAxis"
class YAxis(Axis):
"""A YAxis component in Recharts."""
tag = "YAxis"
alias = "RechartsYAxis"
# The key of data displayed in the axis.
data_key: Var[Union[str, int]]
@ -90,6 +94,8 @@ class ZAxis(Recharts):
tag = "ZAxis"
alias = "RechartszAxis"
# The key of data displayed in the axis.
data_key: Var[Union[str, int]]
@ -111,6 +117,8 @@ class Brush(Recharts):
tag = "Brush"
alias = "RechartsBrush"
# Stroke color
stroke: Var[str]
@ -194,6 +202,8 @@ class Area(Cartesian):
tag = "Area"
alias = "RechartsArea"
# The color of the line stroke.
stroke: Var[str]
@ -227,6 +237,8 @@ class Bar(Cartesian):
tag = "Bar"
alias = "RechartsBar"
# The color of the line stroke.
stroke: Var[str]
@ -260,6 +272,8 @@ class Line(Cartesian):
tag = "Line"
alias = "RechartsLine"
# 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]
@ -293,6 +307,8 @@ class Scatter(Cartesian):
tag = "Scatter"
alias = "RechartsScatter"
# The source data, in which each element is an object.
data: Var[List[Dict[str, Any]]]
@ -323,6 +339,8 @@ class Funnel(Cartesian):
tag = "Funnel"
alias = "RechartsFunnel"
# The source data, in which each element is an object.
data: Var[List[Dict[str, Any]]]
@ -344,6 +362,8 @@ class ErrorBar(Recharts):
tag = "ErrorBar"
alias = "RechartsErrorBar"
# The direction of error bar. 'x' | 'y' | 'both'
direction: Var[str]
@ -387,6 +407,8 @@ class ReferenceLine(Reference):
tag = "ReferenceLine"
alias = "RechartsReferenceLine"
# The width of the stroke.
stroke_width: Var[int]
@ -399,6 +421,8 @@ class ReferenceDot(Reference):
tag = "ReferenceDot"
alias = "RechartsReferenceDot"
# Valid children components
valid_children: List[str] = ["Label"]
@ -423,6 +447,8 @@ class ReferenceArea(Recharts):
tag = "ReferenceArea"
alias = "RechartsReferenceArea"
# Stroke color
stroke: Var[str]
@ -481,6 +507,8 @@ class CartesianGrid(Grid):
tag = "CartesianGrid"
alias = "RechartsCartesianGrid"
# The horizontal line configuration.
horizontal: Var[Dict[str, Any]]
@ -502,6 +530,8 @@ class CartesianAxis(Grid):
tag = "CartesianAxis"
alias = "RechartsCartesianAxis"
# The orientation of axis 'top' | 'bottom' | 'left' | 'right'
orientation: Var[str]

View File

@ -74,6 +74,8 @@ class AreaChart(ChartBase):
tag = "AreaChart"
alias = "RechartsAreaChart"
# The base value of area. Number | 'dataMin' | 'dataMax' | 'auto'
base_value: Var[Union[int, str]]
@ -100,6 +102,8 @@ class BarChart(ChartBase):
tag = "BarChart"
alias = "RechartsBarChart"
# The gap between two bar categories, which can be a percent value or a fixed value. Percentage | Number
bar_category_gap: Var[Union[str, int]] # type: ignore
@ -138,6 +142,8 @@ class LineChart(ChartBase):
tag = "LineChart"
alias = "RechartsLineChart"
# Valid children components
valid_children: List[str] = [
"XAxis",
@ -158,6 +164,8 @@ class ComposedChart(ChartBase):
tag = "ComposedChart"
alias = "RechartsComposedChart"
# The base value of area. Number | 'dataMin' | 'dataMax' | 'auto'
base_value: Var[Union[int, str]]
@ -195,6 +203,8 @@ class PieChart(ChartBase):
tag = "PieChart"
alias = "RechartsPieChart"
# Valid children components
valid_children: List[str] = [
"PolarAngleAxis",
@ -223,6 +233,8 @@ class RadarChart(ChartBase):
tag = "RadarChart"
alias = "RechartsRadarChart"
# The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage
cx: Var[Union[int, str]]
@ -270,6 +282,8 @@ class RadialBarChart(ChartBase):
tag = "RadialBarChart"
alias = "RechartsRadialBarChart"
# The The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of width. Number | Percentage
cx: Var[Union[int, str]]
@ -326,6 +340,8 @@ class ScatterChart(ChartBase):
tag = "ScatterChart"
alias = "RechartsScatterChart"
# Valid children components
valid_children: List[str] = [
"XAxis",
@ -362,6 +378,8 @@ class FunnelChart(RechartsCharts):
tag = "FunnelChart"
alias = "RechartsFunnelChart"
# The source data, in which each element is an object.
data: Var[List[Dict[str, Any]]]
@ -411,6 +429,8 @@ class Treemap(RechartsCharts):
tag = "Treemap"
alias = "RechartsTreemap"
# The width of chart container. String or Integer
width: Var[Union[str, int]] = "100%" # type: ignore

View File

@ -14,6 +14,8 @@ class ResponsiveContainer(Recharts):
tag = "ResponsiveContainer"
alias = "RechartsResponsiveContainer"
# The aspect ratio of the container. The final aspect ratio of the SVG element will be (width / height) * aspect. Number
aspect: Var[int]
@ -51,6 +53,8 @@ class Legend(Recharts):
tag = "Legend"
alias = "RechartsLegend"
# The width of legend container. Number
width: Var[int]
@ -102,6 +106,8 @@ class GraphingTooltip(Recharts):
tag = "Tooltip"
alias = "RechartsTooltip"
# The separator between name and value.
separator: Var[str]
@ -132,6 +138,8 @@ class Label(Recharts):
tag = "Label"
alias = "RechartsLabel"
# The box of viewing area, which has the shape of {x: someVal, y: someVal, width: someVal, height: someVal}, usually calculated internally.
view_box: Var[Dict[str, Any]]
@ -150,6 +158,8 @@ class LabelList(Recharts):
tag = "LabelList"
alias = "RechartsLabelList"
# The key of a group of label values in data.
data_key: Var[Union[str, int]]

View File

@ -14,6 +14,8 @@ class Pie(Recharts):
tag = "Pie"
alias = "RechartsPie"
# data
data: Var[List[Dict[str, Any]]]
@ -86,6 +88,8 @@ class Radar(Recharts):
tag = "Radar"
alias = "RechartsRadar"
# The key of a group of data which should be unique in a radar chart.
data_key: Var[Union[str, int]]
@ -128,6 +132,8 @@ class RadialBar(Recharts):
tag = "RadialBar"
alias = "RechartsRadialBar"
# The source data which each element is an object.
data: Var[List[Dict[str, Any]]]
@ -167,6 +173,8 @@ class PolarAngleAxis(Recharts):
tag = "PolarAngleAxis"
alias = "RechartsPolarAngleAxis"
# The key of a group of data which should be unique to show the meaning of angle axis.
data_key: Var[Union[str, int]]
@ -224,6 +232,8 @@ class PolarGrid(Recharts):
tag = "PolarGrid"
alias = "RechartsPolarGrid"
# The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width.
cx: Var[Union[int, str]]
@ -254,6 +264,8 @@ class PolarRadiusAxis(Recharts):
tag = "PolarRadiusAxis"
alias = "RechartsPolarRadiusAxis"
# The angle of radial direction line to display axis text.
angle: Var[int]

View File

@ -0,0 +1,623 @@
"""Victory graphing components."""
from typing import Any, Dict, List, Optional, Union
from reflex.components.component import Component
from reflex.style import Style
from reflex.utils import console
from reflex.vars import Var
def format_xy(x: List, y: List) -> List:
"""Format x and y data.
Args:
x: The x values.
y: The y values.
Returns:
The formatted data.
Raises:
ValueError: If x and y are not the same length.
"""
if len(x) != len(y):
raise ValueError("x and y must be the same length")
return [{"x": x[i], "y": y[i]} for i in range(len(x))]
def format_line(x: List, y: List) -> List:
"""Format line data.
Args:
x: The x values.
y: The y values.
Returns:
The formatted data.
"""
return format_xy(x, y)
def format_scatter(x: List, y: List, amount: Optional[List] = None) -> List:
"""Format scatter data.
Args:
x: The x values.
y: The y values.
amount: The amount of each point.
Returns:
The formatted data.
Raises:
ValueError: If x and y are not the same length.
"""
if x is None or y is None:
raise ValueError("x and y must be provided")
if amount is None:
return format_xy(x, y)
return [{"x": x[i], "y": y[i], "amount": amount[i]} for i in range(len(x))]
def format_area(x: List, y: List, y0: Optional[List] = None) -> List:
"""Format area data.
Args:
x: The x values.
y: The y values.
y0: The y0 values.
Returns:
The formatted data.
Raises:
ValueError: If x and y are not the same length.
"""
if y0 is None:
return format_xy(x, y)
if len(x) != len(y) or len(x) != len(y0):
raise ValueError("x, y, and y0 must be the same length")
return [{"x": x[i], "y": y[i], "y0": y0[i]} for i in range(len(x))]
def format_bar(x: List, y: List, y0: Optional[List] = None) -> List:
"""Format bar data.
Args:
x: The x values.
y: The y values.
y0: The y0 values.
Returns:
The formatted data.
Raises:
ValueError: If x and y are not the same length.
"""
if y0 is None:
return format_xy(x, y)
if len(x) != len(y) or len(x) != len(y0):
raise ValueError("x, y, and y0 must be the same length")
return [{"x": x[i], "y": y[i], "y0": y0[i]} for i in range(len(x))]
def format_box_plot(
x: List,
y: Optional[List[Any]] = None,
min_: Optional[List[Any]] = None,
max_: Optional[List[Any]] = None,
median: Optional[List[Any]] = None,
q1: Optional[List[Any]] = None,
q3: Optional[List[Any]] = None,
) -> List:
"""Format box plot data.
Args:
x: The x values.
y: The y values.
min_: The minimum values.
max_: The maximum values.
median: The median values.
q1: The q1 values.
q3: The q3 values.
Returns:
The formatted data.
Raises:
ValueError: If x is not provided.
ValueError: If y is provided and x, y are not the same length.
ValueError: If y is not provided and min, max, median, q1, and q3 are not provided.
ValueError: If y is not provided and x, min, max, median, q1, and q3 are not the same length.
"""
if x is None:
raise ValueError("x must be specified")
if y is not None:
return format_xy(x, y)
if min_ is None or max_ is None or median is None or q1 is None or q3 is None:
raise ValueError(
"min, max, median, q1, and q3 must be specified if y is not provided"
)
if (
len(x) != len(min_)
or len(x) != len(max_)
or len(x) != len(median)
or len(x) != len(q1)
or len(x) != len(q3)
):
raise ValueError(
"x, min, max, median, q1, and q3 must be the same length and specified if y is not provided"
)
return [
{
"x": x[i],
"min": min_[i],
"max": max_[i],
"median": median[i],
"q1": q1[i],
"q3": q3[i],
}
for i in range(len(x))
]
def format_histogram(x: List) -> List:
"""Format histogram data.
Args:
x: The x values.
Returns:
The formatted data.
Raises:
ValueError: If x is not provided.
"""
if x is None:
raise ValueError("x must be specified")
return [{"x": x[i]} for i in range(len(x))]
def format_pie(x: List, y: List, label: Optional[List] = None) -> List:
"""Format pie data.
Args:
x: The x values.
y: The y values.
label: The label values.
Returns:
The formatted data.
Raises:
ValueError: If x is not provided.
ValueError: If x and y are not the same length.
ValueError: If x, y, and label are not the same length.
"""
if x is None:
raise ValueError("x must be specified")
if label is None:
return format_xy(x, y)
if len(x) != len(y) or len(x) != len(label):
raise ValueError("x, y, and label must be the same length")
return [{"x": x[i], "y": y[i], "label": label[i]} for i in range(len(x))]
def format_voronoi(x: List, y: List) -> List:
"""Format voronoi data.
Args:
x: The x values.
y: The y values.
Returns:
The formatted data.
Raises:
ValueError: If x or y is not provided.
ValueError: If x and y are not the same length.
"""
if x is None or y is None:
raise ValueError("x and y must be specified")
return format_xy(x, y)
def format_candlestick(x: List, open: List, close: List, high: List, low: List) -> List:
"""Format candlestick data.
Args:
x: The x values.
open: The open values.
close: The close values.
high: The high values.
low: The low values.
Returns:
The formatted data.
Raises:
ValueError: If x is not provided.
ValueError: If x, open, close, high, and low are not the same length.
"""
if x is None:
raise ValueError("x must be specified")
if (
len(x) != len(open)
or len(x) != len(close)
or len(x) != len(high)
or len(x) != len(low)
):
raise ValueError("x, open, close, high, and low must be the same length")
return [
{"x": x[i], "open": open[i], "close": close[i], "high": high[i], "low": low[i]}
for i in range(len(x))
]
def format_error_bar(x: List, y: List, error_x: List, error_y: List) -> List:
"""Format error bar data.
Args:
x: The x values.
y: The y values.
error_x: The error_x values.
error_y: The error_y values.
Returns:
The formatted data.
Raises:
ValueError: If x is not provided.
ValueError: If x, y, error_x, and error_y are not the same length.
"""
if x is None:
raise ValueError("x must be specified")
if len(x) != len(error_x) or len(x) != len(error_y):
raise ValueError("x, y, error_x, and error_y must be the same length")
else:
return [
{"x": x[i], "y": y[i], "errorX": error_x[i], "errorY": error_y[i]}
for i in range(len(x))
]
def data(graph: str, x: List, y: Optional[List] = None, **kwargs) -> List:
"""Format data.
Args:
graph: The graph type.
x: The x values.
y: The y values.
kwargs: The keyword arguments.
Returns:
The formatted data.
Raises:
ValueError: If graph is not provided.
ValueError: If graph is not supported.
"""
console.deprecate(
"Victory Chart",
"Use the Recharts library instead under rx.recharts",
"0.2.9",
"0.3.0",
)
if graph == "area":
return format_area(x, y, **kwargs) # type: ignore
elif graph == "bar":
return format_bar(x, y) # type: ignore
elif graph == "box_plot":
return format_box_plot(x, y, **kwargs)
elif graph == "candlestick":
return format_candlestick(x, **kwargs)
elif graph == "error_bar":
return format_error_bar(x, y, **kwargs) # type: ignore
elif graph == "histogram":
return format_histogram(x)
elif graph == "line":
return format_line(x, y) # type: ignore
elif graph == "pie":
return format_pie(x, y, **kwargs) # type: ignore
elif graph == "scatter":
return format_scatter(x, y, **kwargs) # type: ignore
elif graph == "voronoi":
return format_voronoi(x, y) # type: ignore
else:
raise ValueError("Invalid graph type")
class Victory(Component):
"""A component that wraps a victory lib."""
library = "victory@^36.6.8"
# The data to display.
data: Var[List[Dict]]
# The height of the chart.
height: Var[str]
# The width of the chart.
width: Var[str]
# Max domain for the chart.
max_domain: Var[Dict]
# Min domain for the chart.
min_domain: Var[Dict]
# Whether the chart is polar.
polar: Var[bool]
# Scale for the chart: "linear", "time", "log", "sqrt"
scale: Var[Dict]
# Labels for the chart.
labels: Var[List]
# Display the chart horizontally.
horizontal: Var[bool]
# Whether the chart is standalone.
standalone: Var[bool]
# The sort order for the chart: "ascending", "descending"
sort_order: Var[str]
# The padding for the chart.
padding: Var[Dict]
# Domain padding for the chart.
domain_padding: Var[Dict]
# A custom style for the code block.
custom_style: Var[Dict[str, str]]
@classmethod
def create(cls, *children, **props):
"""Create a chart component.
Args:
*children: The children of the component.
**props: The props to pass to the component.
Returns:
The chart component.
"""
console.deprecate(
"Victory Chart",
"Use the Recharts library instead under rx.recharts",
"0.2.9",
"0.3.0",
)
# This component handles style in a special prop.
custom_style = props.pop("style", {})
# Transfer style props to the custom style prop.
for key, value in props.items():
if key not in cls.get_fields():
custom_style[key] = value
# Create the component.
return super().create(
*children,
**props,
custom_style=Style(custom_style),
)
def _add_style(self, style):
self.custom_style = self.custom_style or {}
self.custom_style.update(style) # type: ignore
def _render(self):
out = super()._render()
return out.add_props(style=self.custom_style).remove_props("custom_style")
class Chart(Victory):
"""Wrapper component that renders a given set of children on a set of Cartesian or polar axes."""
tag = "VictoryChart"
# Start angle for the chart.
start_angle: Var[int]
# End angle for the chart.
end_angle: Var[int]
# The padding for the chart.
domain_padding: Var[Dict]
class Line(Victory):
"""Display a victory line."""
tag = "VictoryLine"
# Interpolation for the line: Polar line charts may use the following interpolation options: "basis", "cardinal", "catmullRom", "linear" and Cartesian line charts may use the following interpolation options: "basis", "bundle", "cardinal", "catmullRom", "linear", "monotoneX", "monotoneY", "natural", "step", "stepAfter", "stepBefore"
interpolation: Var[str]
class Bar(Victory):
"""Display a victory bar."""
tag = "VictoryBar"
# The alignment prop specifies how bars should be aligned relative to their data points. This prop may be given as "start", "middle" or "end". When this prop is not specified, bars will have "middle" alignment relative to their data points.
alignment: Var[str]
# Determines the relative width of bars to the available space. This prop should be given as a number between 0 and 1. When this prop is not specified, bars will have a default ratio of 0.75.
bar_ratio: Var[float]
# Specify the width of each bar.
bar_width: Var[int]
# Specifies a radius to apply to each bar.
corner_radius: Var[float]
class Area(Victory):
"""Display a victory area."""
tag = "VictoryArea"
# Interpolation for the line: Polar line charts may use the following interpolation options: "basis", "cardinal", "catmullRom", "linear" and Cartesian line charts may use the following interpolation options: "basis", "bundle", "cardinal", "catmullRom", "linear", "monotoneX", "monotoneY", "natural", "step", "stepAfter", "stepBefore"
interpolation: Var[str]
class Pie(Victory):
"""Display a victory pie."""
tag = "VictoryPie"
# Defines a color scale to be applied to each slice. Takes in an array of colors. Default color scale are: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", "green", "blue".
color_scale: Var[Union[str, List[str]]]
# Specifies the corner radius of the slices rendered in the pie chart.
corner_radius: Var[float]
# Specifies the angular placement of each label relative to the angle of its corresponding slice. Options are : "parallel", "perpendicular", "vertical".
label_placement: Var[str]
# Specifies the position of each label relative to its corresponding slice. Options are : "startAngle", "endAngle", "centroid".
label_position: Var[str]
# Defines the radius of the arc that will be used for positioning each slice label. This prop should be given as a number between 0 and 1. If this prop is not set, the label radius will default to the radius of the pie + label padding.
label_radius: Var[float]
# Defines the amount of separation between adjacent data slices in number of degrees.
pad_angle: Var[float]
# Specifies the radius of the pie. When this prop is not given, it will be calculated based on the width, height, and padding props.
radius: Var[float]
# Specifies the inner radius of the pie. When this prop is not given, it will default to 0.
inner_radius: Var[float]
# Specifies the start angle of the first slice in number of degrees. Default is 0.
start_angle: Var[float]
# Specifies the end angle of the last slice in number of degrees. Default is 360.
end_angle: Var[float]
class Candlestick(Victory):
"""Display a victory candlestick."""
tag = "VictoryCandlestick"
# Candle colors are significant in candlestick charts, with colors indicating whether a market closed higher than it opened (positive), or closed lower than it opened (negative). The candleColors prop should be given as an object with color strings specified for positive and negative.
candle_colors: Var[Dict]
# Specifies an approximate ratio between candle widths and spaces between candles.
candle_ratio: Var[float]
# Specify the width of each candle.
candle_width: Var[float]
# Defines the labels that will correspond to the close value for each candle.
close_labels: Var[List]
class Scatter(Victory):
"""Display a victory scatter."""
tag = "VictoryScatter"
# Indicates which property of the data object should be used to scale data points in a bubble chart.
bubble_property: Var[str]
# Sets a lower limit for scaling data points in a bubble chart.
min_bubble_size: Var[float]
# Sets an upper limit for scaling data points in a bubble chart.
max_bubble_size: Var[float]
class BoxPlot(Victory):
"""Display a victory boxplot."""
tag = "VictoryBoxPlot"
# Specifies how wide each box should be.
box_width: Var[float]
class Histogram(Victory):
"""Display a victory histogram."""
tag = "VictoryHistogram"
# Specify how the data will be binned.
bins: Var[List]
# Specifies the amount of space between each bin.
bin_spacing: Var[float]
# Specifies a radius to apply to each bar.
corner_radius: Var[float]
class ErrorBar(Victory):
"""Display a victory errorbar."""
tag = "VictoryErrorBar"
# Sets the border width of the error bars.
border_width: Var[float]
class ChartGroup(Victory):
"""Display a victory group."""
tag = "VictoryGroup"
# Optional prop that defines a color scale to be applied to the children of the group. Takes in an array of colors. Default color scale are: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", "green", "blue".
color_scale: Var[Union[str, List[str]]]
# Optional prop that defines a single color to be applied to the children of the group. Overrides color_scale.
color: Var[str]
# Determines the number of pixels each element in a group should be offset from its original position on the independent axis.
offset: Var[float]
class ChartStack(Victory):
"""Display a victory stack."""
tag = "VictoryStack"
# Prop is used for grouping stacks of bars.
categories: Var[int]
# Optional prop that defines a color scale to be applied to the children of the group. Takes in an array of colors. Default color scale are: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", "green", "blue".
color_scale: Var[Union[str, List[str]]]
class Voronoi(Victory):
"""Display a victory Voronoi."""
tag = "VictoryVoronoi"
class Polar(Victory):
"""Display a victory polar."""
tag = "VictoryPolarAxis"
# Specifies whether the axis corresponds to the dependent variable
dependent_axis: Var[bool]

View File

@ -0,0 +1,308 @@
"""Stub file for victory.py"""
# ------------------- DO NOT EDIT ----------------------
# This file was generated by `scripts/pyi_generator.py`!
# ------------------------------------------------------
from typing import Any, Dict, List, Optional, Union, overload
from reflex.components.component import Component
from reflex.vars import Var, BaseVar, ComputedVar
from reflex.event import EventHandler, EventChain, EventSpec
def format_xy(x: List, y: List) -> List: ...
def format_line(x: List, y: List) -> List: ...
def format_scatter(x: List, y: List, amount: Optional[List] = None) -> List: ...
def format_area(x: List, y: List, y0: Optional[List] = None) -> List: ...
def format_bar(x: List, y: List, y0: Optional[List] = None) -> List: ...
def format_box_plot(
x: List,
y: Optional[List[Any]] = None,
min_: Optional[List[Any]] = None,
max_: Optional[List[Any]] = None,
median: Optional[List[Any]] = None,
q1: Optional[List[Any]] = None,
q3: Optional[List[Any]] = None,
) -> List: ...
def format_histogram(x: List) -> List: ...
def format_pie(x: List, y: List, label: Optional[List] = None) -> List: ...
def format_voronoi(x: List, y: List) -> List: ...
def format_candlestick(
x: List, open: List, close: List, high: List, low: List
) -> List: ...
def format_error_bar(x: List, y: List, error_x: List, error_y: List) -> List: ...
def data(graph: str, x: List, y: Optional[List] = None, **kwargs) -> List: ...
class Victory(Component):
@overload
@classmethod
def create(cls, *children, data: Optional[Union[Var[List[Dict]], List[Dict]]] = None, height: Optional[Union[Var[str], str]] = None, width: Optional[Union[Var[str], str]] = None, max_domain: Optional[Union[Var[Dict], Dict]] = None, min_domain: Optional[Union[Var[Dict], Dict]] = None, polar: Optional[Union[Var[bool], bool]] = None, scale: Optional[Union[Var[Dict], Dict]] = None, labels: Optional[Union[Var[List], List]] = None, horizontal: Optional[Union[Var[bool], bool]] = None, standalone: Optional[Union[Var[bool], bool]] = None, sort_order: Optional[Union[Var[str], str]] = None, padding: Optional[Union[Var[Dict], Dict]] = None, domain_padding: Optional[Union[Var[Dict], Dict]] = None, custom_style: Optional[Union[Var[Dict[str, str]], Dict[str, str]]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Victory": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
data: The data to display.
height: The height of the chart.
width: The width of the chart.
max_domain: Max domain for the chart.
min_domain: Min domain for the chart.
polar: Whether the chart is polar.
scale: Scale for the chart: "linear", "time", "log", "sqrt"
labels: Labels for the chart.
horizontal: Display the chart horizontally.
standalone: Whether the chart is standalone.
sort_order: The sort order for the chart: "ascending", "descending"
padding: The padding for the chart.
domain_padding: Domain padding for the chart.
custom_style: A custom style for the code block.
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class Chart(Victory):
@overload
@classmethod
def create(cls, *children, start_angle: Optional[Union[Var[int], int]] = None, end_angle: Optional[Union[Var[int], int]] = None, domain_padding: Optional[Union[Var[Dict], Dict]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Chart": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
start_angle: Start angle for the chart.
end_angle: End angle for the chart.
domain_padding: The padding for the chart.
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class Line(Victory):
@overload
@classmethod
def create(cls, *children, interpolation: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Line": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
interpolation: Interpolation for the line: Polar line charts may use the following interpolation options: "basis", "cardinal", "catmullRom", "linear" and Cartesian line charts may use the following interpolation options: "basis", "bundle", "cardinal", "catmullRom", "linear", "monotoneX", "monotoneY", "natural", "step", "stepAfter", "stepBefore"
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class Bar(Victory):
@overload
@classmethod
def create(cls, *children, alignment: Optional[Union[Var[str], str]] = None, bar_ratio: Optional[Union[Var[float], float]] = None, bar_width: Optional[Union[Var[int], int]] = None, corner_radius: Optional[Union[Var[float], float]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Bar": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
alignment: The alignment prop specifies how bars should be aligned relative to their data points. This prop may be given as "start", "middle" or "end". When this prop is not specified, bars will have "middle" alignment relative to their data points.
bar_ratio: Determines the relative width of bars to the available space. This prop should be given as a number between 0 and 1. When this prop is not specified, bars will have a default ratio of 0.75.
bar_width: Specify the width of each bar.
corner_radius: Specifies a radius to apply to each bar.
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class Area(Victory):
@overload
@classmethod
def create(cls, *children, interpolation: Optional[Union[Var[str], str]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Area": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
interpolation: Interpolation for the line: Polar line charts may use the following interpolation options: "basis", "cardinal", "catmullRom", "linear" and Cartesian line charts may use the following interpolation options: "basis", "bundle", "cardinal", "catmullRom", "linear", "monotoneX", "monotoneY", "natural", "step", "stepAfter", "stepBefore"
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class Pie(Victory):
@overload
@classmethod
def create(cls, *children, color_scale: Optional[Union[Var[Union[str, List[str]]], Union[str, List[str]]]] = None, corner_radius: Optional[Union[Var[float], float]] = None, label_placement: Optional[Union[Var[str], str]] = None, label_position: Optional[Union[Var[str], str]] = None, label_radius: Optional[Union[Var[float], float]] = None, pad_angle: Optional[Union[Var[float], float]] = None, radius: Optional[Union[Var[float], float]] = None, inner_radius: Optional[Union[Var[float], float]] = None, start_angle: Optional[Union[Var[float], float]] = None, end_angle: Optional[Union[Var[float], float]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Pie": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
color_scale: Defines a color scale to be applied to each slice. Takes in an array of colors. Default color scale are: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", "green", "blue".
corner_radius: Specifies the corner radius of the slices rendered in the pie chart.
label_placement: Specifies the angular placement of each label relative to the angle of its corresponding slice. Options are : "parallel", "perpendicular", "vertical".
label_position: Specifies the position of each label relative to its corresponding slice. Options are : "startAngle", "endAngle", "centroid".
label_radius: Defines the radius of the arc that will be used for positioning each slice label. This prop should be given as a number between 0 and 1. If this prop is not set, the label radius will default to the radius of the pie + label padding.
pad_angle: Defines the amount of separation between adjacent data slices in number of degrees.
radius: Specifies the radius of the pie. When this prop is not given, it will be calculated based on the width, height, and padding props.
inner_radius: Specifies the inner radius of the pie. When this prop is not given, it will default to 0.
start_angle: Specifies the start angle of the first slice in number of degrees. Default is 0.
end_angle: Specifies the end angle of the last slice in number of degrees. Default is 360.
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class Candlestick(Victory):
@overload
@classmethod
def create(cls, *children, candle_colors: Optional[Union[Var[Dict], Dict]] = None, candle_ratio: Optional[Union[Var[float], float]] = None, candle_width: Optional[Union[Var[float], float]] = None, close_labels: Optional[Union[Var[List], List]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Candlestick": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
candle_colors: Candle colors are significant in candlestick charts, with colors indicating whether a market closed higher than it opened (positive), or closed lower than it opened (negative). The candleColors prop should be given as an object with color strings specified for positive and negative.
candle_ratio: Specifies an approximate ratio between candle widths and spaces between candles.
candle_width: Specify the width of each candle.
close_labels: Defines the labels that will correspond to the close value for each candle.
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class Scatter(Victory):
@overload
@classmethod
def create(cls, *children, bubble_property: Optional[Union[Var[str], str]] = None, min_bubble_size: Optional[Union[Var[float], float]] = None, max_bubble_size: Optional[Union[Var[float], float]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Scatter": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
bubble_property: Indicates which property of the data object should be used to scale data points in a bubble chart.
min_bubble_size: Sets a lower limit for scaling data points in a bubble chart.
max_bubble_size: Sets an upper limit for scaling data points in a bubble chart.
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class BoxPlot(Victory):
@overload
@classmethod
def create(cls, *children, box_width: Optional[Union[Var[float], float]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "BoxPlot": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
box_width: Specifies how wide each box should be.
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class Histogram(Victory):
@overload
@classmethod
def create(cls, *children, bins: Optional[Union[Var[List], List]] = None, bin_spacing: Optional[Union[Var[float], float]] = None, corner_radius: Optional[Union[Var[float], float]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Histogram": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
bins: Specify how the data will be binned.
bin_spacing: Specifies the amount of space between each bin.
corner_radius: Specifies a radius to apply to each bar.
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class ErrorBar(Victory):
@overload
@classmethod
def create(cls, *children, border_width: Optional[Union[Var[float], float]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "ErrorBar": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
border_width: Sets the border width of the error bars.
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class ChartGroup(Victory):
@overload
@classmethod
def create(cls, *children, color_scale: Optional[Union[Var[Union[str, List[str]]], Union[str, List[str]]]] = None, color: Optional[Union[Var[str], str]] = None, offset: Optional[Union[Var[float], float]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "ChartGroup": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
color_scale: Optional prop that defines a color scale to be applied to the children of the group. Takes in an array of colors. Default color scale are: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", "green", "blue".
color: Optional prop that defines a single color to be applied to the children of the group. Overrides color_scale.
offset: Determines the number of pixels each element in a group should be offset from its original position on the independent axis.
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class ChartStack(Victory):
@overload
@classmethod
def create(cls, *children, categories: Optional[Union[Var[int], int]] = None, color_scale: Optional[Union[Var[Union[str, List[str]]], Union[str, List[str]]]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "ChartStack": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
categories: Prop is used for grouping stacks of bars.
color_scale: Optional prop that defines a color scale to be applied to the children of the group. Takes in an array of colors. Default color scale are: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", "green", "blue".
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class Voronoi(Victory):
@overload
@classmethod
def create(cls, *children, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Voronoi": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
**props: The props to pass to the component.
Returns:
The chart component.
"""
...
class Polar(Victory):
@overload
@classmethod
def create(cls, *children, dependent_axis: Optional[Union[Var[bool], bool]] = None, on_blur: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_context_menu: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_double_click: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_focus: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_down: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_enter: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_leave: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_move: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_out: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_over: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_mouse_up: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_scroll: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, on_unmount: Optional[Union[EventHandler, EventSpec, List, function, BaseVar]] = None, **props) -> "Polar": # type: ignore
"""Create a chart component.
Args:
*children: The children of the component.
dependent_axis: Specifies whether the axis corresponds to the dependent variable
**props: The props to pass to the component.
Returns:
The chart component.
"""
...

View File

@ -105,8 +105,8 @@ class Markdown(Component):
console.deprecate(
"rx.markdown custom_styles",
"Use the component_map prop instead.",
"0.3.0",
"0.3.2",
"0.2.9",
"0.3.1",
)
# Update the base component map with the custom component map.

View File

@ -333,8 +333,8 @@ def set_cookie(key: str, value: str) -> EventSpec:
console.deprecate(
feature_name=f"rx.set_cookie",
reason="and has been replaced by rx.Cookie, which can be used as a state var",
deprecation_version="0.3.0",
removal_version="0.3.1",
deprecation_version="0.2.9",
removal_version="0.3.0",
)
return server_side(
"_set_cookie",
@ -375,8 +375,8 @@ def set_local_storage(key: str, value: str) -> EventSpec:
console.deprecate(
feature_name=f"rx.set_local_storage",
reason="and has been replaced by rx.LocalStorage, which can be used as a state var",
deprecation_version="0.3.0",
removal_version="0.3.1",
deprecation_version="0.2.9",
removal_version="0.3.0",
)
return server_side(
"_set_local_storage",
@ -537,7 +537,7 @@ def call_event_handler(
feature_name="EVENT_ARG API for triggers",
reason="Replaced by new API using lambda allow arbitrary number of args",
deprecation_version="0.2.8",
removal_version="0.3.1",
removal_version="0.3.0",
)
if len(args) == 1:
return event_handler()

View File

@ -1464,8 +1464,8 @@ def get_local_storage(key: Var | str | None = None) -> BaseVar:
console.deprecate(
feature_name=f"rx.get_local_storage",
reason="and has been replaced by rx.LocalStorage, which can be used as a state var",
deprecation_version="0.3.0",
removal_version="0.3.1",
deprecation_version="0.2.9",
removal_version="0.3.0",
)
if key is not None:
if not (isinstance(key, Var) and key.type_ == str) and not isinstance(key, str):