# 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:

```python
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:

```python
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:

```python
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',
    )
)
```

<figure><img src="/files/rTnzzlwD9BqwcUrAW5bE" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.shimoku.com/dev/elements/composite-template-charts/chart-and-modal-button.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
