Figure Configuration
figure_config()
Every strategy exposes a figure_config(**kwargs) instance method that returns a
serialisable Plotly config dict. The web layer passes this to
Figure.to_html(config=...) when rendering each figure.
By default the config:
- Hides the Plotly logo (
displaylogo: False). - Removes the box-select and lasso tools (
modeBarButtonsToRemove).
Any extra keyword arguments are merged in, with caller-supplied values taking precedence:
Customizing the modebar
Override modebar_config() in a subclass to customise the modebar for a specific strategy:
class MyBarChartStrategy(BarChartStrategy):
def modebar_config(self) -> dict:
cfg = super().modebar_config()
cfg["modeBarButtonsToRemove"].append("zoom2d")
return cfg
Note
JavaScript callbacks (e.g. adding a Download SVG button) cannot be serialised to
JSON and therefore cannot be part of the Python config dict. Use a post_script when
calling Figure.to_html() for that purpose.