Open allenwyma opened 10 years ago
I don't actually use Turbolinks at all. If you want to contribute a PR, I'll certainly take a look at it.
A starting point might be calling validateNow()
on a previously created chart on the page load event? The chart can be accessed through the AmCharts.charts
array or by name via AmCharts.RB.Charts.name
.
Problem lies within the AmCharts.ready method that you use. It is triggered even after the document's ready event, which i think is a bit odd, but alright. I'm in talks with how to fix this issue with turbolinks, so far was not able to figure it out.
AmCharts.ready
is a function provided by the core of AmCharts, not something added by amcharts.rb, and is the recommended way of creating/setting up a chart. As far as I can tell, it's pretty much just a wrapper around a window.load event listener (it pushes the function passed in to AmCharts.onReadyArray
, which is then iterated over in AmCharts.handleLoad
).
Again, I'm not really familiar with turbolinks, but would it maybe be possible add an event listener for the turbolinks event that calls AmCharts.handleLoad
.
anyone ever figure this out?
AmCharts.ready works fine if you don't use Turbolinks, but we need to have a way to trigger what's inside of AmCharts.ready. What about creating something inside of the AmCharts.helper that gets triggered using document ready and the page load events from turbolinks?