ButtonManager#
- class ansys.tools.visualization_interface.backends.plotly.widgets.button_manager.ButtonManager(fig: plotly.graph_objects.Figure)#
Class to manage buttons in a Plotly figure.
This class allows adding buttons to a Plotly figure for various functionalities such as toggling visibility of traces, resetting the view, and custom actions.
- Parameters:
- fig
go.Figure The Plotly figure to which buttons will be added.
- fig
Overview#
Add a button to the Plotly figure. |
|
Generate dictionary for showing/hiding coordinate system elements. |
|
Update the figure layout with all controls as buttons in a single row. |
|
Get camera configuration for XY plane view (top-down view). |
|
Get camera configuration for XZ plane view (front view). |
|
Get camera configuration for YZ plane view (side view). |
|
Get camera configuration for isometric view (3D perspective). |
|
Get configuration for measurement toggle button. |
|
Get configuration for projection toggle button. |
|
Get configuration for theme toggle button. |
Import detail#
from ansys.tools.visualization_interface.backends.plotly.widgets.button_manager import ButtonManager
Method detail#
- ButtonManager.add_button(label: str, x: float, y: float, xanchor: str = 'left', yanchor: str = 'bottom', method: str = 'restyle', args: List[Any] = None, args2: List[Any] = None) → None#
Add a button to the Plotly figure.
- Parameters:
- label
str The text to display on the button.
- x
float X position of the button (0-1).
- y
float Y position of the button (0-1).
- xanchor
str,optional X anchor point for the button, by default “left”.
- yanchor
str,optional Y anchor point for the button, by default “bottom”.
- method
str,optional The method to call when the button is clicked. Options include: ‘restyle’, ‘relayout’, ‘update’, ‘animate’, by default ‘restyle’.
- args
List[Any],optional Arguments to pass to the method when the button is clicked, by default None.
- args2
List[Any],optional Secondary arguments for toggle functionality, by default None.
- label
- ButtonManager.show_hide_bbox_dict(toggle: bool = True)#
Generate dictionary for showing/hiding coordinate system elements.
- ButtonManager.update_layout() → None#
Update the figure layout with all controls as buttons in a single row.
This method builds buttons using the configuration methods and any additional buttons that were added via add_button().
- ButtonManager.args_xy_view_button(label: str = 'XY View', x: float = 0.02, y: float = 1.02) → dict#
Get camera configuration for XY plane view (top-down view).
- ButtonManager.args_xz_view_button(label: str = 'XZ View', x: float = 0.02, y: float = 1.02) → dict#
Get camera configuration for XZ plane view (front view).
- ButtonManager.args_yz_view_button(label: str = 'YZ View', x: float = 0.02, y: float = 1.02) → dict#
Get camera configuration for YZ plane view (side view).
- ButtonManager.args_iso_view_button(label: str = 'ISO View', x: float = 0.02, y: float = 1.02) → dict#
Get camera configuration for isometric view (3D perspective).
- ButtonManager.add_measurement_toggle_button(label: str = 'Toggle Measurement', x: float = 0.02, y: float = 0.87) → Tuple[dict, dict]#
Get configuration for measurement toggle button.
- Parameters:
- Returns:
- ButtonManager.args_projection_toggle_button() → Tuple[dict, dict]#
Get configuration for projection toggle button.
- Parameters:
- Returns: