Chart and Modal Button
This template joins a chart with a description and a button that opens a modal.
The Method To Use
The method is s.plt.chart_and_modal_button()
It must contain the following input variables:
menu_path: str,
order: int,
# The parameters that the chart function will take when executed
chart_parameters: Dict,
# The name of the modal that will be used by the button
button_modal: str
And accepts the following input variables as optional:
rows_size: int = 3,
cols_size: int = 12,
# The funcion that will be executed passing the previous parameters,
# by default it will use a free_echarts bar chart
chart_function: Optional[Callable] = None,
button_label: str = 'Read more',
tabs_index: Optional[Tuple[str, str]] = None,
modal_name: Optional[str] = None,
button_side_text: str = "Click on the button to read more about this topic.",
Examples
This example shows how to use the method:
data = [
{'Email': 120, 'Union Ads': 132, 'Video Ads': 101, 'Search Engine': 134, 'Weekday': 'Mon'},
{'Email': 220, 'Union Ads': 182, 'Video Ads': 191, 'Search Engine': 234, 'Weekday': 'Tue'},
{'Email': 150, 'Union Ads': 232, 'Video Ads': 201, 'Search Engine': 154, 'Weekday': 'Wed'},
{'Email': 820, 'Union Ads': 932, 'Video Ads': 901, 'Search Engine': 934, 'Weekday': 'Thu'},
{'Email': 120, 'Union Ads': 132, 'Video Ads': 101, 'Search Engine': 134, 'Weekday': 'Fri'},
{'Email': 220, 'Union Ads': 182, 'Video Ads': 191, 'Search Engine': 234, 'Weekday': 'Sat'},
{'Email': 150, 'Union Ads': 232, 'Video Ads': 201, 'Search Engine': 154, 'Weekday': 'Sun'},
]
s.plt.chart_and_modal_button(
order=0, button_modal='test modal',
chart_function=s.plt.stacked_area,
chart_parameters=dict(
data=data,
x="Weekday", variant='minimal',
x_axis_name='Visits per weekday',
)
)

Last updated
Was this helpful?