0
분산 형 상위 차트 그래프에 데이터를 표시하는 데 문제가 있습니다. 속도를 x 축으로 전달하려고 시도하고 y를 설정했습니다. f.series에서 변수를 제거하고 place data => [[3,120]]이면 작동하지만 변수가 빈 그래프를 표시합니다.LazyHighcharts 분산 형 그래프 문제
@planter_speed = PlanterSpeed.find(params[:id])
@data = CSV.open(@planter_speed.file.path, :headers => false,
:encoding => 'ISO-8859-1')
speed = []
established = []
@data.each do |row|
speed << row[0]
established << row[1].to_i
end
@graph = LazyHighCharts::HighChart.new('graph') do |f|
f.chart(:height => '300')
f.xAxis(:title => {:text => 'Speed km/hr',
:margin => 20, style: { color: '#333'}}, :min => 0, :max => 16)
f.yAxis [min: 0, max: 120]
f.series(:type => 'scatter', :name =>
'% Established over planted',
data: [[speed, established]], :color => '#00463f')
f.plotOptions({line: {enableMouseTracking: false}})
f.legend({:align => 'center', :verticalAlign=> 'top',
:y => 0, :borderWidth => 0, style: {color: "#333"}})
end
큰 감사 Steakchaser 대신 건물 속도와 별도의 배열로 설립, 배열의 배열을합니다. 속도 결과도 표시하려면 [0] .to_i 행을 만들어야했습니다. – DollarChills