summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2013-04-19 23:34:50 +0900
committerRandy Morgan <[email protected]>2013-04-19 23:34:50 +0900
commit08f04d573d00e91bb92d4d727f56d4bb21259eb0 (patch)
tree6cc96940c4529af386ce7d811ccd9943c705be30
parentdb18c28df9fe5c44404e5f9af70a3db14a4b1f9a (diff)
downloadcaxlsx-08f04d573d00e91bb92d4d727f56d4bb21259eb0.tar.gz
caxlsx-08f04d573d00e91bb92d4d727f56d4bb21259eb0.zip
Added prep for 1.3.6 release
-rw-r--r--CHANGELOG.md10
-rw-r--r--README.md39
-rw-r--r--axlsx.gemspec1
-rw-r--r--lib/axlsx/drawing/axes.rb19
-rw-r--r--lib/axlsx/drawing/axis.rb6
-rw-r--r--lib/axlsx/drawing/bar_3D_chart.rb3
-rw-r--r--lib/axlsx/drawing/line_chart.rb7
-rw-r--r--lib/axlsx/drawing/scatter_chart.rb3
-rw-r--r--lib/axlsx/util/serialized_attributes.rb1
-rw-r--r--lib/axlsx/version.rb2
-rw-r--r--test/drawing/tc_line_series.rb10
-rw-r--r--test/tc_helper.rb1
-rw-r--r--test/util/tc_validators.rb6
13 files changed, 83 insertions, 25 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a1e392ff..6fabb87e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,13 @@
CHANGELOG
---------
-
+- **November.5.12**:1.3.2
+ - MASSIVE REFACTORING
+ - Patch for apostrophes in worksheet names
+ - added sheet_by_name for workbook so you can now find your worksheets
+ by name
+ - added insert_worksheet so you can now add a worksheet to an
+ arbitrary position in the worksheets list.
+ - reduced memory consumption for package parts post serialization
- **September.30.12**: 1.3.1
- Improved control character handling
- Added stored auto filter values and date grouping items
@@ -221,3 +228,4 @@ in value caches
- Updated documentation
##October.20.11: 0.1.0 release
+
diff --git a/README.md b/README.md
index d80dd997..23c110cf 100644
--- a/README.md
+++ b/README.md
@@ -17,28 +17,30 @@ appreciation for the gem, please don't hesitate to make a donation.
**Author**: Randy Morgan
-**Copyright**: 2011 - 2012
+**Copyright**: 2011 - 2013
**License**: MIT License
-**Latest Version**: 1.3.5
+**Latest Version**: 1.3.6
-**Ruby Version**: 1.8.7, 1.9.2, 1.9.3
+**Ruby Version**: 1.8.7 (soon to be depreciated!!!), 1.9.2, 1.9.3, 2.0.0
**JRuby Version**: 1.6.7 1.8 and 1.9 modes
**Rubinius Version**: rubinius 2.0.0dev * lower versions may run, this gem always tests against head.
-**Release Date**: February 4th 2013
+**Release Date**: April 19th 2013
If you are working in rails, or with active record see:
-* http://github.com/randym/acts_as_xlsx
+[acts_as_xlsx](http://github.com/randym/acts_as_xlsx)
+
acts_as_xlsx is a simple ActiveRecord mixin that lets you generate a workbook with:
```ruby
Posts.where(created_at > Time.now-30.days).to_xlsx
```
+
** and **
* http://github.com/straydogstudio/axlsx_rails
@@ -47,6 +49,12 @@ Axlsx_Rails provides an Axlsx renderer so you can move all your spreadsheet code
There are guides for using axlsx and acts_as_xlsx here:
[http://axlsx.blog.randym.net](http://axlsx.blog.randym.net)
+If you are working with ActiveAdmin see:
+
+[activeadmin_axlsx](http://github.com/randym/activeadmin_axlsx)
+
+It provies a plugin and dsl for generating downloadable reports.
+
The examples directory contains a number of more specific examples as
well.
@@ -152,6 +160,13 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem,
#Change log
---------
+- **April.19.13**:1.3.6
+ - Fixed LibreOffice/OpenOffice issue to properly apply colors to lines
+ in charts.
+ - Added support for specifying between/notBetween formula in an array.
+ *thanks* straydogstudio!
+ - Added standard line chart support. *thanks* scambra
+ - Fixed straydogstudio's link in the README. *thanks* nogara!
- **February.4.13**:1.3.5
- converted vary_colors for chart data to instance variable with appropriate defulats for the various charts.
- Added trust_input method on Axlsx to instruct the serializer to skip HTML escaping. This will give you a tremendous performance boost,
@@ -172,14 +187,6 @@ This gem has 100% test coverage using test/unit. To execute tests for this gem,
- Improvements in autowidth calculation.
- **November.8.12**:1.3.3
- Patched cell run styles for u and validation for family
-- **November.5.12**:1.3.2
- - MASSIVE REFACTORING
- - Patch for apostrophes in worksheet names
- - added sheet_by_name for workbook so you can now find your worksheets
- by name
- - added insert_worksheet so you can now add a worksheet to an
- arbitrary position in the worksheets list.
- - reduced memory consumption for package parts post serialization
Please see the {file:CHANGELOG.md} document for past release information.
@@ -262,11 +269,13 @@ air and our feet on the ground.
[ball-hayden](https://github.com/ball-hayden) - For making sure we only get the right characters in our sheet names.
-[nibus](https://github.com/nibus) - For patching sheet name unequeness.
+[nibus](https://github.com/nibus) - For patching sheet name uniqueness.
+
+[scambra](https://github.com/scambra) - for keeping our lines in line!
#Copyright and License
----------
-Axlsx &copy; 2011-2012 by [Randy Morgan](mailto:[email protected]).
+Axlsx &copy; 2011-2013 by [Randy Morgan](mailto:[email protected]).
Axlsx is licensed under the MIT license. Please see the LICENSE document for more information.
diff --git a/axlsx.gemspec b/axlsx.gemspec
index 511b1c16..bc31c821 100644
--- a/axlsx.gemspec
+++ b/axlsx.gemspec
@@ -20,7 +20,6 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'rubyzip', '>= 0.9.5'
s.add_runtime_dependency "htmlentities", "~> 4.3.1"
-# This has been removed until JRuby can support the native extensions for redcarpet or yard removes the dependency
s.add_development_dependency 'yard'
s.add_development_dependency 'kramdown'
s.add_development_dependency 'simplecov'
diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb
index 99565cb6..c3a8dd85 100644
--- a/lib/axlsx/drawing/axes.rb
+++ b/lib/axlsx/drawing/axes.rb
@@ -1,17 +1,31 @@
module Axlsx
-
+
+ # The Axes class creates and manages axis information and
+ # serialization for charts.
class Axes
+ # @param [Hash] options options used to generate axis each key
+ # should be an axis name like :val_axix and its value should be the
+ # class of the axis type to construct.
def initialize(options={})
options.each do |name, axis_class|
add_axis(name, axis_class)
end
end
+ # [] provides assiciative access to a specic axis store in an axes
+ # instance.
+ # @return [Axis]
def [](name)
axes.assoc(name)[1]
end
+ # Serializes the object
+ # @param [String] str
+ # @param [Hash] options
+ # @option options ids
+ # If the ids option is specified only the axis identifier is
+ # serialized. Otherwise, each axis is serialized in full.
def to_xml_string(str = '', options = {})
if options[:ids]
axes.inject(str) { |string, axis| string << '<c:axId val="' << axis[1].id.to_s << '"/>' }
@@ -20,6 +34,9 @@ module Axlsx
end
end
+ # Adds an axis to the collection
+ # @param [Symbol] name The name of the axis
+ # @param [Axis] axis_class The axis class to generate
def add_axis(name, axis_class)
axis = axis_class.new
set_cross_axis(axis)
diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb
index 16c087a2..32e40373 100644
--- a/lib/axlsx/drawing/axis.rb
+++ b/lib/axlsx/drawing/axis.rb
@@ -7,7 +7,7 @@ module Axlsx
include Axlsx::OptionsParser
# Creates an Axis object
- # @param [Integer] cross_axis the perpendicular axis
+ # @option options [Axis] cross_axis the perpendicular axis
# @option options [Symbol] ax_pos
# @option options [Symbol] crosses
# @option options [Symbol] tick_lbl_pos
@@ -90,7 +90,9 @@ module Axlsx
def color=(color_rgb)
@color = color_rgb
end
-
+
+ # The crossing axis for this axis
+ # @param [Axis] axis
def cross_axis=(axis)
DataTypeValidator.validate "#{self.class}.cross_axis", [Axis], axis
@cross_axis = axis
diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb
index 0e2b37bb..3315ad80 100644
--- a/lib/axlsx/drawing/bar_3D_chart.rb
+++ b/lib/axlsx/drawing/bar_3D_chart.rb
@@ -141,6 +141,9 @@ module Axlsx
end
end
+ # A hash of axes used by this chart. Bar charts have a value and
+ # category axes specified via axex[:val_axes] and axes[:cat_axis]
+ # @return [Axes]
def axes
@axes ||= Axes.new(:val_axis => ValAxis, :cat_axis => CatAxis)
end
diff --git a/lib/axlsx/drawing/line_chart.rb b/lib/axlsx/drawing/line_chart.rb
index afe6154e..699050dc 100644
--- a/lib/axlsx/drawing/line_chart.rb
+++ b/lib/axlsx/drawing/line_chart.rb
@@ -59,6 +59,10 @@ module Axlsx
@grouping = v
end
+ # The node name to use in serialization. As LineChart is used as the
+ # base class for Liine3DChart we need to be sure to serialize the
+ # chart based on the actual class type and not a fixed node name.
+ # @return [String]
def node_name
path = self.class.to_s
if i = path.rindex('::')
@@ -85,6 +89,9 @@ module Axlsx
end
end
+ # The axes for this chart. LineCharts have a category and value
+ # axis.
+ # @return [Axes]
def axes
@axes ||= Axes.new(:cat_axis => CatAxis, :val_axis => ValAxis)
end
diff --git a/lib/axlsx/drawing/scatter_chart.rb b/lib/axlsx/drawing/scatter_chart.rb
index f069e346..526bd6d5 100644
--- a/lib/axlsx/drawing/scatter_chart.rb
+++ b/lib/axlsx/drawing/scatter_chart.rb
@@ -64,6 +64,9 @@ module Axlsx
str
end
+ # The axes for the scatter chart. ScatterChart has an x_val_axis and
+ # a y_val_axis
+ # @return [Axes]
def axes
@axes ||= Axes.new(:x_val_axis => ValAxis, :y_val_axis => ValAxis)
end
diff --git a/lib/axlsx/util/serialized_attributes.rb b/lib/axlsx/util/serialized_attributes.rb
index 5519f843..e421984b 100644
--- a/lib/axlsx/util/serialized_attributes.rb
+++ b/lib/axlsx/util/serialized_attributes.rb
@@ -59,7 +59,6 @@ module Axlsx
# break the xml and 1.8.7 does not support ordered hashes.
# @param [String] str The string instance to which serialized data is appended
# @param [Array] additional_attributes An array of additional attribute names.
- # @param [Proc] block A which will be called with the value for each element.
# @return [String] The serialized output.
def serialized_element_attributes(str='', additional_attributes=[], &block)
attrs = self.class.xml_element_attributes + additional_attributes
diff --git a/lib/axlsx/version.rb b/lib/axlsx/version.rb
index 6b0df7df..546f601d 100644
--- a/lib/axlsx/version.rb
+++ b/lib/axlsx/version.rb
@@ -1,5 +1,5 @@
module Axlsx
# The current version
- VERSION = "1.3.5"
+ VERSION = "1.3.6"
end
diff --git a/test/drawing/tc_line_series.rb b/test/drawing/tc_line_series.rb
index cc62005b..866553c3 100644
--- a/test/drawing/tc_line_series.rb
+++ b/test/drawing/tc_line_series.rb
@@ -6,7 +6,7 @@ class TestLineSeries < Test::Unit::TestCase
p = Axlsx::Package.new
@ws = p.workbook.add_worksheet :name=>"hmmm"
chart = @ws.add_chart Axlsx::Line3DChart, :title => "fishery"
- @series = chart.add_series :data=>[0,1,2], :labels=>["zero", "one", "two"], :title=>"bob", :color => "#FF0000"
+ @series = chart.add_series :data=>[0,1,2], :labels=>["zero", "one", "two"], :title=>"bob", :color => "#FF0000", :show_marker => true
end
def test_initialize
@@ -15,10 +15,16 @@ class TestLineSeries < Test::Unit::TestCase
assert_equal(@series.data.class, Axlsx::NumDataSource)
end
-
+
+ def test_show_marker
+ assert_equal(true, @series.show_marker)
+ @series.show_marker = false
+ assert_equal(false, @series.show_marker)
+ end
def test_to_xml_string
doc = Nokogiri::XML(@series.to_xml_string)
assert(doc.xpath("//srgbClr[@val='#{@series.color}']"))
+ assert(doc.xpath("//marker"))
end
#TODO serialization testing
end
diff --git a/test/tc_helper.rb b/test/tc_helper.rb
index 34f7f22d..08dec0b3 100644
--- a/test/tc_helper.rb
+++ b/test/tc_helper.rb
@@ -2,6 +2,7 @@ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"
require 'simplecov'
SimpleCov.start do
add_filter "/test/"
+ add_filter "/vendor/"
end
require 'test/unit'
diff --git a/test/util/tc_validators.rb b/test/util/tc_validators.rb
index de896f3d..b4c9248d 100644
--- a/test/util/tc_validators.rb
+++ b/test/util/tc_validators.rb
@@ -158,7 +158,11 @@ class TestValidators < Test::Unit::TestCase
assert_raise(ArgumentError) { Axlsx.validate_split_state_type 'frozen_split' }
assert_raise(ArgumentError) { Axlsx.validate_split_state_type 0 }
end
-
+
+ def test_validate_integerish
+ assert_raise(ArgumentError) { Axlsx.validate_integerish :foo }
+ [1, 1.4, "a"].each { |test_value| assert_nothing_raised { Axlsx.validate_integerish test_value } }
+ end
def test_validate_family
assert_raise(ArgumentError) { Axlsx.validate_family 0 }
(1..5).each do |item|