2010-03-13 75 views
0

我正在以下:http://railsontherun.com/2007/10/04/sexy-charts-in-less-than-5-minutes/amcharts与轨道 - 不敛数据反馈

我经历过这一切进展相当容易,但随后与图表查看网页时,它加载(闪光灯)一个黑色的矩形错误:

“错误加载文件http://localhost:3000/reports/population.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 

我不完全确定错误来自哪里,但我很乐意提供任何帮助!

最佳, 埃利奥特

回答

0

我在该行想通了这一点

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

,第二个 “值” 和 “级别” VAR没有定义。一旦它们全部起作用。