Эмчарты с рельсами - не схватывание подачи данных

StackOverflow https://stackoverflow.com/questions/2439577

  •  19-09-2019
  •  | 
  •  

Вопрос

Я сейчас следую: http://railsontherun.com/2007/10/04/sexy-charts-in-sless-tan-5-minutes/

Я прошел через все это довольно легко, но затем при просмотре страницы с помощью диаграммы он загружает (во вспышке) черный прямоугольник с ошибкой:

"Ошибка загрузки файла http: // localhost: 3000/reports/opul.xml"

Кто -то в комментариях сказал, что это может быть связано с кодом в файле xml Builder.

  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