Plot Callbacks¶
Defines the plot appearance and filtering callbacks for the plot elements.
- qimchi.components.plot_callbacks.plot_selector() Div [source]¶
Generator for the plot selector, defining the dropdowns for the dependent and independent variables.
- Returns:
Dash div component containing the dropdowns for the dependent and independent variables.
- Return type:
dash.html.Div
- qimchi.components.plot_callbacks.plots_container() Div [source]¶
Plots container
- Returns:
Empty div to hold the plots, to be filled with callbacks
- Return type:
dash.html.Div
- qimchi.components.plot_callbacks.update_state_wafer_id(sess_id: str, measurement: str, measurement_type: str, device_id: str, device_type: str, wafer_id: str) None [source]¶
Update the state with the wafer id, device type, device id, measurement type, and measurement.
- qimchi.components.plot_callbacks.update_plot_width(sess_id: str, width: str) str [source]¶
Callback to update the plot width based on the input value.
- Parameters:
sess_id (str) – Session ID to load the state for.
width (str) – Width of the plot.
- Returns:
Bulma className for the plot width.
- Return type:
str
- qimchi.components.plot_callbacks.update_plot_list(sess_id: str, dependents: str, independents: list, plots_list: list, sig: int, *_) Tuple[list] [source]¶
Callback to add a plot to the plots container, or to update existing plots in the container.
The container is updated under the following conditions:
If the data is selected for the first time, it generates default plots based on the data.
If the user adds a new plot, it generates a new plot based on the selected dependent and independent variables.
If the user clears all plots, it removes all the plots from the container.
If the user deletes a specific plot, it removes the plot from the container.
If the user uploads new data, it updates the plots based on the new data. Filters, ranges, and appearance settings are retained.
- Parameters:
sess_id (str) – Session ID to load the state for
dependents (str) – Selected dependent variables. # TODOLATER: type, when deps is a list
independents (list) – Selected independent variables.
plots_list (list) – List of plots in the plots container.
sig (int) – Signal to indicate that data has been updated
- Returns:
Updated plots list.
- Return type:
tuple
- qimchi.components.plot_callbacks.toggle_dropdown(sess_id: str, r_state: str, a_state: str, s_state: str, r_n_clicks: int, a_n_clicks: int, s_n_clicks: int) tuple [source]¶
Callback to toggle the dropdowns for the plot options. Toggles the dropdowns for the plot options when the corresponding button is clicked. Changes the color to warning when the button is active, and changes it back, when the button is clicked again.
- Parameters:
sess_id (str) – Session ID to load the state for
r_state (str) – State of the ranges dropdown from the class name.
a_state (str) – State of the appearance dropdown from the class name.
s_state (str) – State of the filters dropdown from the class name.
- Returns:
Tuple of display styles and class names for the dropdowns and buttons.
- Return type:
tuple
- qimchi.components.plot_callbacks.update_settings(sess_id: str, line_mode: list[str]) tuple [source]¶
Callback to update the settings based on the line mode dropdown.
- Parameters:
sess_id (str) – Session ID to load the state for
line_mode (list) – Selected line mode.
- Returns:
Updated class names for the settings.
- Return type:
tuple
- qimchi.components.plot_callbacks.store_relayout_data(sess_id: str, relayout_data: dict) dict [source]¶
Callback to store the relayout data in dcc.Store to be used while exporting the plot.
- Parameters:
sess_id (str) – Session ID to load the state for.
relayout_data (dict) – Relayout data from the plot.
- Returns:
Relayout data.
- Return type:
dict
- qimchi.components.plot_callbacks.download_dataset(_ddb_n_clicks: int, sess_id: str) dict [source]¶
Callback to download the dataset.
- Parameters:
_ddb_n_clicks (int) – Number of clicks on the download button.
sess_id (str) – Session ID to load the state for.
- Returns:
Data to download the dataset.
- Return type:
dict
- Raises:
PreventUpdate – If the session ID is not found or the measurement path is not set.
- qimchi.components.plot_callbacks.export_images(n_clicks: int, relayout_data: dict, orig_fig: Figure, sess_id: str) Tuple[str, str, bool] [source]¶
Callback to export the figure in .svg, .png. .pdf formats in light and dark mode with relayout. Shows a toast notification with the export status.
- Parameters:
n_clicks (int) – Number of clicks on the export button.
relayout_data (dict) – Relayout data from the plot.
orig_fig (go.Figure) – Original figure.
sess_id (str) – Session ID to load the state for.
- Returns:
Toast color, message, is_open status and download link.
- Return type:
Tuple[str, str, bool, dict]
- qimchi.components.plot_callbacks.squarify_plots(sess_id: str, squarify: bool) dict [source]¶
Callback to squarify the plots.
- Parameters:
sess_id (str) – Session ID to load the state for
squarify (bool) – Squarify all plots.
- Returns:
Style for the plots.
- Return type:
dict
- qimchi.components.plot_callbacks.update_plot_by_type(sess_id: str, figure: dict, _: list) Figure [source]¶
Callback to update the plot appearance settings by plot type.
- Parameters:
sess_id (str) – Session ID to load the state for
figure (dict) – Dict representation of a go.Figure object.
_ – List of values from the dropdowns. Unused.
- Returns:
Updated figure.
- Return type:
go.Figure
- qimchi.components.plot_callbacks.update_plot_axes(sess_id: str, figure: dict, _: list) Figure [source]¶
Callback to update the plot appearance settings for the axes.
- Parameters:
sess_id (str) – Session ID to load the state for
figure (dict) – Dict representation of a go.Figure object.
_ – List of values from the dropdowns. Unused.
- Returns:
Updated figure.
- Return type:
go.Figure
- qimchi.components.plot_callbacks.update_plot_range(sess_id: str, range_val: float) Figure [source]¶
Updates the plot based on the range slider values and filter button clicks.
- Parameters:
sess_id (str) – Session ID to load the state for
range_val (float) – Value of the range slider
- Returns:
Updated figure
- Return type:
go.Figure
- qimchi.components.plot_callbacks.update_filter_opts(sess_id: str, _: Any) Figure [source]¶
Updates the filter opts and the plot.
- Parameters:
sess_id (str) – Session ID to load the state for
- Returns:
Updated figure.
- Return type:
go.Figure
- qimchi.components.plot_callbacks.update_hmap_rangecolor_slider(sess_id: str, figure: Figure) Tuple[float, float, dict, list] [source]¶
Callback to update the rangecolor RangeSlider based on the HeatMap’s data.
- Parameters:
sess_id (str) – Session ID to load the state for
figure (go.Figure) – 2D HeatMap.
- Returns:
Min, max, marks, and value of the rangecolor RangeSlider.
- Return type:
Tuple[float, float, dict, list]
- qimchi.components.plot_callbacks.update_filter_apply(sess_id: str, _: Any) Figure [source]¶
Updates the plot based on the applied filters.
- Parameters:
sess_id (str) – Session ID to load the state for
- Returns:
Updated figure.
- Return type:
go.Figure
- qimchi.components.plot_callbacks.apply_hmap_rcol_textbox(rcol_min: float, rcol_max: float, figure: dict, sess_id: str, n_clicks: int, *_: Any) Figure [source]¶
Updates the plot based on the applied rangecolor values from the textboxes.
- Parameters:
rcol_min (float) – Minimum value of the rangecolor.
rcol_max (float) – Maximum value of the rangecolor.
figure (dict) – Dict representation of a go.Figure object.
sess_id (str) – Session ID to load the state for
n_clicks (int) – Number of clicks on the apply button.
*_ – Unused.
- Returns:
Updated figure.
- Return type:
go.Figure
- qimchi.components.plot_callbacks.show_custom_hover(figure: dict, hoverData: dict) str [source]¶
Callback to display the hover data in a custom format.
- Parameters:
figure (dict) – Dict representation of a go.Figure object.
hoverData (dict) – Hover data from the plot.
- Returns:
Formatted hover data string.
- Return type:
str