axlsx 1.1.7 → 1.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. data/README.md +41 -5
  2. data/Rakefile +3 -2
  3. data/examples/chart_colors.rb +18 -3
  4. data/examples/example.rb +100 -46
  5. data/examples/extractive.pdf +0 -0
  6. data/lib/axlsx.rb +7 -6
  7. data/lib/axlsx/content_type/content_type.rb +2 -0
  8. data/lib/axlsx/content_type/default.rb +21 -12
  9. data/lib/axlsx/content_type/override.rb +22 -11
  10. data/lib/axlsx/doc_props/app.rb +36 -32
  11. data/lib/axlsx/doc_props/core.rb +9 -5
  12. data/lib/axlsx/drawing/ax_data_source.rb +7 -6
  13. data/lib/axlsx/drawing/axis.rb +48 -27
  14. data/lib/axlsx/drawing/bar_3D_chart.rb +47 -37
  15. data/lib/axlsx/drawing/bar_series.rb +1 -0
  16. data/lib/axlsx/drawing/cat_axis.rb +42 -38
  17. data/lib/axlsx/drawing/chart.rb +34 -27
  18. data/lib/axlsx/drawing/drawing.rb +5 -4
  19. data/lib/axlsx/drawing/line_3D_chart.rb +1 -1
  20. data/lib/axlsx/drawing/num_data_source.rb +1 -1
  21. data/lib/axlsx/drawing/pie_3D_chart.rb +7 -7
  22. data/lib/axlsx/drawing/two_cell_anchor.rb +3 -8
  23. data/lib/axlsx/drawing/view_3D.rb +41 -31
  24. data/lib/axlsx/drawing/vml_drawing.rb +1 -1
  25. data/lib/axlsx/package.rb +11 -11
  26. data/lib/axlsx/rels/relationship.rb +3 -3
  27. data/lib/axlsx/stylesheet/styles.rb +1 -1
  28. data/lib/axlsx/util/constants.rb +4 -0
  29. data/lib/axlsx/util/simple_typed_list.rb +2 -2
  30. data/lib/axlsx/util/validators.rb +2 -2
  31. data/lib/axlsx/version.rb +1 -1
  32. data/lib/axlsx/workbook/workbook.rb +1 -2
  33. data/lib/axlsx/workbook/worksheet/cell.rb +1 -1
  34. data/lib/axlsx/workbook/worksheet/data_bar.rb +1 -1
  35. data/lib/axlsx/workbook/worksheet/page_setup.rb +9 -0
  36. data/lib/axlsx/workbook/worksheet/protected_range.rb +46 -0
  37. data/lib/axlsx/workbook/worksheet/worksheet.rb +180 -56
  38. data/test/content_type/tc_content_type.rb +1 -6
  39. data/test/doc_props/tc_core.rb +1 -1
  40. data/test/drawing/tc_axis.rb +8 -0
  41. data/test/drawing/tc_bar_3D_chart.rb +12 -12
  42. data/test/drawing/tc_bar_series.rb +0 -1
  43. data/test/drawing/tc_chart.rb +1 -5
  44. data/test/drawing/tc_pie_3D_chart.rb +3 -7
  45. data/test/drawing/tc_view_3D.rb +18 -18
  46. data/test/tc_package.rb +2 -0
  47. data/test/workbook/worksheet/tc_page_setup.rb +20 -3
  48. data/test/workbook/worksheet/tc_protected_range.rb +18 -0
  49. data/test/workbook/worksheet/tc_selection.rb +1 -1
  50. data/test/workbook/worksheet/tc_worksheet.rb +39 -18
  51. metadata +54 -103
  52. data/examples/axis-titles.xlsx +0 -0
  53. data/examples/basic_charts.xlsx +0 -0
  54. data/examples/chart_colors.xlsx +0 -0
  55. data/examples/charts.xlsx +0 -0
  56. data/examples/conditional_formatting/getting_barred.xlsx +0 -0
  57. data/examples/doc/_index.html +0 -84
  58. data/examples/doc/class_list.html +0 -47
  59. data/examples/doc/css/common.css +0 -1
  60. data/examples/doc/css/full_list.css +0 -55
  61. data/examples/doc/css/style.css +0 -322
  62. data/examples/doc/file_list.html +0 -46
  63. data/examples/doc/frames.html +0 -13
  64. data/examples/doc/index.html +0 -84
  65. data/examples/doc/js/app.js +0 -205
  66. data/examples/doc/js/full_list.js +0 -173
  67. data/examples/doc/js/jquery.js +0 -16
  68. data/examples/doc/method_list.html +0 -46
  69. data/examples/doc/top-level-namespace.html +0 -95
  70. data/examples/example.xlsx +0 -0
  71. data/examples/example_streamed.xlsx +0 -0
  72. data/examples/examples_saved.xlsx +0 -0
  73. data/examples/extractive.xlsx +0 -0
  74. data/examples/fish.xlsx +0 -0
  75. data/examples/no-use_autowidth.xlsx +0 -0
  76. data/examples/pareto.rb +0 -28
  77. data/examples/pareto.xlsx +0 -0
  78. data/examples/pie_chart_excel.xlsx +0 -0
  79. data/examples/pie_chart_saved.xlsx +0 -0
  80. data/examples/shared_strings_example.xlsx +0 -0
  81. data/examples/sheet_protection.xlsx +0 -0
  82. data/examples/sheet_view.xlsx +0 -0
  83. data/examples/two_cell_anchor_image.xlsx +0 -0
  84. data/examples/~$example.xlsx +0 -0
  85. data/lib/axlsx/drawing/ax_data_source.rb~ +0 -55
  86. data/lib/axlsx/drawing/data_source.rb~ +0 -51
  87. data/lib/axlsx/drawing/hlink_click.rb~ +0 -0
  88. data/lib/axlsx/drawing/hyperlink.rb~ +0 -64
  89. data/lib/axlsx/drawing/num_data.rb~ +0 -51
  90. data/lib/axlsx/drawing/num_data_source.rb~ +0 -54
  91. data/lib/axlsx/drawing/num_val.rb~ +0 -40
  92. data/lib/axlsx/drawing/picture_locking.rb~ +0 -36
  93. data/lib/axlsx/drawing/ref.rb~ +0 -41
  94. data/lib/axlsx/drawing/str_data.rb~ +0 -58
  95. data/lib/axlsx/drawing/str_val.rb~ +0 -35
  96. data/lib/axlsx/drawing/vml_drawing.rb~ +0 -6
  97. data/lib/axlsx/drawing/vml_shape.rb~ +0 -61
  98. data/lib/axlsx/util/cbf.rb +0 -333
  99. data/lib/axlsx/util/cfb.rb~ +0 -201
  100. data/lib/axlsx/util/font_tables.rb~ +0 -0
  101. data/lib/axlsx/util/ms_off_crypto.rb +0 -189
  102. data/lib/axlsx/util/ms_off_crypto.rb~ +0 -3
  103. data/lib/axlsx/util/ms_offcrypto.rb~ +0 -0
  104. data/lib/axlsx/util/parser.rb~ +0 -6
  105. data/lib/axlsx/util/storage.rb~ +0 -0
  106. data/lib/axlsx/workbook/shared_strings_table.rb~ +0 -69
  107. data/lib/axlsx/workbook/worksheet/cfvo.rb~ +0 -0
  108. data/lib/axlsx/workbook/worksheet/col.rb~ +0 -0
  109. data/lib/axlsx/workbook/worksheet/color_scale.rb~ +0 -46
  110. data/lib/axlsx/workbook/worksheet/comment.rb~ +0 -91
  111. data/lib/axlsx/workbook/worksheet/comments.rb~ +0 -86
  112. data/lib/axlsx/workbook/worksheet/data_bar.rb~ +0 -0
  113. data/lib/axlsx/workbook/worksheet/icon_set.rb~ +0 -95
  114. data/lib/axlsx/workbook/worksheet/shared_strings_table.rb~ +0 -0
  115. data/lib/axlsx/workbook/worksheet/table.rb~ +0 -97
  116. data/lib/schema/dc.xsd~ +0 -118
  117. data/lib/schema/dcterms.xsd~ +0 -331
  118. data/lib/schema/opc-coreProperties.xsd~ +0 -50
  119. data/test/drawing/tc_data_source.rb~ +0 -30
  120. data/test/drawing/tc_num_data.rb~ +0 -35
  121. data/test/drawing/tc_num_val.rb~ +0 -29
  122. data/test/drawing/tc_str_data.rb~ +0 -30
  123. data/test/drawing/tc_str_val.rb~ +0 -26
  124. data/test/drawing/tc_vml_drawing.rb~ +0 -0
  125. data/test/workbook/worksheet/table/tc_table.rb~ +0 -72
  126. data/test/workbook/worksheet/tc_cfvo.rb~ +0 -20
  127. data/test/workbook/worksheet/tc_col.rb~ +0 -10
  128. data/test/workbook/worksheet/tc_color_scale.rb~ +0 -0
  129. data/test/workbook/worksheet/tc_data_bar.rb~ +0 -0
  130. data/test/workbook/worksheet/tc_icon_set.rb~ +0 -0
@@ -1,8 +1,23 @@
1
1
  # encoding: UTF-8
2
2
  module Axlsx
3
+
3
4
  # An override content part. These parts are automatically created by for you based on the content of your package.
4
5
  class Override
5
6
 
7
+ #Creates a new Override object
8
+ # @option options [String] PartName
9
+ # @option options [String] ContentType
10
+ # @raise [ArgumentError] An argument error is raised if both PartName and ContentType are not specified.
11
+ def initialize(options={})
12
+ raise ArgumentError, INVALID_ARGUMENTS unless validate_options(options)
13
+ options.each do |name, value|
14
+ self.send("#{name}=", value) if self.respond_to? "#{name}="
15
+ end
16
+ end
17
+
18
+ # Error message for invalid options
19
+ INVALID_ARGUMENTS = 'part_name and content_type are required'
20
+
6
21
  # The type of content.
7
22
  # @return [String]
8
23
  attr_reader :content_type
@@ -13,17 +28,6 @@ module Axlsx
13
28
  attr_reader :part_name
14
29
  alias :PartName :part_name
15
30
 
16
- #Creates a new Override object
17
- # @option options [String] PartName
18
- # @option options [String] ContentType
19
- # @raise [ArgumentError] An argument error is raised if both PartName and ContentType are not specified.
20
- def initialize(options={})
21
- raise ArgumentError, "PartName and ContentType are required" unless (options[:PartName] || options[:part_name]) && (options[:ContentType] || options[:content_type])
22
- options.each do |o|
23
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
24
- end
25
- end
26
-
27
31
  # The name and location of the part.
28
32
  def part_name=(v) Axlsx::validate_string v; @part_name = v end
29
33
  alias :PartName= :part_name=
@@ -42,5 +46,12 @@ module Axlsx
42
46
  str << '/>'
43
47
  end
44
48
 
49
+ private
50
+
51
+ def validate_options(options)
52
+ (options[:PartName] || options[:part_name]) && (options[:ContentType] || options[:content_type])
53
+ end
54
+
45
55
  end
56
+
46
57
  end
@@ -1,5 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  module Axlsx
3
+
3
4
  # App represents the app.xml document. The attributes for this object are primarily managed by the application the end user uses to edit the document. None of the attributes are required to serialize a valid xlsx object.
4
5
  # @see shared-documentPropertiesExtended.xsd
5
6
  # @note Support is not implemented for the following complex types:
@@ -10,6 +11,35 @@ module Axlsx
10
11
  # DigSig (DigSigBlob)
11
12
  class App
12
13
 
14
+ # Creates an App object
15
+ # @option options [String] template
16
+ # @option options [String] manager
17
+ # @option options [Integer] pages
18
+ # @option options [Integer] words
19
+ # @option options [Integer] characters
20
+ # @option options [String] presentation_format
21
+ # @option options [Integer] lines
22
+ # @option options [Integer] paragraphs
23
+ # @option options [Integer] slides
24
+ # @option options [Integer] notes
25
+ # @option options [Integer] total_time
26
+ # @option options [Integer] hidden_slides
27
+ # @option options [Integer] m_m_clips
28
+ # @option options [Boolean] scale_crop
29
+ # @option options [Boolean] links_up_to_date
30
+ # @option options [Integer] characters_with_spaces
31
+ # @option options [Boolean] share_doc
32
+ # @option options [String] hyperlink_base
33
+ # @option options [String] hyperlinks_changed
34
+ # @option options [String] application
35
+ # @option options [String] app_version
36
+ # @option options [Integer] doc_security
37
+ def initialize(options={})
38
+ options.each do |name, value|
39
+ self.send("#{name}=", value) if self.respond_to? "#{name}="
40
+ end
41
+ end
42
+
13
43
  # @return [String] The name of the document template.
14
44
  attr_reader :template
15
45
  alias :Template :template
@@ -89,7 +119,7 @@ module Axlsx
89
119
  # @return [Boolean] Indicates that the hyper links in the document have been changed.
90
120
  attr_reader :hyperlinks_changed
91
121
  alias :HyperlinksChanged :hyperlinks_changed
92
-
122
+
93
123
  # @return [String] The name of the application
94
124
  attr_reader :application
95
125
  alias :Applicatoin :application
@@ -102,44 +132,17 @@ module Axlsx
102
132
  attr_reader :doc_security
103
133
  alias :DocSecurity :doc_security
104
134
 
105
- # Creates an App object
106
- # @option options [String] template
107
- # @option options [String] manager
108
- # @option options [Integer] pages
109
- # @option options [Integer] words
110
- # @option options [Integer] characters
111
- # @option options [String] presentation_format
112
- # @option options [Integer] lines
113
- # @option options [Integer] paragraphs
114
- # @option options [Integer] slides
115
- # @option options [Integer] notes
116
- # @option options [Integer] total_time
117
- # @option options [Integer] hidden_slides
118
- # @option options [Integer] m_m_clips
119
- # @option options [Boolean] scale_crop
120
- # @option options [Boolean] links_up_to_date
121
- # @option options [Integer] characters_with_spaces
122
- # @option options [Boolean] share_doc
123
- # @option options [String] hyperlink_base
124
- # @option options [String] hyperlinks_changed
125
- # @option options [String] application
126
- # @option options [String] app_version
127
- # @option options [Integer] doc_security
128
- def initialize(options={})
129
- options.each do |o|
130
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
131
- end
132
- end
133
-
134
135
  # Sets the template property of your app.xml file
135
136
  def template=(v) Axlsx::validate_string v; @template = v; end
137
+ alias :Template :template
136
138
 
137
139
  # Sets the manager property of your app.xml file
138
140
  def manager=(v) Axlsx::validate_string v; @manager = v; end
141
+ alias :Manager :manager
139
142
 
140
143
  # Sets the company property of your app.xml file
141
144
  def company=(v) Axlsx::validate_string v; @company = v; end
142
-
145
+ alias :Company :company
143
146
  # Sets the pages property of your app.xml file
144
147
  def pages=(v) Axlsx::validate_int v; @pages = v; end
145
148
 
@@ -214,7 +217,7 @@ module Axlsx
214
217
  # Sets the doc_security property of your app.xml file
215
218
  def doc_security=(v) Axlsx::validate_int v; @doc_security = v; end
216
219
  alias :DocSecurity= :doc_security=
217
-
220
+
218
221
  # Serialize the app.xml document
219
222
  # @return [String]
220
223
  def to_xml_string(str = '')
@@ -225,4 +228,5 @@ module Axlsx
225
228
  end
226
229
 
227
230
  end
231
+
228
232
  end
@@ -1,19 +1,21 @@
1
1
  # encoding: UTF-8
2
2
  module Axlsx
3
+
3
4
  # The core object for the package.
4
5
  # @note Packages manage their own core object.
5
6
  # @see Package#core
6
7
  class Core
7
- # The author of the document. By default this is 'axlsx'
8
- # @return [String]
9
- attr_accessor :creator
10
-
8
+
11
9
  # Creates a new Core object.
12
10
  # @option options [String] creator
13
11
  def initialize(options={})
14
12
  @creator = options[:creator] || 'axlsx'
15
13
  end
16
14
 
15
+ # The author of the document. By default this is 'axlsx'
16
+ # @return [String]
17
+ attr_accessor :creator
18
+
17
19
  # serializes the core.xml document
18
20
  # @return [String]
19
21
  def to_xml_string(str = '')
@@ -22,9 +24,11 @@ module Axlsx
22
24
  str << 'xmlns:dcmitype="' << CORE_NS_DCMIT << '" xmlns:dcterms="' << CORE_NS_DCT << '" '
23
25
  str << 'xmlns:xsi="' << CORE_NS_XSI << '">'
24
26
  str << '<dc:creator>' << self.creator << '</dc:creator>'
25
- str << '<dcterms:created xsi:type="dcterms:W3CDTF">' << Time.now.strftime('%Y-%m-%dT%H:%M:%S') << '</dcterms:created>'
27
+ str << '<dcterms:created xsi:type="dcterms:W3CDTF">' << Time.now.strftime('%Y-%m-%dT%H:%M:%S') << 'Z</dcterms:created>'
26
28
  str << '<cp:revision>0</cp:revision>'
27
29
  str << '</cp:coreProperties>'
28
30
  end
31
+
29
32
  end
33
+
30
34
  end
@@ -1,14 +1,9 @@
1
1
  module Axlsx
2
+
2
3
  # An axis data source that can contain referenced or literal strings or numbers
3
4
  # @note only string data types are supported - mainly because we have not implemented a chart type that requires a numerical axis value
4
5
  class AxDataSource < NumDataSource
5
6
 
6
- # allowed element tag names
7
- # @return [Array]
8
- def self.allowed_tag_names
9
- [:xVal, :cat]
10
- end
11
-
12
7
  # creates a new NumDataSource object
13
8
  # @option options [Array] data An array of Cells or Numeric objects
14
9
  # @option options [Symbol] tag_name see tag_name
@@ -19,6 +14,12 @@ module Axlsx
19
14
  super(options)
20
15
  end
21
16
 
17
+ # allowed element tag names for serialization
18
+ # @return [Array]
19
+ def self.allowed_tag_names
20
+ [:xVal, :cat]
21
+ end
22
+
22
23
  end
23
24
 
24
25
  end
@@ -1,8 +1,40 @@
1
1
  # encoding: UTF-8
2
2
  module Axlsx
3
- # the access class defines common properties and values for a chart axis.
3
+
4
+ # the access class defines common properties and values for a chart axis.
4
5
  class Axis
5
6
 
7
+ # Creates an Axis object
8
+ # @param [Integer] ax_id the id of this axis
9
+ # @param [Integer] cross_ax the id of the perpendicular axis
10
+ # @option options [Symbol] ax_pos
11
+ # @option options [Symbol] crosses
12
+ # @option options [Symbol] tick_lbl_pos
13
+ # @raise [ArgumentError] If axi_id or cross_ax are not unsigned integers
14
+ def initialize(ax_id, cross_ax, options={})
15
+ Axlsx::validate_unsigned_int(ax_id)
16
+ Axlsx::validate_unsigned_int(cross_ax)
17
+ @ax_id = ax_id
18
+ @cross_ax = cross_ax
19
+ @format_code = "General"
20
+ @delete = @label_rotation = 0
21
+ @scaling = Scaling.new(:orientation=>:minMax)
22
+ @title = @color = nil
23
+ self.ax_pos = :b
24
+ self.tick_lbl_pos = :nextTo
25
+ self.format_code = "General"
26
+ self.crosses = :autoZero
27
+ self.gridlines = true
28
+ options.each do |name, value|
29
+ self.send("#{name}=", value) if self.respond_to? "#{name}="
30
+ end
31
+ end
32
+
33
+ # the fill color to use in the axis shape properties. This should be a 6 character long hex string
34
+ # e.g. FF0000 for red
35
+ # @return [String]
36
+ attr_reader :color
37
+
6
38
  # the id of the axis.
7
39
  # @return [Integer]
8
40
  attr_reader :ax_id
@@ -55,30 +87,12 @@ module Axlsx
55
87
  # the title for the axis. This can be a cell or a fixed string.
56
88
  attr_reader :title
57
89
 
58
- # Creates an Axis object
59
- # @param [Integer] ax_id the id of this axis
60
- # @param [Integer] cross_ax the id of the perpendicular axis
61
- # @option options [Symbol] ax_pos
62
- # @option options [Symbol] crosses
63
- # @option options [Symbol] tick_lbl_pos
64
- # @raise [ArgumentError] If axi_id or cross_ax are not unsigned integers
65
- def initialize(ax_id, cross_ax, options={})
66
- Axlsx::validate_unsigned_int(ax_id)
67
- Axlsx::validate_unsigned_int(cross_ax)
68
- @ax_id = ax_id
69
- @cross_ax = cross_ax
70
- @format_code = "General"
71
- @delete = @label_rotation = 0
72
- @scaling = Scaling.new(:orientation=>:minMax)
73
- @title = nil
74
- self.ax_pos = :b
75
- self.tick_lbl_pos = :nextTo
76
- self.format_code = "General"
77
- self.crosses = :autoZero
78
- self.gridlines = true
79
- options.each do |o|
80
- self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
81
- end
90
+ # The color for this axis. This value is used when rendering the axis line in the chart.
91
+ # colors should be in 6 character rbg format
92
+ # @return [String] the rbg color assinged.
93
+ # @see color
94
+ def color=(color_rgb)
95
+ @color = color_rgb
82
96
  end
83
97
 
84
98
  # The position of the axis
@@ -99,7 +113,6 @@ module Axlsx
99
113
  # default true
100
114
  def gridlines=(v) Axlsx::validate_boolean(v); @gridlines = v; end
101
115
 
102
-
103
116
  # Specify if axis should be removed from the chart
104
117
  # default false
105
118
  def delete=(v) Axlsx::validate_boolean(v); @delete = v; end
@@ -117,7 +130,6 @@ module Axlsx
117
130
  @label_rotation = adjusted
118
131
  end
119
132
 
120
-
121
133
  # The title object for the chart.
122
134
  # @param [String, Cell] v
123
135
  # @return [Title]
@@ -140,6 +152,7 @@ module Axlsx
140
152
  str << '<c:delete val="'<< @delete.to_s << '"/>'
141
153
  str << '<c:axPos val="' << @ax_pos.to_s << '"/>'
142
154
  str << '<c:majorGridlines>'
155
+ # TODO shape properties need to be extracted into a class
143
156
  if gridlines == false
144
157
  str << '<c:spPr>'
145
158
  str << '<a:ln>'
@@ -153,6 +166,13 @@ module Axlsx
153
166
  str << '<c:majorTickMark val="none"/>'
154
167
  str << '<c:minorTickMark val="none"/>'
155
168
  str << '<c:tickLblPos val="' << @tick_lbl_pos.to_s << '"/>'
169
+ # TODO - this is also being used for series colors
170
+ # time to extract this into a class spPr - Shape Properties
171
+ if @color
172
+ str << '<c:spPr><a:ln><a:solidFill>'
173
+ str << '<a:srgbClr val="' << @color << '"/>'
174
+ str << '</a:solidFill></a:ln></c:spPr>'
175
+ end
156
176
  # some potential value in implementing this in full. Very detailed!
157
177
  str << '<c:txPr><a:bodyPr rot="' << @label_rotation.to_s << '"/><a:lstStyle/><a:p><a:pPr><a:defRPr/></a:pPr><a:endParaRPr/></a:p></c:txPr>'
158
178
  str << '<c:crossAx val="' << @cross_ax.to_s << '"/>'
@@ -160,4 +180,5 @@ module Axlsx
160
180
  end
161
181
 
162
182
  end
183
+
163
184
  end
@@ -10,24 +10,29 @@ module Axlsx
10
10
 
11
11
  # the category axis
12
12
  # @return [CatAxis]
13
- attr_reader :catAxis
13
+ attr_reader :cat_axis
14
+ alias :catAxis :cat_axis
14
15
 
15
- # the valueaxis
16
+ # the value axis
16
17
  # @return [ValAxis]
17
- attr_reader :valAxis
18
+ attr_reader :val_axis
19
+ alias :valAxis :val_axis
18
20
 
19
21
  # The direction of the bars in the chart
20
22
  # must be one of [:bar, :col]
21
23
  # @return [Symbol]
22
- attr_reader :barDir
24
+ attr_reader :bar_dir
25
+ alias :barDir :bar_dir
23
26
 
24
27
  # space between bar or column clusters, as a percentage of the bar or column width.
25
28
  # @return [String]
26
- attr_reader :gapDepth
29
+ attr_reader :gap_depth
30
+ alias :gapDepth :gap_depth
27
31
 
28
32
  # space between bar or column clusters, as a percentage of the bar or column width.
29
33
  # @return [String]
30
- attr_reader :gapWidth
34
+ attr_reader :gap_width
35
+ alias :gapWidth :gap_width
31
36
 
32
37
  #grouping for a column, line, or area chart.
33
38
  # must be one of [:percentStacked, :clustered, :standard, :stacked]
@@ -46,38 +51,41 @@ module Axlsx
46
51
  # @param [GraphicFrame] frame The workbook that owns this chart.
47
52
  # @option options [Cell, String] title
48
53
  # @option options [Boolean] show_legend
49
- # @option options [Symbol] barDir
54
+ # @option options [Symbol] bar_dir
50
55
  # @option options [Symbol] grouping
51
- # @option options [String] gapWidth
52
- # @option options [String] gapDepth
56
+ # @option options [String] gap_width
57
+ # @option options [String] gap_depth
53
58
  # @option options [Symbol] shape
54
- # @option options [Integer] rotX
55
- # @option options [String] hPercent
56
- # @option options [Integer] rotY
57
- # @option options [String] depthPercent
58
- # @option options [Boolean] rAngAx
59
+ # @option options [Integer] rot_x
60
+ # @option options [String] h_percent
61
+ # @option options [Integer] rot_y
62
+ # @option options [String] depth_percent
63
+ # @option options [Boolean] r_ang_ax
59
64
  # @option options [Integer] perspective
60
65
  # @see Chart
61
66
  # @see View3D
62
67
  def initialize(frame, options={})
63
- @barDir = :bar
68
+ @bar_dir = :bar
64
69
  @grouping = :clustered
65
- @gapWidth, @gapDepth, @shape = nil, nil, nil
66
- @catAxId = rand(8 ** 8)
67
- @valAxId = rand(8 ** 8)
68
- @catAxis = CatAxis.new(@catAxId, @valAxId)
69
- @valAxis = ValAxis.new(@valAxId, @catAxId, :tickLblPos => :low)
70
+ @shape = :box
71
+ @gap_width = 150
72
+ @gap_width, @gap_depth, @shape = nil, nil, nil
73
+ @cat_ax_id = rand(8 ** 8)
74
+ @val_ax_id = rand(8 ** 8)
75
+ @cat_axis = CatAxis.new(@cat_ax_id, @val_ax_id)
76
+ @val_axis = ValAxis.new(@val_ax_id, @cat_ax_id, :tick_lbl_pos => :low, :ax_pos => :l)
70
77
  super(frame, options)
71
78
  @series_type = BarSeries
72
- @view3D = View3D.new({:rAngAx=>1}.merge(options))
79
+ @view_3D = View3D.new({:r_ang_ax=>1}.merge(options))
73
80
  end
74
81
 
75
82
  # The direction of the bars in the chart
76
83
  # must be one of [:bar, :col]
77
- def barDir=(v)
78
- RestrictionValidator.validate "Bar3DChart.barDir", [:bar, :col], v
79
- @barDir = v
84
+ def bar_dir=(v)
85
+ RestrictionValidator.validate "Bar3DChart.bar_dir", [:bar, :col], v
86
+ @bar_dir = v
80
87
  end
88
+ alias :barDir= :bar_dir=
81
89
 
82
90
  #grouping for a column, line, or area chart.
83
91
  # must be one of [:percentStacked, :clustered, :standard, :stacked]
@@ -87,16 +95,18 @@ module Axlsx
87
95
  end
88
96
 
89
97
  # space between bar or column clusters, as a percentage of the bar or column width.
90
- def gapWidth=(v)
91
- RegexValidator.validate "Bar3DChart.gapWidth", GAP_AMOUNT_PERCENT, v
92
- @gapWidth=(v)
98
+ def gap_width=(v)
99
+ RegexValidator.validate "Bar3DChart.gap_width", GAP_AMOUNT_PERCENT, v
100
+ @gap_width=(v)
93
101
  end
102
+ alias :gapWidth= :gap_width=
94
103
 
95
104
  # space between bar or column clusters, as a percentage of the bar or column width.
96
- def gapDepth=(v)
97
- RegexValidator.validate "Bar3DChart.gapWidth", GAP_AMOUNT_PERCENT, v
98
- @gapDepth=(v)
105
+ def gap_depth=(v)
106
+ RegexValidator.validate "Bar3DChart.gap_didth", GAP_AMOUNT_PERCENT, v
107
+ @gap_depth=(v)
99
108
  end
109
+ alias :gapDepth= :gap_depth=
100
110
 
101
111
  # The shabe of the bars or columns
102
112
  # must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]
@@ -111,7 +121,7 @@ module Axlsx
111
121
  def to_xml_string(str = '')
112
122
  super(str) do |str_inner|
113
123
  str_inner << '<c:bar3DChart>'
114
- str_inner << '<c:barDir val="' << barDir.to_s << '"/>'
124
+ str_inner << '<c:barDir val="' << bar_dir.to_s << '"/>'
115
125
  str_inner << '<c:grouping val="' << grouping.to_s << '"/>'
116
126
  str_inner << '<c:varyColors val="1"/>'
117
127
  @series.each { |ser| ser.to_xml_string(str_inner) }
@@ -123,15 +133,15 @@ module Axlsx
123
133
  str_inner << '<c:showPercent val="0"/>'
124
134
  str_inner << '<c:showBubbleSize val="0"/>'
125
135
  str_inner << '</c:dLbls>'
126
- str_inner << '<c:gapWidth val="' << @gapWidth.to_s << '"/>' unless @gapWidth.nil?
127
- str_inner << '<c:gapDepth val="' << @gapDepth.to_s << '"/>' unless @gapDepth.nil?
136
+ str_inner << '<c:gapWidth val="' << @gap_width.to_s << '"/>' unless @gap_width.nil?
137
+ str_inner << '<c:gapDepth val="' << @gap_depth.to_s << '"/>' unless @gap_depth.nil?
128
138
  str_inner << '<c:shape val="' << @shape.to_s << '"/>' unless @shape.nil?
129
- str_inner << '<c:axId val="' << @catAxId.to_s << '"/>'
130
- str_inner << '<c:axId val="' << @valAxId.to_s << '"/>'
139
+ str_inner << '<c:axId val="' << @cat_ax_id.to_s << '"/>'
140
+ str_inner << '<c:axId val="' << @val_ax_id.to_s << '"/>'
131
141
  str_inner << '<c:axId val="0"/>'
132
142
  str_inner << '</c:bar3DChart>'
133
- @catAxis.to_xml_string str_inner
134
- @valAxis.to_xml_string str_inner
143
+ @cat_axis.to_xml_string str_inner
144
+ @val_axis.to_xml_string str_inner
135
145
  end
136
146
  end
137
147
  end