plotly.pyi 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. """Stub file for reflex/components/plotly/plotly.py"""
  2. # ------------------- DO NOT EDIT ----------------------
  3. # This file was generated by `reflex/utils/pyi_generator.py`!
  4. # ------------------------------------------------------
  5. from typing import Any, Dict, List, Optional, Union, overload
  6. from typing_extensions import TypedDict, TypeVar
  7. from reflex.components.component import NoSSRComponent
  8. from reflex.event import BASE_STATE, EventType
  9. from reflex.style import Style
  10. from reflex.utils import console
  11. from reflex.vars.base import Var
  12. try:
  13. from plotly.graph_objects import Figure, layout
  14. Template = layout.Template
  15. except ImportError:
  16. console.warn("Plotly is not installed. Please run `pip install plotly`.")
  17. Figure = Any
  18. Template = Any
  19. T = TypeVar("T")
  20. ItemOrList = Union[T, List[T]]
  21. class BBox(TypedDict):
  22. x0: Union[float, int, None]
  23. x1: Union[float, int, None]
  24. y0: Union[float, int, None]
  25. y1: Union[float, int, None]
  26. z0: Union[float, int, None]
  27. z1: Union[float, int, None]
  28. class Point(TypedDict):
  29. x: Union[float, int, None]
  30. y: Union[float, int, None]
  31. z: Union[float, int, None]
  32. lat: Union[float, int, None]
  33. lon: Union[float, int, None]
  34. curveNumber: Union[int, None]
  35. pointNumber: Union[int, None]
  36. pointNumbers: Union[List[int], None]
  37. pointIndex: Union[int, None]
  38. markerColor: Union[ItemOrList[ItemOrList[Union[float, int, str, None]]], None]
  39. markerSize: Union[ItemOrList[ItemOrList[Union[float, int, None]]], None]
  40. bbox: Union[BBox, None]
  41. class Plotly(NoSSRComponent):
  42. def add_imports(self) -> dict[str, str]: ...
  43. def add_custom_code(self) -> list[str]: ...
  44. @overload
  45. @classmethod
  46. def create( # type: ignore
  47. cls,
  48. *children,
  49. data: Optional[Union[Figure, Var[Figure]]] = None, # type: ignore
  50. layout: Optional[Union[Dict, Var[Dict]]] = None,
  51. template: Optional[Union[Template, Var[Template]]] = None, # type: ignore
  52. config: Optional[Union[Dict, Var[Dict]]] = None,
  53. use_resize_handler: Optional[Union[Var[bool], bool]] = None,
  54. style: Optional[Style] = None,
  55. key: Optional[Any] = None,
  56. id: Optional[Any] = None,
  57. class_name: Optional[Any] = None,
  58. autofocus: Optional[bool] = None,
  59. custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
  60. on_after_plot: Optional[EventType[[], BASE_STATE]] = None,
  61. on_animated: Optional[EventType[[], BASE_STATE]] = None,
  62. on_animating_frame: Optional[EventType[[], BASE_STATE]] = None,
  63. on_animation_interrupted: Optional[EventType[[], BASE_STATE]] = None,
  64. on_autosize: Optional[EventType[[], BASE_STATE]] = None,
  65. on_before_hover: Optional[EventType[[], BASE_STATE]] = None,
  66. on_blur: Optional[EventType[[], BASE_STATE]] = None,
  67. on_button_clicked: Optional[EventType[[], BASE_STATE]] = None,
  68. on_click: Optional[
  69. Union[EventType[[], BASE_STATE], EventType[[List[Point]], BASE_STATE]]
  70. ] = None,
  71. on_context_menu: Optional[EventType[[], BASE_STATE]] = None,
  72. on_deselect: Optional[EventType[[], BASE_STATE]] = None,
  73. on_double_click: Optional[EventType[[], BASE_STATE]] = None,
  74. on_focus: Optional[EventType[[], BASE_STATE]] = None,
  75. on_hover: Optional[
  76. Union[EventType[[], BASE_STATE], EventType[[List[Point]], BASE_STATE]]
  77. ] = None,
  78. on_mount: Optional[EventType[[], BASE_STATE]] = None,
  79. on_mouse_down: Optional[EventType[[], BASE_STATE]] = None,
  80. on_mouse_enter: Optional[EventType[[], BASE_STATE]] = None,
  81. on_mouse_leave: Optional[EventType[[], BASE_STATE]] = None,
  82. on_mouse_move: Optional[EventType[[], BASE_STATE]] = None,
  83. on_mouse_out: Optional[EventType[[], BASE_STATE]] = None,
  84. on_mouse_over: Optional[EventType[[], BASE_STATE]] = None,
  85. on_mouse_up: Optional[EventType[[], BASE_STATE]] = None,
  86. on_redraw: Optional[EventType[[], BASE_STATE]] = None,
  87. on_relayout: Optional[EventType[[], BASE_STATE]] = None,
  88. on_relayouting: Optional[EventType[[], BASE_STATE]] = None,
  89. on_restyle: Optional[EventType[[], BASE_STATE]] = None,
  90. on_scroll: Optional[EventType[[], BASE_STATE]] = None,
  91. on_selected: Optional[
  92. Union[EventType[[], BASE_STATE], EventType[[List[Point]], BASE_STATE]]
  93. ] = None,
  94. on_selecting: Optional[
  95. Union[EventType[[], BASE_STATE], EventType[[List[Point]], BASE_STATE]]
  96. ] = None,
  97. on_transition_interrupted: Optional[EventType[[], BASE_STATE]] = None,
  98. on_transitioning: Optional[EventType[[], BASE_STATE]] = None,
  99. on_unhover: Optional[
  100. Union[EventType[[], BASE_STATE], EventType[[List[Point]], BASE_STATE]]
  101. ] = None,
  102. on_unmount: Optional[EventType[[], BASE_STATE]] = None,
  103. **props,
  104. ) -> "Plotly":
  105. """Create the Plotly component.
  106. Args:
  107. *children: The children of the component.
  108. data: The figure to display. This can be a plotly figure or a plotly data json.
  109. layout: The layout of the graph.
  110. template: The template for visual appearance of the graph.
  111. config: The config of the graph.
  112. use_resize_handler: If true, the graph will resize when the window is resized.
  113. on_after_plot: Fired after the plot is redrawn.
  114. on_animated: Fired after the plot was animated.
  115. on_animating_frame: Fired while animating a single frame (does not currently pass data through).
  116. on_animation_interrupted: Fired when an animation is interrupted (to start a new animation for example).
  117. on_autosize: Fired when the plot is responsively sized.
  118. on_before_hover: Fired whenever mouse moves over a plot.
  119. on_button_clicked: Fired when a plotly UI button is clicked.
  120. on_click: Fired when the plot is clicked.
  121. on_deselect: Fired when a selection is cleared (via double click).
  122. on_double_click: Fired when the plot is double clicked.
  123. on_hover: Fired when a plot element is hovered over.
  124. on_relayout: Fired after the plot is laid out (zoom, pan, etc).
  125. on_relayouting: Fired while the plot is being laid out.
  126. on_restyle: Fired after the plot style is changed.
  127. on_redraw: Fired after the plot is redrawn.
  128. on_selected: Fired after selecting plot elements.
  129. on_selecting: Fired while dragging a selection.
  130. on_transitioning: Fired while an animation is occurring.
  131. on_transition_interrupted: Fired when a transition is stopped early.
  132. on_unhover: Fired when a hovered element is no longer hovered.
  133. style: The style of the component.
  134. key: A unique key for the component.
  135. id: The id for the component.
  136. class_name: The class name for the component.
  137. autofocus: Whether the component should take the focus once the page is loaded
  138. custom_attrs: custom attribute
  139. **props: The properties of the component.
  140. Returns:
  141. The Plotly component.
  142. """
  143. ...