我目前正在关注: http://railsontherun.com/2007/10/04/sexy-charts-in-less-than-5-minutes/

我很容易地仔细阅读,但是当使用图表查看页面时,它会加载(以闪光为单位)带有错误的黑色矩形:

“错误加载文件 http:// localhost:3000/Reports/pessup.xml"

评论中的某人说,这可能与XML构建器文件中的代码有关。

  xml.instruct!  :xml, :version=>"1.0", :encoding=>"UTF-8"
  xml.chart do
    # xml.message "You can broadcast any message to chart from data XML file", :bg_color => "#FFFFFF", :text_color => "#000000"
    xml.series do    
      @cities.each_with_index do |city, index|
        xml.value city.name,  :xid => index
      end
    end

    xml.graphs do
     #the gid is used in the settings file to set different settings just for this graph
      xml.graph :gid => 'population' do
        @cities.each_with_index do |city, index|
          population = city.population
          case population
            # When the population is > 1 million, show the bar in red/pink
            when > 100000
              xml.value value,  :xid => index, :color => "#ff43a8", :gradient_fill_colors => "#960040,#ff43a8", :description => level
            else
              xml.value value,  :xid => index, :color => "#00C3C6", :gradient_fill_colors => "#009c9d,#00C3C6", :description => level
            end
        end
      end
    end

  end

我不确定错误的来源,但我希望有任何帮助!

最好,艾略特

有帮助吗?

解决方案

我发现了这个

          xml.value value,  :xid => index, :color => "#00C3C6", :gradient_fill_colors => "#009c9d,#00C3C6", :description => level

在该行中,未定义第二个“值”和“级别” var。一旦它们都起作用。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top