diff options
| author | Randy Morgan <[email protected]> | 2012-11-16 08:36:56 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-11-16 08:36:56 +0900 |
| commit | bffe05e5f218376843d0932e63f2e9f3db81d05a (patch) | |
| tree | 227d170e724caf0005cbbe275aa2df4a41d64b47 /examples/example.rb | |
| parent | 3ead1acc36dc8c7a1fe8834972931b6213e6d140 (diff) | |
| download | caxlsx-bffe05e5f218376843d0932e63f2e9f3db81d05a.tar.gz caxlsx-bffe05e5f218376843d0932e63f2e9f3db81d05a.zip | |
Added sensible defaults for color scale
You can now use Axlsx::ColorScale.three_tone or
Axlsx::ColorScale.two_tone to create pretty conditional formatting.
Diffstat (limited to 'examples/example.rb')
| -rwxr-xr-x | examples/example.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/example.rb b/examples/example.rb index dc56b882..87678a2e 100755 --- a/examples/example.rb +++ b/examples/example.rb @@ -23,7 +23,7 @@ examples = [] #examples << :data_types #examples << :hyperlinks #examples << :number_currency_format -examples << :venezuela_currency +#examples << :venezuela_currency #examples << :bar_chart #examples << :chart_gridlines #examples << :pie_chart @@ -37,7 +37,7 @@ examples << :venezuela_currency #examples << :printing #examples << :comments #examples << :panes -#examples << :conditional_formatting +examples << :conditional_formatting #examples << :streaming #examples << :shared_strings #examples << :no_autowidth @@ -604,8 +604,10 @@ if examples.include? :conditional_formatting offset.upto(rows + offset) do |i| ws.add_row ["Q#{i}", 10000*((rows/2-i) * (rows/2-i)), "=100*B#{i}/SUM(B3:B#{rows+offset})"], :style=>[nil, money, percent] end - # Apply conditional formatting to range B3:B100 in the worksheet - color_scale = Axlsx::ColorScale.new + # color scale has two_tone and three_tone class methods to setup the excel defaults (2011) + # alternatively, you can pass in {:type => [:min, :max, :percent], :val => [whatever], :color =>[Some RGB String] to create a customized color scale object + + color_scale = Axlsx::ColorScale.three_tone ws.add_conditional_formatting("B3:B100", { :type => :colorScale, :operator => :greaterThan, :formula => "100000", :dxfId => profitable, :priority => 1, :color_scale => color_scale }) end |
