:D 用gruff生成图表的时候,如何设置图形背景,我想用自己选定的图片来做背景,知道的前辈告诉下! :arrow:
设定 data 之前,先设定 theme
例如
[code="ruby"]
g = Gruff.line.new
g.theme = {
:colors => %w(orange purple green white red),
:marker_color => 'blue',
:background_colors => %w(black grey),
:background_image => 'squirrel.png' # 设定背景图片路径,800 x 600 = 100% ?
}
... # 其它事情
[/code]
参考 rdoc 和源代码。