From 3bc61a665d3aee3d60887a0c224e79d9a4f69efe Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sun, 13 May 2012 15:14:18 +0900 Subject: updated examples --- examples/comment.rb | 15 --------------- examples/extractive.rb | 3 +++ 2 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 examples/comment.rb 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] -- cgit v1.2.3