레일이있는 암 차트 - 데이터 피드를 잡지 않습니다
-
19-09-2019 - |
문제
나는 현재 팔로우하고있다 : http://railsontherun.com/2007/10/04/sexy-charts-in-less-than-5-minutes/
나는 그것을 아주 쉽게 통과했지만 차트를 사용하여 페이지를 볼 때 오류가있는 검은 사각형을 (플래시로)로드합니다.
"오류로드 파일 http : // localhost : 3000/reports/ouscal.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는 정의되지 않습니다. 일단 그들이 모든 것이 작동합니다.
제휴하지 않습니다 StackOverflow