search

Home  >  Q&A  >  body text

html5 - echarts设置容器宽高 能用rem做单位吗

pc端页面 兼容只限于谷歌浏览器 为了自适应屏幕 用了rem做单位 不知道可不可以 求指教

PHP中文网PHP中文网2784 days ago965

reply all(2)I'll reply

  • 怪我咯

    怪我咯2017-04-17 15:01:28

    I solved it myself

        searchWordChart.setOption(option);
        window.addEventListener("resize", function () {
            setTimeout(function () {
                searchWordChart.resize();
            }, 500)
        });

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 15:01:28

    Yes. I have made a page implemented using rem. The map in the lower right corner is made of echarts: Example of echarts using rem

    But when the user manually resizes the window, the chart will not automatically change size. You need to register the window's resize event and re-render echarts

    reply
    0
  • Cancelreply