diff options
| author | Randy Morgan <[email protected]> | 2012-04-25 20:29:01 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-04-25 20:29:01 +0900 |
| commit | 0259e86b9d740784825232b4c234f795c21445c0 (patch) | |
| tree | 00a5f9db8e9bb2ceb7f5a6181a135703d169fbb1 | |
| parent | 4ef79992dd7faa2c0687c89f725ab0d85fced862 (diff) | |
| download | caxlsx-0259e86b9d740784825232b4c234f795c21445c0.tar.gz caxlsx-0259e86b9d740784825232b4c234f795c21445c0.zip | |
update examples to show date time formatting and axis label rotation for charts
| -rw-r--r-- | examples/example.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/example.rb b/examples/example.rb index 5b75b69e..b1338360 100644 --- a/examples/example.rb +++ b/examples/example.rb @@ -146,7 +146,9 @@ end wb.add_worksheet(:name => "Automatic cell types") do |sheet| sheet.add_row ["Date", "Time", "String", "Boolean", "Float", "Integer"] - sheet.add_row [Date.today, Time.now, "value", true, 0.1, 1] + date_format = wb.styles.add_style :format_code => 'YYYY-MMM-DD' + time_format = wb.styles.add_style :format_code => 'HH:MM:SS' + sheet.add_row [Date.today, Time.now, "value", true, 0.1, 1], :style => [date_format, time_format, nil, nil, nil, nil] end ##Merging Cells. @@ -170,6 +172,8 @@ wb.add_worksheet(:name => "Bar Chart") do |sheet| sheet.add_row [1, 2, 3] sheet.add_chart(Axlsx::Bar3DChart, :start_at => "A4", :end_at => "F17") do |chart| chart.add_series :data => sheet["A3:C3"], :labels => sheet["A2:C2"], :title => sheet["A1"] + chart.valAxis.label_rotation = -45 + chart.catAxis.label_rotation = 45 end end |
