bbonnin / vue-morris

VueJS component wrapping Morris.js
MIT License
235 stars 36 forks source link

Does not render properly when there is no data initially #2

Closed mkhanal closed 7 years ago

mkhanal commented 7 years ago

Scenario: The data comes up from the server. Vuejs binds data to charts post data fetch.

Issue: No chart is rendered. The chart renders properly after a window resize. Also, once the chart renders fine, new data updates to the chart will render chart correctly.

bbonnin commented 7 years ago

I have updated my example https://github.com/bbonnin/vue-morris-example : no data at the beginning for the line chart, then update each 5 seconds. It seems to work in this case, the chart is rendered correctly after 5 seconds. Can you provide an example ?

mkhanal commented 7 years ago

Looks like the issue only happens when using vue-router (or when the map is hidden initially and conditionally shown later on) The same issue also exists for other few other libraries that we are using like google maps and cytoscapejs

Our hack is to run the below code when the component becomes visible

 window.dispatchEvent(new Event('resize'))