2015-10-15 35 views
0

我無法在邪惡的pdf中生成LazyHighCharts。wicked pdf不顯示LazyHighCharts

控制器:

class GeneratepdfsController < ApplicationController 
layout false 

    def index 
     @test = "hey" 
     @bar = LazyHighCharts::HighChart.new('column') do |f| 
     f.series(:name=>'John',:data=> [3, 20, 3, 5, 4, 10, 12 ]) 
     f.series(:name=>'Jane',:data=>[1, 3, 4, 3, 3, 5, 4,-46])  
     f.title({ :text=>"example test title from controller"}) 

     ## or options for column 
     f.options[:chart][:defaultSeriesType] = "column" 
     f.plot_options({:column=>{:stacking=>"percent"}}) 

     render :pdf => "file.pdf", :template =>'generatepdfs/index.html.erb' 
    end 
end 

觀點:index.html.erb

<%= high_chart("my_bar_div", @bar) %> 
<p><%= @test %></p> 

結果:字符串 「哎」 出現在PDF但圖表沒有出現,我不知道爲什麼。

回答

0

嘗試設置animationsfalse如圖here

$('#chart-container').highcharts({ 
    chart: { 
    animation:false, 
    // other options and stuff 

您的圖表可以在啓動之前(和成品)動畫可以被渲染。