邪恶的pdf并没有显示LazyHighCharts

时间:2015-10-15 16:40:10

标签: ruby-on-rails wicked-pdf lazy-high-charts

我无法用邪恶的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

view:index.html.erb

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

结果:字符串&#34;嘿&#34;以PDF格式显示,但图表不会出现,我也不知道为什么。

1 个答案:

答案 0 :(得分:0)

尝试将animations设置为false,如图所示here

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

您的图表可能在开始(并完成)动画之前呈现。