# Set up responsive mode on echarts

**URL:** <https://discourse.holoviz.org/t/set-up-responsive-mode-on-echarts/4429>\
**Category:** Panel\
**Created:** [October 22, 2022, 10:56am UTC](https://discourse.holoviz.org/t/set-up-responsive-mode-on-echarts/4429 "2022-10-22T10:56:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nemesis](https://discourse.holoviz.org/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nemesis](https://discourse.holoviz.org/u/nemesis)\
**Post date:** [October 22, 2022, 10:56am UTC](https://discourse.holoviz.org/t/set-up-responsive-mode-on-echarts/4429/1 "2022-10-22T10:56:27Z")

</div>

Hi;

I’m testing echarts for one of my dashboard. But I could not set responsive mode when I use pyechart example in [ECharts — Panel v0.14.0](https://panel.holoviz.org/reference/panes/ECharts.html). If you can help me on this topic, I will be grateful…

```auto
from pyecharts.charts import Bar

bar1 = pn.widgets.IntSlider(start=1, end=100, value=50)
bar2 = pn.widgets.IntSlider(start=1, end=100, value=50)

@pn.depends(bar1.param.value, bar2.param.value)
def plot(bar1, bar2):
    my_plot= (Bar()
        .add_xaxis(['Helicoptors', 'Planes'])
        .add_yaxis('Total In Flight', [bar1, bar2])
    )
    return pn.pane.ECharts(my_plot, width=500, height=250)
pn.Row(pn.Column(bar1, bar2), plot).servable()

```

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![nemesis](https://discourse.holoviz.org/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nemesis](https://discourse.holoviz.org/u/nemesis)\
**Post date:** [October 30, 2022, 5:32am UTC](https://discourse.holoviz.org/t/set-up-responsive-mode-on-echarts/4429/2 "2022-10-30T05:32:01Z")

</div>

Hi. does it mean there is no way to do? In documentation, it can be set if pyechart is not preferred. I think it should be easy. but I could not find a way.

---

<div class="post-metadata">

**Author:** ![Marc](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/marc/32/24_2.png) [@Marc](https://discourse.holoviz.org/u/Marc)\
**Post date:** [October 30, 2022, 8:35am UTC](https://discourse.holoviz.org/t/set-up-responsive-mode-on-echarts/4429/3 "2022-10-30T08:35:00Z")

</div>

Hi @nemesis

Unfortunately `pyecharts` does not support the `responsive` setting. So you will have to find a work around.

This works

 ![image](https://discourse.holoviz.org/uploads/default/original/2X/9/95ce7ae75d525cdcf83822cb660030eef4d5d262.png)

```python
import json

import panel as pn
from pyecharts.charts import Bar

bar1 = pn.widgets.IntSlider(start=1, end=100, value=50)
bar2 = pn.widgets.IntSlider(start=1, end=100, value=50)

@pn.depends(bar1.param.value, bar2.param.value)
def plot(bar1, bar2):
    my_plot= (Bar()
        .add_xaxis(['Helicoptors', 'Planes'])
        .add_yaxis('Total In Flight', [bar1, bar2])
    )

    my_plot.options["responsive"] = True
    my_plot = json.loads(my_plot.dump_options())
    return pn.pane.ECharts(my_plot, height=500, sizing_mode="stretch_width")

pn.Row(pn.Column(bar1, bar2), plot).servable()

```

It’s always a good idea to consult [awesome-panel.org](https://www.awesome-panel.org/gallery?search=echarts). It contains working examples end to end that handles responsiveness and themes. More specifically consult the app gallery and filter on your framework of interest [Awesome Panel | Gallery](https://www.awesome-panel.org/gallery?search=echarts).

[![image](https://discourse.holoviz.org/uploads/default/original/2X/d/df27c087d349a0790363f56c90234e5a4f76d622.jpeg)](https://www.awesome-panel.org/gallery?search=echarts)

---

<div class="post-metadata">

**Author:** ![nemesis](https://discourse.holoviz.org/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nemesis](https://discourse.holoviz.org/u/nemesis)\
**Post date:** [October 30, 2022, 9:26am UTC](https://discourse.holoviz.org/t/set-up-responsive-mode-on-echarts/4429/4 "2022-10-30T09:26:16Z")

</div>

Hi Marc,

Thanks for your prompt answer. Indeed I’m aware of your site. I’m following you a lot. I also like highcharts a lot. Examples in awesome-panel are very good examples. When I got stuck, I’m checking your examples. But this does not work for me.

But for panel version 0.13, it works. is there any know version specific problem?

I also have another problem. [pyecharts-gallery/liquid\_data\_precision.py at master · pyecharts/pyecharts-gallery · GitHub](https://github.com/pyecharts/pyecharts-gallery/blob/master/Liquid/liquid_data_precision.py). I need to use formatter. But when I add javascript, json load and dump\_option is throwing error.  
I checked pycharts documentation. They did not update pychart documentation for a while. (or I did not find the up-to-date documentation) But in GitHub, I can see examples are up-to-date.

My third question is about events. Is it possible to use click event of pycharts or echarts in panel?

Thanks for your help in advance.

---

<div class="post-metadata">

**Author:** ![Marc](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/marc/32/24_2.png) [@Marc](https://discourse.holoviz.org/u/Marc)\
**Post date:** [October 30, 2022, 12:31pm UTC](https://discourse.holoviz.org/t/set-up-responsive-mode-on-echarts/4429/5 "2022-10-30T12:31:48Z")

</div>

Hi @nemesis

Thanks

1. For me the example works with Panel 0.14.0.
2. Using javascript etc will probably not work. I would love it to do. Could you make a feature request?
3. using events does not work. There is a Feature request here [Events support for Panel Echarts · Issue #2147 · holoviz/panel (github.com)](https://github.com/holoviz/panel/issues/2147). Could you upvote it?

---

<div class="post-metadata">

**Author:** ![nemesis](https://discourse.holoviz.org/letter_avatar_proxy/v4/letter/n/96bed5/32.png) [@nemesis](https://discourse.holoviz.org/u/nemesis)\
**Post date:** [October 30, 2022, 1:42pm UTC](https://discourse.holoviz.org/t/set-up-responsive-mode-on-echarts/4429/6 "2022-10-30T13:42:38Z")

</div>

@Marc Thanks. I opened a feature request.
