0

私は現在フォローしています:http://railsontherun.com/2007/10/04/sexy-charts-in-less-than-5-minutes/

私はそれをすべて非常に簡単に調べましたが、チャートを含むページを表示すると、エラーのある黒い長方形が(フラッシュで)読み込まれます。

「ファイル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

エラーがどこから来ているのか正確にはわかりませんが、助けが必要です!

最高、エリオット

4

1 に答える 1

0

私はこれを理解しました

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

その行では、2番目の「値」と「レベル」変数は定義されていません。それらがすべて機能するようになります。

于 2010-03-13T19:34:12.997 に答える