我在rails 4上使用Axlsx gem来绘制带有标记样式的散点图。这是我的代码:
wb.add_worksheet(:name => "Scatter Chart") do |sheet|
sheet.add_row ["First", 1, 5, 7, 9]
sheet.add_row ["", 1, 25, 49, 81]
sheet.add_row ["Second", 5, 2, 14, 9]
sheet.add_row ["", 5, 10, 15, 20]
sheet.add_chart(Axlsx::ScatterChart, :title => "example 7: Scatter Chart") do |chart|
chart.scatterStyle = :marker
chart.start_at 0, 4
chart.end_at 10, 19
chart.add_series :xData => sheet["B1:E1"], :yData => sheet["B2:E2"], :title => sheet["A1"]
chart.add_series :xData => sheet["B3:E3"], :yData => sheet["B4:E4"], :title => sheet["A3"]
puts chart.scatter_style
end
end
即使我将 scatterStyle 更改为 :marker,图表仍然是 lineMarker 样式。我尝试了所有其他可能的样式,但它似乎不适合我。当我打印chart.scatterStyle 时,它给了我“标记”,这意味着样式已更改,但我看到的又是lineMarker 样式。还有什么我应该做的吗?