Sha256: 3aba63571798607a83806d6fe2af94528d2dda9fc592a0e629e42e165c9685cb
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
#!/usr/bin/env ruby -w -s # -*- coding: utf-8 -*- $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib" require 'axlsx' p = Axlsx::Package.new percent = p.workbook.styles.add_style :format_code => "#0.00" p.workbook.add_worksheet(:name => 'Pareto') do |ws| ws.add_row ['Pareto Chart Example'] ws.add_row ['Print Failure Analysis'] ws.add_row ['Problem', 'Count', 'Percent Of Total', 'Cum. Percent'] ws.add_row ['Out of Paper', '32', '=B4/sum(B4:B7)*100', '=C4'], :style => [nil, nil, percent, percent] ws.add_row ['Out of Toner', '12', '=B5/sum(B4:B7)*100', '=D4+C5'], :style => [nil, nil, percent, percent] ws.add_row ['Paper Jam', '72', '=B6/sum(B4:B7)*100', '=D5+C6'], :style => [nil, nil, percent, percent] ws.add_row ['Firmware failure', '77', '=B7/sum(B4:B7)*100', '=D6+C7'], :style => [nil, nil, percent, percent] ws.add_chart(Axlsx::Bar3DChart, :grouping => :clustered, :barDir => :col) do |chart| chart.add_series(:data => ws['B4:B7'], :title => 'count') chart.add_series(:data => ws['C4:C7'], :title => 'PoT') chart.add_series(:data => ws['D4:D7'], :title => 'CP') end end p.serialize 'pareto.xlsx'
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
axlsx-1.1.7 | examples/pareto.rb |
axlsx-1.1.6 | examples/pareto.rb |