axlsx 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +14 -0
- data/README.md +22 -21
- data/Rakefile +1 -1
- data/axlsx.gemspec +36 -0
- data/doc/Axlsx.html +373 -559
- data/doc/Axlsx/App.html +257 -360
- data/doc/Axlsx/Axis.html +113 -144
- data/doc/Axlsx/Bar3DChart.html +122 -152
- data/doc/Axlsx/BarSeries.html +67 -81
- data/doc/Axlsx/Border.html +96 -119
- data/doc/Axlsx/BorderPr.html +89 -114
- data/doc/Axlsx/CatAxis.html +79 -104
- data/doc/Axlsx/CatAxisData.html +40 -54
- data/doc/Axlsx/Cell.html +193 -679
- data/doc/Axlsx/CellAlignment.html +116 -157
- data/doc/Axlsx/CellProtection.html +50 -68
- data/doc/Axlsx/CellStyle.html +78 -106
- data/doc/Axlsx/Chart.html +361 -432
- data/doc/Axlsx/Color.html +56 -78
- data/doc/Axlsx/ContentType.html +28 -41
- data/doc/Axlsx/Core.html +43 -55
- data/doc/Axlsx/DataTypeValidator.html +34 -43
- data/doc/Axlsx/Default.html +55 -81
- data/doc/Axlsx/Drawing.html +322 -412
- data/doc/Axlsx/Fill.html +34 -47
- data/doc/Axlsx/Font.html +157 -207
- data/doc/Axlsx/GradientFill.html +90 -122
- data/doc/Axlsx/GradientStop.html +36 -50
- data/doc/Axlsx/GraphicFrame.html +106 -130
- data/doc/Axlsx/Line3DChart.html +108 -134
- data/doc/Axlsx/LineSeries.html +58 -67
- data/doc/Axlsx/Marker.html +84 -111
- data/doc/Axlsx/NumFmt.html +83 -102
- data/doc/Axlsx/OneCellAnchor.html +158 -196
- data/doc/Axlsx/Override.html +60 -92
- data/doc/Axlsx/Package.html +190 -759
- data/doc/Axlsx/PatternFill.html +78 -99
- data/doc/Axlsx/Pic.html +451 -405
- data/doc/Axlsx/Pie3DChart.html +33 -42
- data/doc/Axlsx/PieSeries.html +68 -80
- data/doc/Axlsx/RegexValidator.html +15 -20
- data/doc/Axlsx/Relationship.html +49 -66
- data/doc/Axlsx/Relationships.html +28 -41
- data/doc/Axlsx/RestrictionValidator.html +23 -32
- data/doc/Axlsx/Row.html +132 -161
- data/doc/Axlsx/Scaling.html +71 -90
- data/doc/Axlsx/SerAxis.html +61 -79
- data/doc/Axlsx/Series.html +125 -201
- data/doc/Axlsx/SeriesTitle.html +26 -31
- data/doc/Axlsx/Styles.html +286 -355
- data/doc/Axlsx/TableStyle.html +62 -87
- data/doc/Axlsx/TableStyleElement.html +84 -104
- data/doc/Axlsx/TableStyles.html +59 -82
- data/doc/Axlsx/Title.html +58 -155
- data/doc/Axlsx/TwoCellAnchor.html +165 -204
- data/doc/Axlsx/ValAxis.html +39 -53
- data/doc/Axlsx/ValAxisData.html +29 -39
- data/doc/Axlsx/View3D.html +93 -122
- data/doc/Axlsx/Workbook.html +359 -362
- data/doc/Axlsx/Worksheet.html +471 -816
- data/doc/Axlsx/Xf.html +341 -296
- data/doc/_index.html +7 -11
- data/doc/class_list.html +1 -1
- data/doc/file.LICENSE.html +86 -0
- data/doc/file.README.html +105 -107
- data/doc/file_list.html +3 -0
- data/doc/frames.html +1 -1
- data/doc/index.html +105 -107
- data/doc/method_list.html +426 -602
- data/doc/top-level-namespace.html +3 -3
- data/examples/example.rb +20 -1
- data/lib/axlsx.rb +20 -15
- data/lib/axlsx/content_type/default.rb +8 -3
- data/lib/axlsx/content_type/override.rb +11 -4
- data/lib/axlsx/doc_props/app.rb +53 -23
- data/lib/axlsx/drawing/axis.rb +16 -5
- data/lib/axlsx/drawing/bar_3D_chart.rb +15 -7
- data/lib/axlsx/drawing/bar_series.rb +7 -5
- data/lib/axlsx/drawing/cat_axis.rb +10 -3
- data/lib/axlsx/drawing/chart.rb +21 -15
- data/lib/axlsx/drawing/drawing.rb +16 -30
- data/lib/axlsx/drawing/graphic_frame.rb +2 -4
- data/lib/axlsx/drawing/line_3D_chart.rb +5 -2
- data/lib/axlsx/drawing/line_series.rb +6 -5
- data/lib/axlsx/drawing/marker.rb +9 -5
- data/lib/axlsx/drawing/one_cell_anchor.rb +7 -7
- data/lib/axlsx/drawing/pic.rb +29 -37
- data/lib/axlsx/drawing/pie_series.rb +7 -5
- data/lib/axlsx/drawing/scaling.rb +11 -5
- data/lib/axlsx/drawing/ser_axis.rb +6 -2
- data/lib/axlsx/drawing/series.rb +11 -11
- data/lib/axlsx/drawing/series_title.rb +1 -1
- data/lib/axlsx/drawing/title.rb +5 -12
- data/lib/axlsx/drawing/two_cell_anchor.rb +2 -3
- data/lib/axlsx/drawing/val_axis.rb +2 -2
- data/lib/axlsx/drawing/view_3D.rb +16 -9
- data/lib/axlsx/package.rb +25 -27
- data/lib/axlsx/rels/relationship.rb +4 -2
- data/lib/axlsx/stylesheet/border.rb +9 -4
- data/lib/axlsx/stylesheet/border_pr.rb +7 -4
- data/lib/axlsx/stylesheet/cell_alignment.rb +18 -9
- data/lib/axlsx/stylesheet/cell_protection.rb +5 -2
- data/lib/axlsx/stylesheet/cell_style.rb +12 -7
- data/lib/axlsx/stylesheet/color.rb +8 -6
- data/lib/axlsx/stylesheet/fill.rb +2 -1
- data/lib/axlsx/stylesheet/font.rb +24 -13
- data/lib/axlsx/stylesheet/gradient_fill.rb +16 -10
- data/lib/axlsx/stylesheet/gradient_stop.rb +5 -3
- data/lib/axlsx/stylesheet/num_fmt.rb +4 -2
- data/lib/axlsx/stylesheet/pattern_fill.rb +6 -4
- data/lib/axlsx/stylesheet/styles.rb +12 -12
- data/lib/axlsx/stylesheet/table_style.rb +6 -3
- data/lib/axlsx/stylesheet/table_style_element.rb +9 -4
- data/lib/axlsx/stylesheet/table_styles.rb +4 -4
- data/lib/axlsx/stylesheet/xf.rb +52 -31
- data/lib/axlsx/util/validators.rb +3 -3
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/workbook.rb +8 -9
- data/lib/axlsx/workbook/worksheet/cell.rb +25 -16
- data/lib/axlsx/workbook/worksheet/row.rb +2 -4
- data/lib/axlsx/workbook/worksheet/worksheet.rb +23 -32
- data/test/drawing/tc_one_cell_anchor.rb +1 -1
- metadata +135 -165
- data/doc/Axlsx/SimpleTypedList.html +0 -1686
- data/lib/schema/dc.xsd~ +0 -118
- data/lib/schema/dcterms.xsd~ +0 -331
- data/lib/schema/opc-coreProperties.xsd~ +0 -50
- data/test/drawing/tc_line_series.tc~ +0 -34
@@ -6,7 +6,7 @@
|
|
6
6
|
<title>
|
7
7
|
Top Level Namespace
|
8
8
|
|
9
|
-
—
|
9
|
+
— AXLSX
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
@@ -94,9 +94,9 @@
|
|
94
94
|
</div>
|
95
95
|
|
96
96
|
<div id="footer">
|
97
|
-
Generated on
|
97
|
+
Generated on Sat Nov 26 13:16:40 2011 by
|
98
98
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
99
|
-
0.7.3 (ruby-1.
|
99
|
+
0.7.3 (ruby-1.9.3).
|
100
100
|
</div>
|
101
101
|
|
102
102
|
</body>
|
data/examples/example.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# encoding: utf-8
|
1
3
|
require 'rubygems'
|
2
4
|
require 'axlsx'
|
3
5
|
|
6
|
+
|
4
7
|
#A Simple Workbook
|
8
|
+
|
5
9
|
p = Axlsx::Package.new
|
6
10
|
p.workbook.add_worksheet do |sheet|
|
7
11
|
sheet.add_row ["First", "Second", "Third"]
|
@@ -10,6 +14,7 @@
|
|
10
14
|
p.serialize("example1.xlsx")
|
11
15
|
|
12
16
|
#Generating A Bar Chart
|
17
|
+
|
13
18
|
p = Axlsx::Package.new
|
14
19
|
p.workbook.add_worksheet do |sheet|
|
15
20
|
sheet.add_row ["First", "Second", "Third"]
|
@@ -21,6 +26,7 @@
|
|
21
26
|
p.serialize("example2.xlsx")
|
22
27
|
|
23
28
|
#Generating A Pie Chart
|
29
|
+
|
24
30
|
p = Axlsx::Package.new
|
25
31
|
p.workbook.add_worksheet do |sheet|
|
26
32
|
sheet.add_row ["First", "Second", "Third"]
|
@@ -90,10 +96,23 @@
|
|
90
96
|
|
91
97
|
p = Axlsx::Package.new
|
92
98
|
p.workbook.add_worksheet do |sheet|
|
93
|
-
|
99
|
+
img = File.expand_path('examples/image1.jpeg')
|
100
|
+
sheet.add_image(:image_src => img) do |image|
|
94
101
|
image.width=720
|
95
102
|
image.height=666
|
96
103
|
image.start_at 2, 2
|
97
104
|
end
|
98
105
|
end
|
99
106
|
p.serialize("example7.xlsx")
|
107
|
+
|
108
|
+
|
109
|
+
#Asian Language Support
|
110
|
+
|
111
|
+
p = Axlsx::Package.new
|
112
|
+
p.workbook.add_worksheet do |sheet|
|
113
|
+
sheet.add_row ["日本語"]
|
114
|
+
sheet.add_row ["华语/華語"]
|
115
|
+
sheet.add_row ["한국어/조선말"]
|
116
|
+
end
|
117
|
+
p.serialize("example8.xlsx")
|
118
|
+
|
data/lib/axlsx.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
|
2
|
+
Encoding::default_internal = 'UTF-8' unless RUBY_VERSION < '1.9'
|
3
|
+
Encoding::default_external = 'UTF-8' unless RUBY_VERSION < '1.9'
|
4
|
+
|
1
5
|
require 'axlsx/util/simple_typed_list.rb'
|
2
6
|
require 'axlsx/util/constants.rb'
|
3
7
|
require 'axlsx/util/validators.rb'
|
@@ -13,26 +17,27 @@ require 'axlsx/workbook/workbook.rb'
|
|
13
17
|
require 'axlsx/package.rb'
|
14
18
|
|
15
19
|
|
16
|
-
module Axlsx
|
17
20
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
#required gems
|
22
|
+
require 'Nokogiri'
|
23
|
+
require 'active_support/core_ext/object/instance_variables'
|
24
|
+
require 'active_support/inflector'
|
25
|
+
require 'rmagick'
|
26
|
+
require 'zip/zip'
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
28
|
+
#core dependencies
|
29
|
+
require 'bigdecimal'
|
30
|
+
require 'time'
|
31
|
+
require 'CGI'
|
29
32
|
|
33
|
+
# xlsx generation with charts, images, automated column width, customizable styles and full schema validation. Axlsx excels at helping you generate beautiful Office Open XML Spreadsheet documents without having to understand the entire ECMA specification. Check out the README for some examples of how easy it is. Best of all, you can validate your xlsx file before serialization so you know for sure that anything generated is going to load on your client's machine.
|
34
|
+
module Axlsx
|
30
35
|
# determines the cell range for the items provided
|
31
36
|
def self.cell_range(items)
|
32
37
|
return "" unless items.first.is_a? Cell
|
33
|
-
"#{items.first.row.worksheet.name}!" +
|
34
|
-
"#{items.first.r_abs}
|
38
|
+
ref = "#{items.first.row.worksheet.name}!" +
|
39
|
+
"#{items.first.r_abs}"
|
40
|
+
ref += ":#{items.last.r_abs}" if items.size > 1
|
41
|
+
ref
|
35
42
|
end
|
36
|
-
|
37
|
-
|
38
43
|
end
|
@@ -4,10 +4,11 @@ module Axlsx
|
|
4
4
|
|
5
5
|
# The extension of the content type.
|
6
6
|
# @return [String]
|
7
|
-
|
7
|
+
attr_reader :Extension
|
8
8
|
|
9
|
-
#
|
10
|
-
|
9
|
+
# The type of content.
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :ContentType
|
11
12
|
|
12
13
|
#Creates a new Default object
|
13
14
|
# @option options [String] Extension
|
@@ -19,7 +20,11 @@ module Axlsx
|
|
19
20
|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
20
21
|
end
|
21
22
|
end
|
23
|
+
# Sets the file extension for this content type.
|
22
24
|
def Extension=(v) Axlsx::validate_string v; @Extension = v end
|
25
|
+
|
26
|
+
# Sets the content type
|
27
|
+
# @see Axlsx#validate_content_type
|
23
28
|
def ContentType=(v) Axlsx::validate_content_type v; @ContentType = v end
|
24
29
|
|
25
30
|
# Serializes the object to xml
|
@@ -2,11 +2,13 @@ module Axlsx
|
|
2
2
|
# An override content part. These parts are automatically created by for you based on the content of your package.
|
3
3
|
class Override
|
4
4
|
|
5
|
-
#
|
6
|
-
|
5
|
+
# The type of content.
|
6
|
+
# @return [String]
|
7
|
+
attr_reader :ContentType
|
7
8
|
|
8
|
-
#
|
9
|
-
|
9
|
+
# The name and location of the part.
|
10
|
+
# @return [String]
|
11
|
+
attr_reader :PartName
|
10
12
|
|
11
13
|
#Creates a new Override object
|
12
14
|
# @option options [String] PartName
|
@@ -18,7 +20,12 @@ module Axlsx
|
|
18
20
|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
19
21
|
end
|
20
22
|
end
|
23
|
+
|
24
|
+
# The name and location of the part.
|
21
25
|
def PartName=(v) Axlsx::validate_string v; @PartName = v end
|
26
|
+
|
27
|
+
# The content type.
|
28
|
+
# @see Axlsx#validate_content_type
|
22
29
|
def ContentType=(v) Axlsx::validate_content_type v; @ContentType = v end
|
23
30
|
|
24
31
|
# Serializes the Override object to xml
|
data/lib/axlsx/doc_props/app.rb
CHANGED
@@ -11,73 +11,73 @@ module Axlsx
|
|
11
11
|
class App
|
12
12
|
|
13
13
|
# @return [String] The name of the document template.
|
14
|
-
|
14
|
+
attr_reader :Template
|
15
15
|
|
16
16
|
# @return [String] The name of the manager for the document.
|
17
|
-
|
17
|
+
attr_reader :Manager
|
18
18
|
|
19
19
|
# @return [String] The name of the company generating the document.
|
20
|
-
|
20
|
+
attr_reader :Company
|
21
21
|
|
22
22
|
# @return [Integer] The number of pages in the document.
|
23
|
-
|
23
|
+
attr_reader :Pages
|
24
24
|
|
25
25
|
# @return [Integer] The number of words in the document.
|
26
|
-
|
26
|
+
attr_reader :Words
|
27
27
|
|
28
28
|
# @return [Integer] The number of characters in the document.
|
29
|
-
|
29
|
+
attr_reader :Characters
|
30
30
|
|
31
31
|
# @return [String] The intended format of the presentation.
|
32
|
-
|
32
|
+
attr_reader :PresentationFormat
|
33
33
|
|
34
34
|
# @return [Integer] The number of lines in the document.
|
35
|
-
|
35
|
+
attr_reader :Lines
|
36
36
|
|
37
37
|
# @return [Integer] The number of paragraphs in the document
|
38
|
-
|
38
|
+
attr_reader :Paragraphs
|
39
39
|
|
40
40
|
# @return [Intger] The number of slides in the document.
|
41
|
-
|
41
|
+
attr_reader :Slides
|
42
42
|
|
43
43
|
# @return [Integer] The number of slides that have notes.
|
44
|
-
|
44
|
+
attr_reader :Notes
|
45
45
|
|
46
46
|
# @return [Integer] The total amount of time spent editing.
|
47
|
-
|
47
|
+
attr_reader :TotalTime
|
48
48
|
|
49
49
|
# @return [Integer] The number of hidden slides.
|
50
|
-
|
50
|
+
attr_reader :HiddenSlides
|
51
51
|
|
52
52
|
# @return [Integer] The total number multimedia clips
|
53
|
-
|
53
|
+
attr_reader :MMClips
|
54
54
|
|
55
55
|
# @return [Boolean] The display mode for the document thumbnail.
|
56
|
-
|
56
|
+
attr_reader :ScaleCrop
|
57
57
|
|
58
58
|
# @return [Boolean] The links in the document are up to date.
|
59
|
-
|
59
|
+
attr_reader :LinksUpToDate
|
60
60
|
|
61
61
|
# @return [Integer] The number of characters in the document including spaces.
|
62
|
-
|
62
|
+
attr_reader :CharactersWithSpaces
|
63
63
|
|
64
64
|
# @return [Boolean] Indicates if the document is shared.
|
65
|
-
|
65
|
+
attr_reader :ShareDoc
|
66
66
|
|
67
67
|
# @return [String] The base for hyper links in the document.
|
68
|
-
|
68
|
+
attr_reader :HyperLinkBase
|
69
69
|
|
70
70
|
# @return [Boolean] Indicates that the hyper links in the document have been changed.
|
71
|
-
|
71
|
+
attr_reader :HyperlinksChanged
|
72
72
|
|
73
73
|
# @return [String] The name of the application
|
74
|
-
|
74
|
+
attr_reader :Application
|
75
75
|
|
76
76
|
# @return [String] The version of the application.
|
77
|
-
|
77
|
+
attr_reader :AppVersion
|
78
78
|
|
79
79
|
# @return [Integer] Document security
|
80
|
-
|
80
|
+
attr_reader :DocSecurity
|
81
81
|
|
82
82
|
# Creates an App object
|
83
83
|
# @option options [String] Template
|
@@ -108,28 +108,58 @@ module Axlsx
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
+
# Sets the Template property of your app.xml file
|
111
112
|
def Template=(v) Axlsx::validate_string v; @Template = v; end
|
113
|
+
|
114
|
+
# Sets the Manager property of your app.xml file
|
112
115
|
def Manager=(v) Axlsx::validate_string v; @Manager = v; end
|
116
|
+
|
117
|
+
# Sets the Company property of your app.xml file
|
113
118
|
def Company=(v) Axlsx::validate_string v; @Company = v; end
|
119
|
+
|
120
|
+
# Sets the Pages property of your app.xml file
|
114
121
|
def Pages=(v) Axlsx::validate_int v; @Pages = v; end
|
122
|
+
|
123
|
+
# Sets the Words property of your app.xml file
|
115
124
|
def Words=(v) Axlsx::validate_int v; @Words = v; end
|
125
|
+
|
126
|
+
# Sets the Characters property of your app.xml file
|
116
127
|
def Characters=(v) Axlsx::validate_int v; @Characters = v; end
|
128
|
+
|
129
|
+
|
130
|
+
# Sets the PresentationFormat property of your app.xml file
|
117
131
|
def PresentationFormat=(v) Axlsx::validate_string v; @PresentationFormat = v; end
|
132
|
+
# Sets the Lines property of your app.xml file
|
118
133
|
def Lines=(v) Axlsx::validate_int v; @Lines = v; end
|
134
|
+
# Sets the Paragraphs property of your app.xml file
|
119
135
|
def Paragraphs=(v) Axlsx::validate_int v; @Paragraphs = v; end
|
136
|
+
# Sets the Slides property of your app.xml file
|
120
137
|
def Slides=(v) Axlsx::validate_int v; @Slides = v; end
|
138
|
+
# Sets the Notes property of your app.xml file
|
121
139
|
def Notes=(v) Axlsx::validate_int v; @Notes = v; end
|
140
|
+
# Sets the TotalTime property of your app.xml file
|
122
141
|
def TotalTime=(v) Axlsx::validate_int v; @TotalTime = v; end
|
142
|
+
# Sets the HiddenSlides property of your app.xml file
|
123
143
|
def HiddenSlides=(v) Axlsx::validate_int v; @HiddenSlides = v; end
|
144
|
+
# Sets the MMClips property of your app.xml file
|
124
145
|
def MMClips=(v) Axlsx::validate_int v; @MMClips = v; end
|
146
|
+
# Sets the ScaleCrop property of your app.xml file
|
125
147
|
def ScaleCrop=(v) Axlsx::validate_boolean v; @ScaleCrop = v; end
|
148
|
+
# Sets the LinksUpToDate property of your app.xml file
|
126
149
|
def LinksUpToDate=(v) Axlsx::validate_boolean v; @LinksUpToDate = v; end
|
150
|
+
# Sets the CharactersWithSpaces property of your app.xml file
|
127
151
|
def CharactersWithSpaces=(v) Axlsx::validate_int v; @CharactersWithSpaces = v; end
|
152
|
+
# Sets the ShareDoc property of your app.xml file
|
128
153
|
def ShareDoc=(v) Axlsx::validate_boolean v; @ShareDoc = v; end
|
154
|
+
# Sets the HyperLinkBase property of your app.xml file
|
129
155
|
def HyperLinkBase=(v) Axlsx::validate_string v; @HyperLinkBase = v; end
|
156
|
+
# Sets the HyperLinksChanged property of your app.xml file
|
130
157
|
def HyperlinksChanged=(v) Axlsx::validate_boolean v; @HyperlinksChanged = v; end
|
158
|
+
# Sets the Application property of your app.xml file
|
131
159
|
def Application=(v) Axlsx::validate_string v; @Application = v; end
|
160
|
+
# Sets the AppVersion property of your app.xml file
|
132
161
|
def AppVersion=(v) Axlsx::validate_string v; @AppVersion = v; end
|
162
|
+
# Sets the DocSecurity property of your app.xml file
|
133
163
|
def DocSecurity=(v) Axlsx::validate_int v; @DocSecurity = v; end
|
134
164
|
|
135
165
|
# Generate an app.xml document
|
data/lib/axlsx/drawing/axis.rb
CHANGED
@@ -18,22 +18,22 @@ module Axlsx
|
|
18
18
|
# The position of the axis
|
19
19
|
# must be one of [:l, :r, :t, :b]
|
20
20
|
# @return [Symbol]
|
21
|
-
|
21
|
+
attr_reader :axPos
|
22
22
|
|
23
23
|
# the position of the tick labels
|
24
24
|
# must be one of [:nextTo, :high, :low]
|
25
25
|
# @return [Symbol]
|
26
|
-
|
26
|
+
attr_reader :tickLblPos
|
27
27
|
|
28
28
|
# The number format format code for this axis
|
29
29
|
# default :General
|
30
30
|
# @return [String]
|
31
|
-
|
31
|
+
attr_reader :format_code
|
32
32
|
|
33
33
|
# specifies how the perpendicular axis is crossed
|
34
34
|
# must be one of [:autoZero, :min, :max]
|
35
35
|
# @return [Symbol]
|
36
|
-
|
36
|
+
attr_reader :crosses
|
37
37
|
|
38
38
|
# Creates an Axis object
|
39
39
|
# @param [Integer] axId the id of this axis
|
@@ -47,6 +47,7 @@ module Axlsx
|
|
47
47
|
Axlsx::validate_unsigned_int(crossAx)
|
48
48
|
@axId = axId
|
49
49
|
@crossAx = crossAx
|
50
|
+
@format_code = "General"
|
50
51
|
@scaling = Scaling.new(:orientation=>:minMax)
|
51
52
|
self.axPos = :l
|
52
53
|
self.tickLblPos = :nextTo
|
@@ -56,10 +57,20 @@ module Axlsx
|
|
56
57
|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
57
58
|
end
|
58
59
|
end
|
59
|
-
|
60
|
+
# The position of the axis
|
61
|
+
# must be one of [:l, :r, :t, :b]
|
60
62
|
def axPos=(v) RestrictionValidator.validate "#{self.class}.axPos", [:l, :r, :b, :t], v; @axPos = v; end
|
63
|
+
|
64
|
+
# the position of the tick labels
|
65
|
+
# must be one of [:nextTo, :high, :low1]
|
61
66
|
def tickLblPos=(v) RestrictionValidator.validate "#{self.class}.tickLblPos", [:nextTo, :high, :low], v; @tickLblPos = v; end
|
67
|
+
|
68
|
+
# The number format format code for this axis
|
69
|
+
# default :General
|
62
70
|
def format_code=(v) Axlsx::validate_string(v); @formatCode = v; end
|
71
|
+
|
72
|
+
# specifies how the perpendicular axis is crossed
|
73
|
+
# must be one of [:autoZero, :min, :max]
|
63
74
|
def crosses=(v) RestrictionValidator.validate "#{self.class}.crosses", [:autoZero, :min, :max], v; @crosses = v; end
|
64
75
|
|
65
76
|
# Serializes the common axis
|
@@ -18,25 +18,25 @@ module Axlsx
|
|
18
18
|
# The direction of the bars in the chart
|
19
19
|
# must be one of [:bar, :col]
|
20
20
|
# @return [Symbol]
|
21
|
-
|
21
|
+
attr_reader :barDir
|
22
22
|
|
23
23
|
# space between bar or column clusters, as a percentage of the bar or column width.
|
24
24
|
# @return [String]
|
25
|
-
|
25
|
+
attr_reader :gapDepth
|
26
26
|
|
27
27
|
# space between bar or column clusters, as a percentage of the bar or column width.
|
28
28
|
# @return [String]
|
29
|
-
|
29
|
+
attr_reader :gapWidth
|
30
30
|
|
31
31
|
#grouping for a column, line, or area chart.
|
32
32
|
# must be one of [:percentStacked, :clustered, :standard, :stacked]
|
33
33
|
# @return [Symbol]
|
34
|
-
|
34
|
+
attr_reader :grouping
|
35
35
|
|
36
36
|
# The shabe of the bars or columns
|
37
37
|
# must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]
|
38
38
|
# @return [Symbol]
|
39
|
-
|
39
|
+
attr_reader :shape
|
40
40
|
|
41
41
|
# validation regex for gap amount percent
|
42
42
|
GAP_AMOUNT_PERCENT = /0*(([0-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/
|
@@ -61,6 +61,7 @@ module Axlsx
|
|
61
61
|
def initialize(frame, options={})
|
62
62
|
@barDir = :bar
|
63
63
|
@grouping = :clustered
|
64
|
+
@gapWidth, @gapDepth, @shape = nil, nil, nil
|
64
65
|
@catAxId = rand(8 ** 8)
|
65
66
|
@valAxId = rand(8 ** 8)
|
66
67
|
@catAxis = CatAxis.new(@catAxId, @valAxId)
|
@@ -69,28 +70,35 @@ module Axlsx
|
|
69
70
|
@series_type = BarSeries
|
70
71
|
@view3D = View3D.new({:rAngAx=>1}.merge(options))
|
71
72
|
end
|
72
|
-
|
73
|
+
|
74
|
+
# The direction of the bars in the chart
|
75
|
+
# must be one of [:bar, :col]
|
73
76
|
def barDir=(v)
|
74
77
|
RestrictionValidator.validate "Bar3DChart.barDir", [:bar, :col], v
|
75
78
|
@barDir = v
|
76
79
|
end
|
77
80
|
|
78
|
-
|
81
|
+
#grouping for a column, line, or area chart.
|
82
|
+
# must be one of [:percentStacked, :clustered, :standard, :stacked]
|
79
83
|
def grouping=(v)
|
80
84
|
RestrictionValidator.validate "Bar3DChart.grouping", [:percentStacked, :clustered, :standard, :stacked], v
|
81
85
|
@grouping = v
|
82
86
|
end
|
83
87
|
|
88
|
+
# space between bar or column clusters, as a percentage of the bar or column width.
|
84
89
|
def gapWidth=(v)
|
85
90
|
RegexValidator.validate "Bar3DChart.gapWidth", GAP_AMOUNT_PERCENT, v
|
86
91
|
@gapWidth=(v)
|
87
92
|
end
|
88
93
|
|
94
|
+
# space between bar or column clusters, as a percentage of the bar or column width.
|
89
95
|
def gapDepth=(v)
|
90
96
|
RegexValidator.validate "Bar3DChart.gapWidth", GAP_AMOUNT_PERCENT, v
|
91
97
|
@gapDepth=(v)
|
92
98
|
end
|
93
99
|
|
100
|
+
# The shabe of the bars or columns
|
101
|
+
# must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]
|
94
102
|
def shape=(v)
|
95
103
|
RestrictionValidator.validate "Bar3DChart.shape", [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax], v
|
96
104
|
@shape = v
|