summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-05-13 15:14:18 +0900
committerRandy Morgan <[email protected]>2012-05-13 15:14:18 +0900
commit3bc61a665d3aee3d60887a0c224e79d9a4f69efe (patch)
tree9a4d926482642ad65f7e81be77f22092790202ff /examples
parent373bae8d267549fb10b670e1fba4bdcd4bcc4167 (diff)
downloadcaxlsx-3bc61a665d3aee3d60887a0c224e79d9a4f69efe.tar.gz
caxlsx-3bc61a665d3aee3d60887a0c224e79d9a4f69efe.zip
updated examples
Diffstat (limited to 'examples')
-rw-r--r--examples/comment.rb15
-rw-r--r--examples/extractive.rb3
2 files changed, 3 insertions, 15 deletions
diff --git a/examples/comment.rb b/examples/comment.rb
deleted file mode 100644
index 19e55234..00000000
--- a/examples/comment.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env ruby -w -s
-# -*- coding: utf-8 -*-
-$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
-require 'axlsx'
-
-p = Axlsx::Package.new
-wb = p.workbook
-
-wb.add_worksheet(:name=>'look mom, comments') do |ws|
- ws.add_row [1,2,3]
- ws.add_comment :text => "now that is just sexy", :author => "randym", :ref => "A1"
-end
-
-p.validate.each { |e| puts e.message }
-p.serialize 'comments.xlsx'
diff --git a/examples/extractive.rb b/examples/extractive.rb
index 433b95e2..d8b57084 100644
--- a/examples/extractive.rb
+++ b/examples/extractive.rb
@@ -13,6 +13,7 @@ data = [ ['oil-bbl',9591.411671,8860.714604,8237.936509,7700.523067,7231.831842,
p = Axlsx::Package.new
wb = p.workbook
wb.add_worksheet(:name => 'volumes') do |ws|
+
# perspective, rotX and rotY flatten the 3D chart
# hPercent sets the chart height to 100%
chart = ws.add_chart(Axlsx::Line3DChart, :perspective => 0, :hPercent => 100, :rotX => 0, :rotY => 0, :start_at => "A4", :end_at => 'M44', :title => 'Monthly forcast for Type Curve Gas secondary - gross ngl')
@@ -27,12 +28,14 @@ wb.add_worksheet(:name => 'volumes') do |ws|
# Knock the catAxis labels down to the forced min.
chart.catAxis.crosses = :min
+
# set up cat labels / markes to show every 12th item
chart.catAxis.tickLblSkip = 12
chart.catAxis.tickMarkSkip = 12
#rgb colors for our data series
colors = ['00FF00', 'FF0000', '0000FF']
+
data.each_with_index do |value, index|
ws.add_row value
chart.add_series :data => ws.rows.last.cells[(1..value.size-1)], :labels => (0..value.size).map{ |i| i }, :title => ws.rows.last.cells.first, :color => colors[index]