def spider_graph_report(building)
#参考に
#https://d.conma.me/entry/20081011/1223736412
stroke_axis
#平均点をハッシュで返す
@score = building.parts.group(:part_type).average(:score)
g = Gruff::Spider.new(7, '535x400')
# タイトル
#g.title = '部位ごとの点数'
# 使うフォント
#g.font = File.expand_path('artwork/fonts/meiryo.ttc', RAILS_ROOT)
g.font = "vendor/fonts/ipaexg.ttf"
# グラフの目盛りの最大値
g.maximum_value = 6.0
# グラフの目盛りの最小値
g.minimum_value = 0
g.no_data_message = 'データがありません'
@score.each do |key ,value|
value = value.to_f
g.data "#{key}", [value]
end
g.data "壁10", [5.5]
g.data "壁10", [6.5]
g.data "壁10", [5.5]
g.data "壁10", [4.5]
# g.theme = {
# :colors => ['black', 'grey'],
# :marker_color => 'grey',
# :font_color => 'black',
# :background_colors => 'transparent'
# }
#g.theme_rails_keynote
g.theme_keynote
# g.theme_37signals
# g.theme_greyscale
# g.theme_keynote
# g.theme_odeo
# g.theme_pastel
#g.theme_rails_keynote
g.bottom_margin = 80
g.top_margin = 60
#g.title_font_size = 70
g.legend_font_size = 35
# marker_font_size
# title_font_size グラフのタイトルのフォントサイズ
# legend_font_size 凡例のフォントサイズ
# legend_box_size 凡例のサイズ
#ファイルとして置く
#g.write(filename=File.expand_path('graphs/status.png', RAILS_ROOT))
# うまくいかなかったらこっちで
# #g.write("tankyou#{g.object_id}.png")
# #image "tankyou#{g.object_id}.png"
# 画像の表示
#graphsフォルダ配下に画像を保存
g.write(filename=File.expand_path("graphs/#{g.object_id}.png"))
image "graphs/#{g.object_id}.png"
end