Skip to content

Instantly share code, notes, and snippets.

@manusajith
Created March 16, 2013 16:46
Show Gist options
  • Save manusajith/5177246 to your computer and use it in GitHub Desktop.
Save manusajith/5177246 to your computer and use it in GitHub Desktop.

Revisions

  1. manusajith created this gist Mar 16, 2013.
    11 changes: 11 additions & 0 deletions axlsx_bar_graph.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    require 'axlsx'
    Axlsx::Package.new do |p|
    p.workbook.add_worksheet(:name => "Pie Chart") do |sheet|
    sheet.add_row ["Simple Pie Chart"]
    %w(first second third).each { |label| sheet.add_row [label, rand(24)+1] }
    sheet.add_chart(Axlsx::Bar3DChart, :start_at => "A6", :end_at => "F20", :barDir => :col) do |chart|
    chart.add_series :data => sheet["B2:B4"], :labels => sheet["A2:A4"], :colors => ['FF0000', '00FF00', '0000FF']
    end
    end
    p.serialize('simple.xlsx')
    end