caxlsx 4.1.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -12
- data/README.md +7 -1
- data/Rakefile +2 -9
- data/lib/axlsx/content_type/abstract_content_type.rb +2 -2
- data/lib/axlsx/content_type/content_type.rb +3 -3
- data/lib/axlsx/drawing/area_chart.rb +3 -3
- data/lib/axlsx/drawing/area_series.rb +2 -2
- data/lib/axlsx/drawing/ax_data_source.rb +1 -1
- data/lib/axlsx/drawing/axes.rb +1 -1
- data/lib/axlsx/drawing/axis.rb +1 -1
- data/lib/axlsx/drawing/bar_3D_chart.rb +14 -4
- data/lib/axlsx/drawing/bar_chart.rb +14 -4
- data/lib/axlsx/drawing/bar_series.rb +2 -2
- data/lib/axlsx/drawing/bubble_chart.rb +2 -2
- data/lib/axlsx/drawing/bubble_series.rb +2 -2
- data/lib/axlsx/drawing/cat_axis.rb +3 -3
- data/lib/axlsx/drawing/chart.rb +1 -0
- data/lib/axlsx/drawing/d_lbls.rb +5 -4
- data/lib/axlsx/drawing/drawing.rb +50 -50
- data/lib/axlsx/drawing/hyperlink.rb +1 -1
- data/lib/axlsx/drawing/line_3D_chart.rb +3 -3
- data/lib/axlsx/drawing/line_chart.rb +3 -3
- data/lib/axlsx/drawing/line_series.rb +2 -2
- data/lib/axlsx/drawing/num_val.rb +1 -1
- data/lib/axlsx/drawing/pic.rb +4 -4
- data/lib/axlsx/drawing/pie_3D_chart.rb +2 -2
- data/lib/axlsx/drawing/pie_chart.rb +2 -2
- data/lib/axlsx/drawing/pie_series.rb +2 -2
- data/lib/axlsx/drawing/scatter_chart.rb +2 -2
- data/lib/axlsx/drawing/scatter_series.rb +2 -2
- data/lib/axlsx/drawing/ser_axis.rb +3 -3
- data/lib/axlsx/drawing/two_cell_anchor.rb +1 -1
- data/lib/axlsx/drawing/val_axis.rb +2 -2
- data/lib/axlsx/drawing/vml_shape.rb +1 -1
- data/lib/axlsx/package.rb +10 -12
- data/lib/axlsx/rels/relationship.rb +2 -2
- data/lib/axlsx/rels/relationships.rb +2 -2
- data/lib/axlsx/stylesheet/border_pr.rb +2 -1
- data/lib/axlsx/stylesheet/cell_alignment.rb +1 -1
- data/lib/axlsx/stylesheet/cell_style.rb +1 -1
- data/lib/axlsx/stylesheet/color.rb +2 -2
- data/lib/axlsx/stylesheet/font.rb +1 -1
- data/lib/axlsx/stylesheet/gradient_fill.rb +1 -1
- data/lib/axlsx/stylesheet/pattern_fill.rb +1 -0
- data/lib/axlsx/stylesheet/styles.rb +27 -31
- data/lib/axlsx/stylesheet/xf.rb +2 -1
- data/lib/axlsx/util/accessors.rb +1 -1
- data/lib/axlsx/util/buffered_zip_output_stream.rb +2 -2
- data/lib/axlsx/util/constants.rb +2 -2
- data/lib/axlsx/util/serialized_attributes.rb +2 -2
- data/lib/axlsx/util/simple_typed_list.rb +26 -14
- data/lib/axlsx/util/storage.rb +3 -3
- data/lib/axlsx/util/validators.rb +2 -2
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/defined_name.rb +2 -1
- data/lib/axlsx/workbook/shared_strings_table.rb +3 -3
- data/lib/axlsx/workbook/workbook.rb +61 -61
- data/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +4 -4
- data/lib/axlsx/workbook/worksheet/auto_filter/filter_column.rb +1 -1
- data/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +4 -4
- data/lib/axlsx/workbook/worksheet/auto_filter/sort_condition.rb +1 -1
- data/lib/axlsx/workbook/worksheet/auto_filter/sort_state.rb +2 -2
- data/lib/axlsx/workbook/worksheet/border_creator.rb +4 -4
- data/lib/axlsx/workbook/worksheet/cell.rb +10 -10
- data/lib/axlsx/workbook/worksheet/cell_serializer.rb +1 -1
- data/lib/axlsx/workbook/worksheet/col.rb +23 -9
- data/lib/axlsx/workbook/worksheet/comment.rb +2 -2
- data/lib/axlsx/workbook/worksheet/comments.rb +1 -1
- data/lib/axlsx/workbook/worksheet/conditional_formatting.rb +1 -1
- data/lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb +1 -1
- data/lib/axlsx/workbook/worksheet/conditional_formattings.rb +2 -2
- data/lib/axlsx/workbook/worksheet/data_validation.rb +1 -1
- data/lib/axlsx/workbook/worksheet/data_validations.rb +2 -2
- data/lib/axlsx/workbook/worksheet/date_time_converter.rb +2 -2
- data/lib/axlsx/workbook/worksheet/dimension.rb +1 -1
- data/lib/axlsx/workbook/worksheet/header_footer.rb +1 -1
- data/lib/axlsx/workbook/worksheet/icon_set.rb +1 -1
- data/lib/axlsx/workbook/worksheet/outline_pr.rb +1 -1
- data/lib/axlsx/workbook/worksheet/page_setup.rb +2 -2
- data/lib/axlsx/workbook/worksheet/pane.rb +1 -0
- data/lib/axlsx/workbook/worksheet/pivot_table.rb +30 -6
- data/lib/axlsx/workbook/worksheet/print_options.rb +1 -0
- data/lib/axlsx/workbook/worksheet/rich_text_run.rb +1 -1
- data/lib/axlsx/workbook/worksheet/sheet_calc_pr.rb +1 -0
- data/lib/axlsx/workbook/worksheet/sheet_pr.rb +1 -1
- data/lib/axlsx/workbook/worksheet/table_style_info.rb +2 -1
- data/lib/axlsx/workbook/worksheet/worksheet.rb +10 -12
- data/lib/axlsx/workbook/worksheet/worksheet_comments.rb +4 -4
- data/lib/axlsx/workbook/worksheet/worksheet_drawing.rb +1 -1
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlink.rb +2 -1
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +1 -1
- data/lib/axlsx.rb +44 -30
- data/lib/caxlsx.rb +1 -1
- metadata +7 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0f9a2b86a38ca45670bc0e74443d58a8d56b89a5d3d4891641bf6168fbcba02
|
4
|
+
data.tar.gz: b8f16b2ae2e718fb07c763c4085da9acbc3982ab63bffcee3de5a9b5741e504c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2830801b587922e0e765d147e7eaa01d33527d82efc3950d4241889e828fabf814270c64d0f18c4dd91880eaa848cff3a7c4b7c3f4f38e1ba95ef004900208b
|
7
|
+
data.tar.gz: f08afe03aedf885c94f035b69302bcd55a024efe4801c056a9383b47b2f5052d7fb4259b74bda32e82ecb6d2ece041e89573a26c233330991467d66344fc7689
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,22 @@ CHANGELOG
|
|
2
2
|
---------
|
3
3
|
- **Unreleased**
|
4
4
|
|
5
|
+
|
6
|
+
- **August.16.25**: 4.3.0
|
7
|
+
- [PR #421](https://github.com/caxlsx/caxlsx/pull/421) Add Rubyzip >= 2.4 support
|
8
|
+
- [PR #448](https://github.com/caxlsx/caxlsx/pull/448) Fix Bar Chart: set axis position for Apple Numbers compatibility
|
9
|
+
- [PR #466](https://github.com/caxlsx/caxlsx/pull/466) Use RubyGem's trusted publishing
|
10
|
+
- [PR #467](https://github.com/caxlsx/caxlsx/pull/467) Add JRuby 10.0 to the CI
|
11
|
+
|
12
|
+
- **December.15.24**: 4.2.0
|
13
|
+
- [PR #359](https://github.com/caxlsx/caxlsx/pull/359) Add `PivotTable#grand_totals` option to remove grand totals row/col
|
14
|
+
- [PR #362](https://github.com/caxlsx/caxlsx/pull/362) Use widest width even if provided as fixed value
|
15
|
+
- [PR #398](https://github.com/caxlsx/caxlsx/pull/398) Add `Axlsx#uri_parser` method for RFC2396 compatibility
|
16
|
+
- [PR #390](https://github.com/caxlsx/caxlsx/pull/390) Change ISO_8601_REGEX to match how Excel handles ISO 8601 formats
|
17
|
+
- [PR #402](https://github.com/caxlsx/caxlsx/pull/402) Refactor `Axlsx::SimpleTypedList` to better match `Array` API
|
18
|
+
- [PR #409](https://github.com/caxlsx/caxlsx/pull/409) Prefer `require_relative` for internal requires
|
19
|
+
- Minor performance improvements ([PR #406](https://github.com/caxlsx/caxlsx/pull/406), [PR #407](https://github.com/caxlsx/caxlsx/pull/407), [PR #408](https://github.com/caxlsx/caxlsx/pull/408))
|
20
|
+
|
5
21
|
- **February.26.24**: 4.1.0
|
6
22
|
- [PR #316](https://github.com/caxlsx/caxlsx/pull/316) Prevent camelization of hyperlink locations
|
7
23
|
- [PR #312](https://github.com/caxlsx/caxlsx/pull/312) Added 2D/flat PieChart drawing
|
@@ -31,7 +47,7 @@ CHANGELOG
|
|
31
47
|
- [PR #186](https://github.com/caxlsx/caxlsx/pull/186) - `escape_formulas` should handle all [OWASP-designated formula prefixes](https://owasp.org/www-community/attacks/CSV_Injection).
|
32
48
|
- Fix bug when calling `worksheet.add_border("A1:B2", nil)`
|
33
49
|
- Change `BorderCreator#initialize` arguments handling
|
34
|
-
- Fix `add_border` to work with
|
50
|
+
- Fix `add_border` to work with singular cell refs
|
35
51
|
- [PR #196](https://github.com/caxlsx/caxlsx/pull/196) - Fix tab color reassignment
|
36
52
|
- Add support for remote image source in `Pic` using External Relationship (supported in Excel documents)
|
37
53
|
|
@@ -165,7 +181,7 @@ CHANGELOG
|
|
165
181
|
and charts to the same worksheet drawing.
|
166
182
|
- Added outline_level_rows and outline_level_columns to worksheet to simplify setting up outlining in the worksheet.
|
167
183
|
- Added support for pivot tables
|
168
|
-
- Added support for
|
184
|
+
- Added support for discrete border edge styles
|
169
185
|
- Improved validation of sheet names
|
170
186
|
- Added support for formula value caching so that iOS and OSX preview can show the proper values. See Cell.add_row and the formula_values option.
|
171
187
|
|
@@ -197,7 +213,7 @@ CHANGELOG
|
|
197
213
|
from the initial master.
|
198
214
|
|
199
215
|
- **September.8.12**: 1.2.3
|
200
|
-
- enhance exponential float/bigdecimal values rendering as strings
|
216
|
+
- enhance exponential float/bigdecimal values rendering as strings instead
|
201
217
|
of 'numbers' in excel.
|
202
218
|
- added support for :none option on chart axis labels
|
203
219
|
- added support for paper_size option on worksheet.page_setup
|
@@ -231,14 +247,14 @@ CHANGELOG
|
|
231
247
|
- added in interop requirements so that charts are properly exported
|
232
248
|
to PDF from Libra Office
|
233
249
|
- various readability improvements and work standardizing attribute
|
234
|
-
names to snake_case. Aliases are provided for backward
|
250
|
+
names to snake_case. Aliases are provided for backward compatibility
|
235
251
|
|
236
252
|
- **June.11.12**: 1.1.7
|
237
253
|
- fix chart rendering issue when label offset is specified as a
|
238
254
|
percentage in serialization and ensure that formula are not stored
|
239
255
|
in value caches
|
240
256
|
- fix bug that causes repair warnings when using a text only title reference.
|
241
|
-
- Add title property to axis so you can
|
257
|
+
- Add title property to axis so you can label the x/y/series axis for
|
242
258
|
charts.
|
243
259
|
- Add sheet views with panes
|
244
260
|
|
@@ -248,14 +264,14 @@ in value caches
|
|
248
264
|
- added support for two cell anchors for images
|
249
265
|
- test coverage now back up to 100%
|
250
266
|
- bugfix for merge cell sorting algorithm
|
251
|
-
- added fit_to method for page_setup to simplify managing
|
267
|
+
- added fit_to method for page_setup to simplify managing width/height
|
252
268
|
- added ph (phonetics) and s (style) attributes for row.
|
253
269
|
- resolved all warnings generating from this gem.
|
254
270
|
- improved comment relationship management for multiple comments
|
255
271
|
|
256
272
|
- **May.13.12**: 1.1.5
|
257
273
|
- MOAR print options! You can now specify paper size, orientation,
|
258
|
-
fit to width, page
|
274
|
+
fit to width, page margins and gridlines for printing.
|
259
275
|
- Support for adding comments to your worksheets
|
260
276
|
- bugfix for applying style to empty cells
|
261
277
|
- bugfix for parsing formula with multiple '='
|
@@ -330,7 +346,7 @@ in value caches
|
|
330
346
|
|
331
347
|
- **January.6.12**: 1.0.15
|
332
348
|
https://github.com/randym/axlsx/compare/1.0.14...1.0.15
|
333
|
-
- Bug fix add_style specified number formats must be
|
349
|
+
- Bug fix add_style specified number formats must be explicitly applied for libraOffice
|
334
350
|
- performance improvements from ochko when creating cells with options.
|
335
351
|
- Bug fix setting types=>[:n] when adding a row incorrectly determines the cell type to be string as the value is null during creation.
|
336
352
|
- Release in preparation for password protection merge
|
@@ -362,7 +378,7 @@ in value caches
|
|
362
378
|
- **October.30.11**: 1.0.10
|
363
379
|
- Updating gemspec to lower gem version requirements.
|
364
380
|
- Added row.style assignation for updating the cell style for an entire row
|
365
|
-
- Added col_style method to worksheet
|
381
|
+
- Added col_style method to worksheet update a the style for a column of cells
|
366
382
|
- Added cols for an easy reference to columns in a worksheet.
|
367
383
|
- prep for pre release of acts_as_xlsx gem
|
368
384
|
- added in travis.ci configuration and build status
|
@@ -377,14 +393,14 @@ in value caches
|
|
377
393
|
- Added support for images (jpg, gif, png) in worksheets.
|
378
394
|
|
379
395
|
- **October.23.11**: 1.0.7 released
|
380
|
-
- Added support for 3D options when creating a new chart. This lets you set the
|
396
|
+
- Added support for 3D options when creating a new chart. This lets you set the perspective, rotation and other 3D attributes when using worksheet.add_chart
|
381
397
|
- Updated serialization write test to verify write permissions and warn if it cannot run the test due to permission restrcitions.
|
382
398
|
- updated rake to include build, genoc and deploy tasks.
|
383
399
|
- rebuilt documentation.
|
384
400
|
- moved version constant to its own file
|
385
401
|
- fixed bug in SerAxis that was requiring tickLblSkip and tickMarkSkip to be boolean. Should be unsigned int.
|
386
402
|
- Review and improve docs
|
387
|
-
- rebuild of anchor positioning to remove some
|
403
|
+
- rebuild of anchor positioning to remove some spaghetti code. Chart now supports a start_at and end_at method that accept an arrar for col/row positioning. See example6 for an example. You can still pass :start_at and :end_at options to worksheet.add_chart.
|
388
404
|
- Refactored cat and val axis data to keep series serialization a bit more DRY
|
389
405
|
|
390
406
|
- **October.22.11**: 1.0.6
|
@@ -404,7 +420,7 @@ in value caches
|
|
404
420
|
- BugFix: shape attribute for bar chart is now properly serialized
|
405
421
|
- BugFix: date1904 property now properly set for charts
|
406
422
|
- Added style property to charts
|
407
|
-
- Removed serialization write test as it most commonly fails when run from the gem's
|
423
|
+
- Removed serialization write test as it most commonly fails when run from the gem's installed directory
|
408
424
|
|
409
425
|
- **October.21.11**: 1.0.4
|
410
426
|
- altered package to accept a filename string for serialization instead of a File object.
|
data/README.md
CHANGED
@@ -107,7 +107,13 @@ Additional documentation is listed below:
|
|
107
107
|
- [Style Reference](https://github.com/caxlsx/caxlsx/blob/master/docs/style_reference.md)
|
108
108
|
- [Header and Footer Codes](https://github.com/caxlsx/caxlsx/blob/master/docs/header_and_footer_codes.md)
|
109
109
|
|
110
|
-
|
110
|
+
You can run the documentation on your local by running the following:
|
111
|
+
```sh
|
112
|
+
gem install webrick
|
113
|
+
yard server
|
114
|
+
```
|
115
|
+
|
116
|
+
⚠ Please __do not create issues__ for questions regarding the usage of axlsx / caxlsx. Look through this README, the [examples folder](https://github.com/caxlsx/caxlsx/tree/master/examples), and the [FAQ](https://github.com/caxlsx/caxlsx/wiki/FAQ), and also check [questions tagged `axlsx` on Stack Overflow](https://stackoverflow.com/questions/tagged/axlsx).
|
111
117
|
|
112
118
|
Feel free to add your question (including an answer!) to the FAQ if you think it is of general interest.
|
113
119
|
|
data/Rakefile
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
|
5
|
-
task build: :gendoc do
|
6
|
-
system "gem build axlsx.gemspec"
|
7
|
-
end
|
3
|
+
require 'bundler'
|
4
|
+
Bundler::GemHelper.install_tasks
|
8
5
|
|
9
6
|
task :benchmark do
|
10
7
|
require File.expand_path("#{File.dirname(__FILE__)}/test/benchmark.rb")
|
@@ -23,8 +20,4 @@ Rake::TestTask.new do |t|
|
|
23
20
|
t.warning = true
|
24
21
|
end
|
25
22
|
|
26
|
-
task release: :build do
|
27
|
-
system "gem push caxlsx-#{Axlsx::VERSION}.gem"
|
28
|
-
end
|
29
|
-
|
30
23
|
task default: :test
|
@@ -24,11 +24,11 @@ module Axlsx
|
|
24
24
|
end
|
25
25
|
alias :ContentType= :content_type=
|
26
26
|
|
27
|
-
# Serialize the
|
27
|
+
# Serialize the content type to xml
|
28
28
|
def to_xml_string(node_name = '', str = +'')
|
29
29
|
str << '<' << node_name << ' '
|
30
30
|
Axlsx.instance_values_for(self).each_with_index do |key_value, index|
|
31
|
-
str << ' ' unless index
|
31
|
+
str << ' ' unless index == 0
|
32
32
|
str << Axlsx.camel(key_value.first) << '="' << key_value.last.to_s << '"'
|
33
33
|
end
|
34
34
|
str << '/>'
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Axlsx
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
require_relative 'abstract_content_type'
|
5
|
+
require_relative 'default'
|
6
|
+
require_relative 'override'
|
7
7
|
|
8
8
|
# ContentTypes used in the package. This is automatically managed by the package package.
|
9
9
|
class ContentType < SimpleTypedList
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Axlsx
|
4
|
-
# The AreaChart is a two
|
4
|
+
# The AreaChart is a two dimensional line chart (who would have guessed?) that you can add to your worksheet.
|
5
5
|
# @example Creating a chart
|
6
6
|
# # This example creates a line in a single sheet.
|
7
7
|
# require "rubygems" # if that is your preferred way to manage gems!
|
@@ -47,7 +47,7 @@ module Axlsx
|
|
47
47
|
def initialize(frame, options = {})
|
48
48
|
@vary_colors = false
|
49
49
|
@grouping = :standard
|
50
|
-
super
|
50
|
+
super
|
51
51
|
@series_type = AreaSeries
|
52
52
|
@d_lbls = nil
|
53
53
|
end
|
@@ -75,7 +75,7 @@ module Axlsx
|
|
75
75
|
# @param [String] str
|
76
76
|
# @return [String]
|
77
77
|
def to_xml_string(str = +'')
|
78
|
-
super
|
78
|
+
super do
|
79
79
|
str << "<c:" << node_name << ">"
|
80
80
|
str << '<c:grouping val="' << grouping.to_s << '"/>'
|
81
81
|
str << '<c:varyColors val="' << vary_colors.to_s << '"/>'
|
@@ -40,7 +40,7 @@ module Axlsx
|
|
40
40
|
@marker_symbol = options[:marker_symbol] || :default
|
41
41
|
@smooth = false
|
42
42
|
@labels, @data = nil, nil
|
43
|
-
super
|
43
|
+
super
|
44
44
|
@labels = AxDataSource.new(data: options[:labels]) unless options[:labels].nil?
|
45
45
|
@data = NumDataSource.new(options) unless options[:data].nil?
|
46
46
|
end
|
@@ -72,7 +72,7 @@ module Axlsx
|
|
72
72
|
# @param [String] str
|
73
73
|
# @return [String]
|
74
74
|
def to_xml_string(str = +'')
|
75
|
-
super
|
75
|
+
super do
|
76
76
|
if color
|
77
77
|
str << '<c:spPr><a:solidFill>'
|
78
78
|
str << '<a:srgbClr val="' << color << '"/>'
|
data/lib/axlsx/drawing/axes.rb
CHANGED
data/lib/axlsx/drawing/axis.rb
CHANGED
@@ -84,7 +84,7 @@ module Axlsx
|
|
84
84
|
|
85
85
|
# The color for this axis. This value is used when rendering the axis line in the chart.
|
86
86
|
# colors should be in 6 character rbg format
|
87
|
-
# @return [String] the rbg color
|
87
|
+
# @return [String] the rbg color assigned.
|
88
88
|
# @see color
|
89
89
|
def color=(color_rgb)
|
90
90
|
@color = color_rgb
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Axlsx
|
4
|
-
# The Bar3DChart is a three
|
4
|
+
# The Bar3DChart is a three dimensional barchart (who would have guessed?) that you can add to your worksheet.
|
5
5
|
# @see Worksheet#add_chart
|
6
6
|
# @see Chart#add_series
|
7
7
|
# @see Package#serialize
|
@@ -75,7 +75,7 @@ module Axlsx
|
|
75
75
|
def initialize(frame, options = {})
|
76
76
|
@vary_colors = true
|
77
77
|
@gap_width, @gap_depth, @shape = nil, nil, nil
|
78
|
-
super
|
78
|
+
super
|
79
79
|
@series_type = BarSeries
|
80
80
|
@view_3D = View3D.new({ r_ang_ax: 1 }.merge(options))
|
81
81
|
@d_lbls = nil
|
@@ -121,7 +121,7 @@ module Axlsx
|
|
121
121
|
# @param [String] str
|
122
122
|
# @return [String]
|
123
123
|
def to_xml_string(str = +'')
|
124
|
-
super
|
124
|
+
super do
|
125
125
|
str << '<c:bar3DChart>'
|
126
126
|
str << '<c:barDir val="' << bar_dir.to_s << '"/>'
|
127
127
|
str << '<c:grouping val="' << grouping.to_s << '"/>'
|
@@ -141,7 +141,17 @@ module Axlsx
|
|
141
141
|
# category axes specified via axes[:val_axes] and axes[:cat_axis]
|
142
142
|
# @return [Axes]
|
143
143
|
def axes
|
144
|
-
@axes ||=
|
144
|
+
@axes ||= begin
|
145
|
+
a = Axes.new(cat_axis: CatAxis, val_axis: ValAxis)
|
146
|
+
|
147
|
+
if bar_dir == :col
|
148
|
+
a[:val_axis].ax_pos = :l
|
149
|
+
else
|
150
|
+
a[:cat_axis].ax_pos = :l
|
151
|
+
end
|
152
|
+
|
153
|
+
a
|
154
|
+
end
|
145
155
|
end
|
146
156
|
end
|
147
157
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Axlsx
|
4
|
-
# The BarChart is a two
|
4
|
+
# The BarChart is a two dimensional barchart that you can add to your worksheet.
|
5
5
|
# @see Worksheet#add_chart
|
6
6
|
# @see Chart#add_series
|
7
7
|
# @see Package#serialize
|
@@ -68,7 +68,7 @@ module Axlsx
|
|
68
68
|
def initialize(frame, options = {})
|
69
69
|
@vary_colors = true
|
70
70
|
@gap_width, @overlap, @shape = nil, nil, nil
|
71
|
-
super
|
71
|
+
super
|
72
72
|
@series_type = BarSeries
|
73
73
|
@d_lbls = nil
|
74
74
|
end
|
@@ -111,7 +111,7 @@ module Axlsx
|
|
111
111
|
# @param [String] str
|
112
112
|
# @return [String]
|
113
113
|
def to_xml_string(str = +'')
|
114
|
-
super
|
114
|
+
super do
|
115
115
|
str << '<c:barChart>'
|
116
116
|
str << '<c:barDir val="' << bar_dir.to_s << '"/>'
|
117
117
|
str << '<c:grouping val="' << grouping.to_s << '"/>'
|
@@ -131,7 +131,17 @@ module Axlsx
|
|
131
131
|
# category axes specified via axes[:val_axes] and axes[:cat_axis]
|
132
132
|
# @return [Axes]
|
133
133
|
def axes
|
134
|
-
@axes ||=
|
134
|
+
@axes ||= begin
|
135
|
+
a = Axes.new(cat_axis: CatAxis, val_axis: ValAxis)
|
136
|
+
|
137
|
+
if bar_dir == :col
|
138
|
+
a[:val_axis].ax_pos = :l
|
139
|
+
else
|
140
|
+
a[:cat_axis].ax_pos = :l
|
141
|
+
end
|
142
|
+
|
143
|
+
a
|
144
|
+
end
|
135
145
|
end
|
136
146
|
end
|
137
147
|
end
|
@@ -37,7 +37,7 @@ module Axlsx
|
|
37
37
|
def initialize(chart, options = {})
|
38
38
|
@shape = :box
|
39
39
|
@colors = []
|
40
|
-
super
|
40
|
+
super
|
41
41
|
self.labels = AxDataSource.new({ data: options[:labels] }) unless options[:labels].nil?
|
42
42
|
self.data = NumDataSource.new(options) unless options[:data].nil?
|
43
43
|
end
|
@@ -62,7 +62,7 @@ module Axlsx
|
|
62
62
|
# @param [String] str
|
63
63
|
# @return [String]
|
64
64
|
def to_xml_string(str = +'')
|
65
|
-
super
|
65
|
+
super do
|
66
66
|
colors.each_with_index do |c, index|
|
67
67
|
str << '<c:dPt>'
|
68
68
|
str << '<c:idx val="' << index.to_s << '"/>'
|
@@ -26,7 +26,7 @@ module Axlsx
|
|
26
26
|
def initialize(frame, options = {})
|
27
27
|
@vary_colors = 0
|
28
28
|
|
29
|
-
super
|
29
|
+
super
|
30
30
|
@series_type = BubbleSeries
|
31
31
|
@d_lbls = nil
|
32
32
|
parse_options options
|
@@ -36,7 +36,7 @@ module Axlsx
|
|
36
36
|
# @param [String] str
|
37
37
|
# @return [String]
|
38
38
|
def to_xml_string(str = +'')
|
39
|
-
super
|
39
|
+
super do
|
40
40
|
str << '<c:bubbleChart>'
|
41
41
|
str << '<c:varyColors val="' << vary_colors.to_s << '"/>'
|
42
42
|
@series.each { |ser| ser.to_xml_string(str) }
|
@@ -27,7 +27,7 @@ module Axlsx
|
|
27
27
|
# Creates a new BubbleSeries
|
28
28
|
def initialize(chart, options = {})
|
29
29
|
@xData, @yData, @bubbleSize = nil
|
30
|
-
super
|
30
|
+
super
|
31
31
|
@xData = AxDataSource.new(tag_name: :xVal, data: options[:xData]) unless options[:xData].nil?
|
32
32
|
@yData = NumDataSource.new({ tag_name: :yVal, data: options[:yData] }) unless options[:yData].nil?
|
33
33
|
@bubbleSize = NumDataSource.new({ tag_name: :bubbleSize, data: options[:bubbleSize] }) unless options[:bubbleSize].nil?
|
@@ -42,7 +42,7 @@ module Axlsx
|
|
42
42
|
# @param [String] str
|
43
43
|
# @return [String]
|
44
44
|
def to_xml_string(str = +'')
|
45
|
-
super
|
45
|
+
super do
|
46
46
|
# needs to override the super color here to push in ln/and something else!
|
47
47
|
if color
|
48
48
|
str << '<c:spPr><a:solidFill>'
|
@@ -12,7 +12,7 @@ module Axlsx
|
|
12
12
|
self.auto = 1
|
13
13
|
self.lbl_algn = :ctr
|
14
14
|
self.lbl_offset = "100"
|
15
|
-
super
|
15
|
+
super
|
16
16
|
end
|
17
17
|
|
18
18
|
# From the docs: This element specifies that this axis is a date or text axis based on the data that is used for the axis labels, not a specific choice.
|
@@ -31,7 +31,7 @@ module Axlsx
|
|
31
31
|
attr_reader :lbl_offset
|
32
32
|
alias :lblOffset :lbl_offset
|
33
33
|
|
34
|
-
# The number of tick
|
34
|
+
# The number of tick labels to skip between labels
|
35
35
|
# @return [Integer]
|
36
36
|
attr_reader :tick_lbl_skip
|
37
37
|
alias :tickLblSkip :tick_lbl_skip
|
@@ -85,7 +85,7 @@ module Axlsx
|
|
85
85
|
# @return [String]
|
86
86
|
def to_xml_string(str = +'')
|
87
87
|
str << '<c:catAx>'
|
88
|
-
super
|
88
|
+
super
|
89
89
|
str << '<c:auto val="' << @auto.to_s << '"/>'
|
90
90
|
str << '<c:lblAlgn val="' << @lbl_algn.to_s << '"/>'
|
91
91
|
str << '<c:lblOffset val="' << @lbl_offset.to_i.to_s << '"/>'
|
data/lib/axlsx/drawing/chart.rb
CHANGED
data/lib/axlsx/drawing/d_lbls.rb
CHANGED
@@ -9,6 +9,7 @@ module Axlsx
|
|
9
9
|
class DLbls
|
10
10
|
include Axlsx::Accessors
|
11
11
|
include Axlsx::OptionsParser
|
12
|
+
|
12
13
|
# creates a new DLbls object
|
13
14
|
def initialize(chart_type, options = {})
|
14
15
|
raise ArgumentError, 'chart_type must inherit from Chart' unless [Chart, LineChart].include?(chart_type.superclass)
|
@@ -19,7 +20,7 @@ module Axlsx
|
|
19
20
|
end
|
20
21
|
|
21
22
|
# These attributes are all boolean so I'm doing a bit of a hand
|
22
|
-
# waving magic show to set up the
|
23
|
+
# waving magic show to set up the attribute accessors
|
23
24
|
# @note
|
24
25
|
# not all charts support all methods!
|
25
26
|
# Bar3DChart and Line3DChart and ScatterChart do not support d_lbl_pos or show_leader_lines
|
@@ -42,7 +43,7 @@ module Axlsx
|
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
45
|
-
# The chart type that is using this data
|
46
|
+
# The chart type that is using this data labels instance.
|
46
47
|
# This affects the xml output as not all chart types support the
|
47
48
|
# same data label attributes.
|
48
49
|
attr_reader :chart_type
|
@@ -57,11 +58,11 @@ module Axlsx
|
|
57
58
|
end
|
58
59
|
|
59
60
|
# @see DLbls#d_lbl_pos
|
60
|
-
# Assigns the label
|
61
|
+
# Assigns the label position for this data labels on this chart.
|
61
62
|
# Allowed positions are :bestFit, :b, :ctr, :inBase, :inEnd, :l,
|
62
63
|
# :outEnd, :r and :t
|
63
64
|
# The default is :bestFit
|
64
|
-
# @param [Symbol] label_position the
|
65
|
+
# @param [Symbol] label_position the position you want to use.
|
65
66
|
def d_lbl_pos=(label_position)
|
66
67
|
return unless [PieChart, Pie3DChart, LineChart].include? @chart_type
|
67
68
|
|
@@ -1,56 +1,56 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Axlsx
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
4
|
+
require_relative 'd_lbls'
|
5
|
+
require_relative 'title'
|
6
|
+
require_relative 'series_title'
|
7
|
+
require_relative 'series'
|
8
|
+
require_relative 'pie_series'
|
9
|
+
require_relative 'bar_series'
|
10
|
+
require_relative 'line_series'
|
11
|
+
require_relative 'scatter_series'
|
12
|
+
require_relative 'bubble_series'
|
13
|
+
require_relative 'area_series'
|
14
|
+
|
15
|
+
require_relative 'scaling'
|
16
|
+
require_relative 'axis'
|
17
|
+
|
18
|
+
require_relative 'str_val'
|
19
|
+
require_relative 'num_val'
|
20
|
+
require_relative 'str_data'
|
21
|
+
require_relative 'num_data'
|
22
|
+
require_relative 'num_data_source'
|
23
|
+
require_relative 'ax_data_source'
|
24
|
+
|
25
|
+
require_relative 'ser_axis'
|
26
|
+
require_relative 'cat_axis'
|
27
|
+
require_relative 'val_axis'
|
28
|
+
require_relative 'axes'
|
29
|
+
|
30
|
+
require_relative 'marker'
|
31
|
+
|
32
|
+
require_relative 'one_cell_anchor'
|
33
|
+
require_relative 'two_cell_anchor'
|
34
|
+
require_relative 'graphic_frame'
|
35
|
+
|
36
|
+
require_relative 'view_3D'
|
37
|
+
require_relative 'chart'
|
38
|
+
require_relative 'pie_3D_chart'
|
39
|
+
require_relative 'pie_chart'
|
40
|
+
require_relative 'bar_3D_chart'
|
41
|
+
require_relative 'bar_chart'
|
42
|
+
require_relative 'line_chart'
|
43
|
+
require_relative 'line_3D_chart'
|
44
|
+
require_relative 'scatter_chart'
|
45
|
+
require_relative 'bubble_chart'
|
46
|
+
require_relative 'area_chart'
|
47
|
+
|
48
|
+
require_relative 'picture_locking'
|
49
|
+
require_relative 'pic'
|
50
|
+
require_relative 'hyperlink'
|
51
|
+
|
52
|
+
require_relative 'vml_drawing'
|
53
|
+
require_relative 'vml_shape'
|
54
54
|
|
55
55
|
# A Drawing is a canvas for charts and images. Each worksheet has a single drawing that manages anchors.
|
56
56
|
# The anchors reference the charts or images via graphical frames. This is not a trivial relationship so please do follow the advice in the note.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Axlsx
|
4
|
-
# The Line3DChart is a three
|
4
|
+
# The Line3DChart is a three dimensional line chart (who would have guessed?) that you can add to your worksheet.
|
5
5
|
# @example Creating a chart
|
6
6
|
# # This example creates a line in a single sheet.
|
7
7
|
# require "rubygems" # if that is your preferred way to manage gems!
|
@@ -43,7 +43,7 @@ module Axlsx
|
|
43
43
|
def initialize(frame, options = {})
|
44
44
|
@gap_depth = nil
|
45
45
|
@view_3D = View3D.new({ r_ang_ax: 1 }.merge(options))
|
46
|
-
super
|
46
|
+
super
|
47
47
|
axes.add_axis :ser_axis, SerAxis
|
48
48
|
end
|
49
49
|
|
@@ -58,7 +58,7 @@ module Axlsx
|
|
58
58
|
# @param [String] str
|
59
59
|
# @return [String]
|
60
60
|
def to_xml_string(str = +'')
|
61
|
-
super
|
61
|
+
super do
|
62
62
|
str << '<c:gapDepth val="' << @gap_depth.to_s << '"/>' unless @gap_depth.nil?
|
63
63
|
end
|
64
64
|
end
|