ecomfe / echarts-wordcloud

Word Cloud extension based on Apache ECharts and wordcloud2.js
1.62k stars 707 forks source link

Chart not resize on browser resize #127

Closed serlo89 closed 2 years ago

serlo89 commented 2 years ago

Echarts documentation - section "Reactive of the Container Size" - says that you can change the chart size while the size of containers changed (https://echarts.apache.org/handbook/en/concepts/chart-size).

<style>
  #main,
  html,
  body {
    width: 100%;
  }
  #main {
    height: 400px;
  }
</style>
<div id="main"></div>
<script type="text/javascript">
  var myChart = echarts.init(document.getElementById('main'));
  window.onresize = function() {
    myChart.resize();
  };
</script>

But using this with wordcloud returns an error:

(index):411 Uncaught TypeError: chart.resize is not a function at window.onresize

It works perfectly with other default types instead. Kind regards.

serlo89 commented 2 years ago

Imported correct echarts library. Now it works also with tag cloud.