niamoto.core.plugins.widgets package¶
Submodules¶
niamoto.core.plugins.widgets.bar_plot module¶
niamoto.core.plugins.widgets.concentric_rings module¶
niamoto.core.plugins.widgets.diverging_bar_plot module¶
niamoto.core.plugins.widgets.donut_chart module¶
niamoto.core.plugins.widgets.info_grid module¶
niamoto.core.plugins.widgets.interactive_map module¶
niamoto.core.plugins.widgets.line_plot module¶
niamoto.core.plugins.widgets.plotly_utils module¶
Utility functions for Plotly-based widgets.
This module provides common functionality for all Plotly widgets, including consistent configuration and styling.
- niamoto.core.plugins.widgets.plotly_utils.get_plotly_config()¶
Get standard Plotly configuration for all widgets.
- Returns:
Dictionary with Plotly config options
- Return type:
Dict[str, Any]
- niamoto.core.plugins.widgets.plotly_utils.get_plotly_layout_defaults()¶
Get default layout options for all Plotly charts.
- Returns:
Dictionary with layout defaults including watermark removal
- Return type:
Dict[str, Any]
- niamoto.core.plugins.widgets.plotly_utils.apply_plotly_defaults(fig, additional_layout=None)¶
Apply standard Plotly defaults to a figure.
- Parameters:
fig – Plotly figure object
additional_layout (Dict[str, Any]) – Additional layout options to merge with defaults
- Returns:
Modified figure object
- niamoto.core.plugins.widgets.plotly_utils.get_plotly_dependencies()¶
Get the standard Plotly core dependency (no maps).
- Returns:
Set containing the Plotly core bundle URL
- Return type:
Set[str]
- niamoto.core.plugins.widgets.plotly_utils.get_plotly_map_dependencies()¶
Get Plotly dependencies including map support.
- Returns:
Set containing the Plotly maps bundle URL
- Return type:
Set[str]
- niamoto.core.plugins.widgets.plotly_utils.get_map_tile_fallback_script(div_id)¶
Generate a JavaScript snippet that detects tile loading failures and falls back to white-bg map style with an offline notice.
This is used by map widgets to gracefully handle offline scenarios where map tile servers are unreachable.
- Parameters:
div_id (str) – The Plotly div ID for the map
- Returns:
HTML script tag with tile fallback logic
- Return type:
str
- niamoto.core.plugins.widgets.plotly_utils.render_plotly_figure(fig, config=None, is_map=False)¶
Render a Plotly figure to HTML with standard configuration.
Important: This assumes Plotly JS is loaded centrally through the dependency system. All Plotly widgets should include the dependency from get_plotly_dependencies().
- Parameters:
fig – Plotly figure object
config (Dict[str, Any]) – Optional custom config (defaults will be applied)
is_map (bool) – If True, adds tile fallback script for offline map support
- Returns:
HTML string (without embedded Plotly JS)
- Return type:
str