Incubator-echarts: Is Echarts 3 responsive ?

Created on 1 Sep 2016  ·  10Comments  ·  Source: apache/incubator-echarts

Im trying to switch from chartjs to Echarts.

Chartjs resize automatically when i resize the window by default which is not the case for Echarts. Is there any option for that ?

Thank you.

stale

Most helpful comment

You can use chart.resize() whenever the container size changed

All 10 comments

You can use chart.resize() whenever the container size changed

What if I have multiple charts on the page (inside panel/card) like dashboard? For example I have a panel. Inside panel body, I am showing a bar chart. Since I have specified fix height in px, chart.resize() will not cover the whole panel body. Is there a solution to get the height and width of panel?

@hbthanki Do you mean you fix the height of chart? If you have a flexible panel, don't fix the height of the chart. And resize() when panel changes the size.

Thanks for your reply. I got that working now. However, I have strange observation. If panel's _width_ is changed, and I call .resize() nothing happens. But if I change _height and width_ both and call resize(), chart is resizing properly.

Use SVG renderer?

Yes I used svg renderer.

SVG renderer had this problem. Already fixed in https://github.com/ecomfe/zrender/pull/303

I have installed echarts from _npm i echarts_ just now. Do I need to refer any _branch_ for this change? Please bear with my little knowledge. And Thank you so much for your replies. I could find below code in echarts.js file: ("echarts": "^3.8.5")
image

You need to checkout the latest code of zrender and put it under node_modules

Please ignore below 1, I had to build again for zrender to be picked up.

1. Do I need to specifically import zrender? Because after _npm install zrender_ it is still not working. Either something wrong with my setup or I am missing some other lib?

  1. curiosity question: Without installing zrender, and making _renderer: 'svg'_, it was creating svg. Why do we need extra lib for svg?
    Thanks once again.
Was this page helpful?
0 / 5 - 0 ratings