I am using Highcharts with Rails 4 and Turbolinks. I faced the problem of charts not appearing when switching pages.
I fixed this by doing this in the initialization script:
var ready = function(){
Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, function(color) {
return {
radialGradient: { cx: 0.5, cy: 0.3, r: 0.7 },
stops: [
[0, color],
[1, Highcharts.Color(color).brighten(-0.3).get('rgb')] // darken
]
};
});
//further initialization
}
$(document).ready(ready);
$(document).on('page:load', ready);
Then it loaded every time I visited the page. But the entire chart is black. I am using pie charts with multiple colors. But only the first time colors are displayed. But in subsequent page visits the colors are all black.