I'm using lazy_high_charts
and foundation 4
.
In my view I have <%= high_chart("my_id", @chart) %>
, which generates the following:
<section>
<script type="text/javascript">
(function() {
var onload = window.onload; # I think
window.onload = function(){ # the issue
if (typeof onload == "function") onload(); # is here
var options = { "title": { "text": "Combination chart" },"legend": { "layout": "vertical","style": { } },"xAxis": { },"yAxis": { "title": { "text": null },"labels": { } },"tooltip": { "enabled": true },"credits": { "enabled": false },"plotOptions": { "areaspline": { } },"chart": { "defaultSeriesType": "line","renderTo": "my_id" },"subtitle": { },"series": [{ "type": "spline","name": "Average","data": [ 3,2.67,3,6.33,3.33 ] }] };
window.chart_my_id = new Highcharts.Chart(options);
};
})()
</script>
<div id="my_id"></div>
</section>
However, it is not displaying because of the following lines generated by foundation 4
in my application.js
$(document).foundation();
$(function(){ $(document).foundation(); });
If I delete those lines the chart loads.
How can I use foundation
and lazy_high_charts
together?
I solved the problem updating the
zurb-foundation
andlazy_high_charts
gems:In my Gemfile:
Then:
I have also included the following lines in the
application.html.erb
:After that, the
<%= high_chart("my_id", @chart) %>
code is generating the following javascript:I hope it helps people facing the same problem.