axlsx 1.0.11 → 1.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +4 -0
- data/README.md +7 -4
- data/examples/example.rb +6 -4
- data/examples/example.rb~ +112 -0
- data/lib/schema/dc.xsd~ +118 -0
- data/lib/schema/dcterms.xsd~ +331 -0
- data/lib/schema/opc-coreProperties.xsd~ +50 -0
- metadata +43 -193
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -29
- data/axlsx.gemspec +0 -42
- data/doc/Axlsx.html +0 -2718
- data/doc/Axlsx/App.html +0 -2640
- data/doc/Axlsx/Axis.html +0 -1075
- data/doc/Axlsx/Bar3DChart.html +0 -1182
- data/doc/Axlsx/BarSeries.html +0 -711
- data/doc/Axlsx/Border.html +0 -779
- data/doc/Axlsx/BorderPr.html +0 -709
- data/doc/Axlsx/CatAxis.html +0 -769
- data/doc/Axlsx/CatAxisData.html +0 -397
- data/doc/Axlsx/Cell.html +0 -3187
- data/doc/Axlsx/CellAlignment.html +0 -1247
- data/doc/Axlsx/CellProtection.html +0 -565
- data/doc/Axlsx/CellStyle.html +0 -949
- data/doc/Axlsx/Chart.html +0 -1692
- data/doc/Axlsx/Color.html +0 -670
- data/doc/Axlsx/ContentType.html +0 -335
- data/doc/Axlsx/Core.html +0 -465
- data/doc/Axlsx/DataTypeValidator.html +0 -324
- data/doc/Axlsx/Default.html +0 -565
- data/doc/Axlsx/Drawing.html +0 -1264
- data/doc/Axlsx/Fill.html +0 -460
- data/doc/Axlsx/Font.html +0 -1554
- data/doc/Axlsx/GradientFill.html +0 -1026
- data/doc/Axlsx/GradientStop.html +0 -526
- data/doc/Axlsx/GraphicFrame.html +0 -642
- data/doc/Axlsx/Line3DChart.html +0 -1004
- data/doc/Axlsx/LineSeries.html +0 -605
- data/doc/Axlsx/Marker.html +0 -857
- data/doc/Axlsx/NumFmt.html +0 -562
- data/doc/Axlsx/OneCellAnchor.html +0 -982
- data/doc/Axlsx/Override.html +0 -552
- data/doc/Axlsx/Package.html +0 -825
- data/doc/Axlsx/Parser.html +0 -549
- data/doc/Axlsx/PatternFill.html +0 -681
- data/doc/Axlsx/Pic.html +0 -1701
- data/doc/Axlsx/PictureLocking.html +0 -1159
- data/doc/Axlsx/Pie3DChart.html +0 -489
- data/doc/Axlsx/PieSeries.html +0 -710
- data/doc/Axlsx/RegexValidator.html +0 -268
- data/doc/Axlsx/Relationship.html +0 -554
- data/doc/Axlsx/Relationships.html +0 -338
- data/doc/Axlsx/RestrictionValidator.html +0 -300
- data/doc/Axlsx/Row.html +0 -916
- data/doc/Axlsx/Scaling.html +0 -742
- data/doc/Axlsx/SerAxis.html +0 -641
- data/doc/Axlsx/Series.html +0 -813
- data/doc/Axlsx/SeriesTitle.html +0 -290
- data/doc/Axlsx/Styles.html +0 -1754
- data/doc/Axlsx/TableStyle.html +0 -705
- data/doc/Axlsx/TableStyleElement.html +0 -677
- data/doc/Axlsx/TableStyles.html +0 -594
- data/doc/Axlsx/Title.html +0 -543
- data/doc/Axlsx/TwoCellAnchor.html +0 -973
- data/doc/Axlsx/ValAxis.html +0 -538
- data/doc/Axlsx/ValAxisData.html +0 -321
- data/doc/Axlsx/View3D.html +0 -973
- data/doc/Axlsx/Workbook.html +0 -1630
- data/doc/Axlsx/Worksheet.html +0 -2682
- data/doc/Axlsx/Xf.html +0 -1780
- data/doc/_index.html +0 -649
- data/doc/class_list.html +0 -47
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -55
- data/doc/css/style.css +0 -322
- data/doc/file.LICENSE.html +0 -91
- data/doc/file.README.html +0 -338
- data/doc/file_list.html +0 -52
- data/doc/frames.html +0 -13
- data/doc/index.html +0 -338
- data/doc/js/app.js +0 -205
- data/doc/js/full_list.js +0 -167
- data/doc/js/jquery.js +0 -16
- data/doc/method_list.html +0 -3502
- data/doc/top-level-namespace.html +0 -103
- data/lib/axlsx.rb +0 -54
- data/lib/axlsx/content_type/content_type.rb +0 -23
- data/lib/axlsx/content_type/default.rb +0 -37
- data/lib/axlsx/content_type/override.rb +0 -37
- data/lib/axlsx/doc_props/app.rb +0 -178
- data/lib/axlsx/doc_props/core.rb +0 -34
- data/lib/axlsx/drawing/axis.rb +0 -90
- data/lib/axlsx/drawing/bar_3D_chart.rb +0 -128
- data/lib/axlsx/drawing/bar_series.rb +0 -64
- data/lib/axlsx/drawing/cat_axis.rb +0 -63
- data/lib/axlsx/drawing/cat_axis_data.rb +0 -35
- data/lib/axlsx/drawing/chart.rb +0 -179
- data/lib/axlsx/drawing/drawing.rb +0 -137
- data/lib/axlsx/drawing/graphic_frame.rb +0 -52
- data/lib/axlsx/drawing/line_3D_chart.rb +0 -106
- data/lib/axlsx/drawing/line_series.rb +0 -46
- data/lib/axlsx/drawing/marker.rb +0 -61
- data/lib/axlsx/drawing/one_cell_anchor.rb +0 -89
- data/lib/axlsx/drawing/pic.rb +0 -153
- data/lib/axlsx/drawing/picture_locking.rb +0 -72
- data/lib/axlsx/drawing/pie_3D_chart.rb +0 -41
- data/lib/axlsx/drawing/pie_series.rb +0 -56
- data/lib/axlsx/drawing/scaling.rb +0 -59
- data/lib/axlsx/drawing/ser_axis.rb +0 -45
- data/lib/axlsx/drawing/series.rb +0 -71
- data/lib/axlsx/drawing/series_title.rb +0 -22
- data/lib/axlsx/drawing/title.rb +0 -61
- data/lib/axlsx/drawing/two_cell_anchor.rb +0 -76
- data/lib/axlsx/drawing/val_axis.rb +0 -34
- data/lib/axlsx/drawing/val_axis_data.rb +0 -28
- data/lib/axlsx/drawing/view_3D.rb +0 -85
- data/lib/axlsx/package.rb +0 -214
- data/lib/axlsx/rels/relationship.rb +0 -44
- data/lib/axlsx/rels/relationships.rb +0 -25
- data/lib/axlsx/stylesheet/border.rb +0 -57
- data/lib/axlsx/stylesheet/border_pr.rb +0 -68
- data/lib/axlsx/stylesheet/cell_alignment.rb +0 -105
- data/lib/axlsx/stylesheet/cell_protection.rb +0 -36
- data/lib/axlsx/stylesheet/cell_style.rb +0 -65
- data/lib/axlsx/stylesheet/color.rb +0 -69
- data/lib/axlsx/stylesheet/fill.rb +0 -32
- data/lib/axlsx/stylesheet/font.rb +0 -139
- data/lib/axlsx/stylesheet/gradient_fill.rb +0 -76
- data/lib/axlsx/stylesheet/gradient_stop.rb +0 -33
- data/lib/axlsx/stylesheet/num_fmt.rb +0 -63
- data/lib/axlsx/stylesheet/pattern_fill.rb +0 -66
- data/lib/axlsx/stylesheet/styles.rb +0 -298
- data/lib/axlsx/stylesheet/table_style.rb +0 -47
- data/lib/axlsx/stylesheet/table_style_element.rb +0 -71
- data/lib/axlsx/stylesheet/table_styles.rb +0 -39
- data/lib/axlsx/stylesheet/xf.rb +0 -138
- data/lib/axlsx/util/constants.rb +0 -216
- data/lib/axlsx/util/parser.rb +0 -43
- data/lib/axlsx/util/simple_typed_list.rb +0 -160
- data/lib/axlsx/util/validators.rb +0 -132
- data/lib/axlsx/version.rb +0 -4
- data/lib/axlsx/workbook/workbook.rb +0 -160
- data/lib/axlsx/workbook/worksheet/cell.rb +0 -340
- data/lib/axlsx/workbook/worksheet/row.rb +0 -107
- data/lib/axlsx/workbook/worksheet/worksheet.rb +0 -278
data/lib/axlsx/drawing/pic.rb
DELETED
@@ -1,153 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
module Axlsx
|
3
|
-
# a Pic object represents an image in your worksheet
|
4
|
-
# Worksheet#add_image is the recommended way to manage images in your sheets
|
5
|
-
# @see Worksheet#add_image
|
6
|
-
class Pic
|
7
|
-
|
8
|
-
# allowed file extenstions
|
9
|
-
ALLOWED_EXTENSIONS = ['gif', 'jpeg', 'png', 'jpg']
|
10
|
-
|
11
|
-
# The name to use for this picture
|
12
|
-
# @return [String]
|
13
|
-
attr_reader :name
|
14
|
-
|
15
|
-
|
16
|
-
# A description of the picture
|
17
|
-
# @return [String]
|
18
|
-
attr_reader :descr
|
19
|
-
|
20
|
-
# The path to the image you want to include
|
21
|
-
# Only local images are supported at this time and only jpg support
|
22
|
-
# @return [String]
|
23
|
-
attr_reader :image_src
|
24
|
-
|
25
|
-
# The anchor for this image
|
26
|
-
# @return [OneCellAnchor]
|
27
|
-
attr_reader :anchor
|
28
|
-
|
29
|
-
# The picture locking attributes for this picture
|
30
|
-
attr_reader :picture_locking
|
31
|
-
|
32
|
-
# Creates a new Pic(ture) object
|
33
|
-
# @param [Anchor] anchor the anchor that holds this image
|
34
|
-
# @option options [String] name
|
35
|
-
# @option options [String] descr
|
36
|
-
# @option options [String] image_src
|
37
|
-
# @option options [Array] start_at
|
38
|
-
# @option options [Intger] width
|
39
|
-
# @option options [Intger] height
|
40
|
-
def initialize(anchor, options={})
|
41
|
-
@anchor = anchor
|
42
|
-
@anchor.drawing.worksheet.workbook.images << self
|
43
|
-
options.each do |o|
|
44
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
45
|
-
end
|
46
|
-
start_at(*options[:start_at]) if options[:start_at]
|
47
|
-
yield self if block_given?
|
48
|
-
@picture_locking = PictureLocking.new(options)
|
49
|
-
end
|
50
|
-
|
51
|
-
def image_src=(v)
|
52
|
-
Axlsx::validate_string(v)
|
53
|
-
RestrictionValidator.validate 'Pic.image_src', ALLOWED_EXTENSIONS, File.extname(v).delete('.')
|
54
|
-
raise ArgumentError, "File does not exist" unless File.exist?(v)
|
55
|
-
@image_src = v
|
56
|
-
end
|
57
|
-
|
58
|
-
# @see name
|
59
|
-
def name=(v) Axlsx::validate_string(v); @name = v; end
|
60
|
-
|
61
|
-
# @see descr
|
62
|
-
def descr=(v) Axlsx::validate_string(v); @descr = v; end
|
63
|
-
|
64
|
-
|
65
|
-
# The file name of image_src without any path information
|
66
|
-
# @return [String]
|
67
|
-
def file_name
|
68
|
-
File.basename(image_src) unless image_src.nil?
|
69
|
-
end
|
70
|
-
|
71
|
-
# returns the extension of image_src without the preceeding '.'
|
72
|
-
# @return [String]
|
73
|
-
def extname
|
74
|
-
File.extname(image_src).delete('.') unless image_src.nil?
|
75
|
-
end
|
76
|
-
|
77
|
-
# The index of this image in the workbooks images collections
|
78
|
-
# @return [Index]
|
79
|
-
def index
|
80
|
-
@anchor.drawing.worksheet.workbook.images.index(self)
|
81
|
-
end
|
82
|
-
|
83
|
-
# The part name for this image used in serialization and relationship building
|
84
|
-
# @return [String]
|
85
|
-
def pn
|
86
|
-
"#{IMAGE_PN % [(index+1), extname]}"
|
87
|
-
end
|
88
|
-
|
89
|
-
# providing access to the anchor's width attribute
|
90
|
-
# @param [Integer] v
|
91
|
-
# @see OneCellAnchor.width
|
92
|
-
def width
|
93
|
-
@anchor.width
|
94
|
-
end
|
95
|
-
|
96
|
-
# @see width
|
97
|
-
def width=(v)
|
98
|
-
@anchor.width = v
|
99
|
-
end
|
100
|
-
|
101
|
-
# providing access to update the anchor's height attribute
|
102
|
-
# @param [Integer] v
|
103
|
-
# @see OneCellAnchor.width
|
104
|
-
def height
|
105
|
-
@anchor.height
|
106
|
-
end
|
107
|
-
|
108
|
-
# @see height
|
109
|
-
def height=(v)
|
110
|
-
@anchor.height = v
|
111
|
-
end
|
112
|
-
|
113
|
-
# This is a short cut method to set the start anchor position
|
114
|
-
# If you need finer granularity in positioning use
|
115
|
-
# graphic_frame.anchor.from.colOff / rowOff
|
116
|
-
# @param [Integer] x The column
|
117
|
-
# @param [Integer] y The row
|
118
|
-
# @return [Marker]
|
119
|
-
def start_at(x, y)
|
120
|
-
@anchor.from.col = x
|
121
|
-
@anchor.from.row = y
|
122
|
-
end
|
123
|
-
|
124
|
-
# Serializes the picture
|
125
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
126
|
-
# @return [String]
|
127
|
-
def to_xml(xml)
|
128
|
-
xml.send('xdr:pic') {
|
129
|
-
xml.send('xdr:nvPicPr') {
|
130
|
-
xml.send('xdr:cNvPr', :id=>"2", :name=>name, :descr=>descr)
|
131
|
-
xml.send('xdr:cNvPicPr') {
|
132
|
-
picture_locking.to_xml(xml)
|
133
|
-
}
|
134
|
-
}
|
135
|
-
xml.send('xdr:blipFill') {
|
136
|
-
xml.send('a:blip', :'xmlns:r' => XML_NS_R, :'r:embed'=>"rId1")
|
137
|
-
xml.send('a:stretch') {
|
138
|
-
xml.send('a:fillRect')
|
139
|
-
}
|
140
|
-
}
|
141
|
-
xml.send('xdr:spPr') {
|
142
|
-
xml.send('a:xfrm') {
|
143
|
-
xml.send('a:off', :x=>0, :y=>0)
|
144
|
-
xml.send('a:ext', :cx=>2336800, :cy=>2161540)
|
145
|
-
}
|
146
|
-
xml.send('a:prstGeom', :prst=>:rect) {
|
147
|
-
xml.send('a:avLst')
|
148
|
-
}
|
149
|
-
}
|
150
|
-
}
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
# The picture locking class defines the locking properties for pictures in your workbook.
|
3
|
-
class PictureLocking
|
4
|
-
|
5
|
-
|
6
|
-
attr_reader :noGrp
|
7
|
-
attr_reader :noSelect
|
8
|
-
attr_reader :noRot
|
9
|
-
attr_reader :noChangeAspect
|
10
|
-
attr_reader :noMove
|
11
|
-
attr_reader :noResize
|
12
|
-
attr_reader :noEditPoints
|
13
|
-
attr_reader :noAdjustHandles
|
14
|
-
attr_reader :noChangeArrowheads
|
15
|
-
attr_reader :noChangeShapeType
|
16
|
-
|
17
|
-
# Creates a new PictureLocking object
|
18
|
-
# @option options [Boolean] noGrp
|
19
|
-
# @option options [Boolean] noSelect
|
20
|
-
# @option options [Boolean] noRot
|
21
|
-
# @option options [Boolean] noChangeAspect
|
22
|
-
# @option options [Boolean] noMove
|
23
|
-
# @option options [Boolean] noResize
|
24
|
-
# @option options [Boolean] noEditPoints
|
25
|
-
# @option options [Boolean] noAdjustHandles
|
26
|
-
# @option options [Boolean] noChangeArrowheads
|
27
|
-
# @option options [Boolean] noChangeShapeType
|
28
|
-
def initialize(options={})
|
29
|
-
@noChangeAspect = true
|
30
|
-
options.each do |o|
|
31
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# @see noGrp
|
36
|
-
def noGrp=(v) Axlsx::validate_boolean v; @noGrp = v end
|
37
|
-
|
38
|
-
# @see noSelect
|
39
|
-
def noSelect=(v) Axlsx::validate_boolean v; @noSelect = v end
|
40
|
-
|
41
|
-
# @see noRot
|
42
|
-
def noRot=(v) Axlsx::validate_boolean v; @noRot = v end
|
43
|
-
|
44
|
-
# @see noChangeAspect
|
45
|
-
def noChangeAspect=(v) Axlsx::validate_boolean v; @noChangeAspect = v end
|
46
|
-
|
47
|
-
# @see noMove
|
48
|
-
def noMove=(v) Axlsx::validate_boolean v; @noMove = v end
|
49
|
-
|
50
|
-
# @see noResize
|
51
|
-
def noResize=(v) Axlsx::validate_boolean v; @noResize = v end
|
52
|
-
|
53
|
-
# @see noEditPoints
|
54
|
-
def noEditPoints=(v) Axlsx::validate_boolean v; @noEditPoints = v end
|
55
|
-
|
56
|
-
# @see noAdjustHandles
|
57
|
-
def noAdjustHandles=(v) Axlsx::validate_boolean v; @noAdjustHandles = v end
|
58
|
-
|
59
|
-
# @see noChangeArrowheads
|
60
|
-
def noChangeArrowheads=(v) Axlsx::validate_boolean v; @noChangeArrowheads = v end
|
61
|
-
|
62
|
-
# @see noChangeShapeType
|
63
|
-
def noChangeShapeType=(v) Axlsx::validate_boolean v; @noChangeShapeType = v end
|
64
|
-
|
65
|
-
# Serializes the picture locking
|
66
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
67
|
-
# @return [String]
|
68
|
-
def to_xml(xml)
|
69
|
-
xml[:a].picLocks(self.instance_values)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
|
3
|
-
|
4
|
-
# The Pie3DChart is a three dimentional piechart (who would have guessed?) that you can add to your worksheet.
|
5
|
-
# @see Worksheet#add_chart
|
6
|
-
# @see Chart#add_series
|
7
|
-
# @see README for an example
|
8
|
-
class Pie3DChart < Chart
|
9
|
-
|
10
|
-
# Creates a new pie chart object
|
11
|
-
# @param [GraphicFrame] frame The workbook that owns this chart.
|
12
|
-
# @option options [Cell, String] title
|
13
|
-
# @option options [Boolean] show_legend
|
14
|
-
# @option options [Symbol] grouping
|
15
|
-
# @option options [String] gapDepth
|
16
|
-
# @option options [Integer] rotX
|
17
|
-
# @option options [String] hPercent
|
18
|
-
# @option options [Integer] rotY
|
19
|
-
# @option options [String] depthPercent
|
20
|
-
# @option options [Boolean] rAngAx
|
21
|
-
# @option options [Integer] perspective
|
22
|
-
# @see Chart
|
23
|
-
# @see View3D
|
24
|
-
def initialize(frame, options={})
|
25
|
-
super(frame, options)
|
26
|
-
@series_type = PieSeries
|
27
|
-
@view3D = View3D.new({:rotX=>30, :perspective=>30}.merge(options))
|
28
|
-
end
|
29
|
-
|
30
|
-
# Serializes the pie chart
|
31
|
-
# @return [String]
|
32
|
-
def to_xml
|
33
|
-
super() do |xml|
|
34
|
-
xml.send('c:pie3DChart') {
|
35
|
-
xml.send('c:varyColors', :val=>1)
|
36
|
-
@series.each { |ser| ser.to_xml(xml) }
|
37
|
-
}
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
# A PieSeries defines the data and labels and explosion for pie charts series.
|
3
|
-
# @note The recommended way to manage series is to use Chart#add_series
|
4
|
-
# @see Worksheet#add_chart
|
5
|
-
# @see Chart#add_series
|
6
|
-
class PieSeries < Series
|
7
|
-
|
8
|
-
# The data for this series.
|
9
|
-
# @return [SimpleTypedList]
|
10
|
-
attr_reader :data
|
11
|
-
|
12
|
-
# The labels for this series.
|
13
|
-
# @return [SimpleTypedList]
|
14
|
-
attr_reader :labels
|
15
|
-
|
16
|
-
# The explosion for this series
|
17
|
-
# @return [Integert]
|
18
|
-
attr_reader :explosion
|
19
|
-
|
20
|
-
# Creates a new series
|
21
|
-
# @option options [Array, SimpleTypedList] data
|
22
|
-
# @option options [Array, SimpleTypedList] labels
|
23
|
-
# @option options [String] title
|
24
|
-
# @option options [Integer] explosion
|
25
|
-
# @param [Chart] chart
|
26
|
-
def initialize(chart, options={})
|
27
|
-
@explosion = nil
|
28
|
-
super(chart, options)
|
29
|
-
self.labels = CatAxisData.new(options[:labels]) unless options[:labels].nil?
|
30
|
-
self.data = ValAxisData.new(options[:data]) unless options[:data].nil?
|
31
|
-
end
|
32
|
-
|
33
|
-
# @see explosion
|
34
|
-
def explosion=(v) Axlsx::validate_unsigned_int(v); @explosion = v; end
|
35
|
-
|
36
|
-
# Serializes the series
|
37
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
38
|
-
# @return [String]
|
39
|
-
def to_xml(xml)
|
40
|
-
super(xml) do |xml_inner|
|
41
|
-
xml_inner.send('c:explosion', :val=>@explosion) unless @explosion.nil?
|
42
|
-
@labels.to_xml(xml_inner) unless @labels.nil?
|
43
|
-
@data.to_xml(xml_inner) unless @data.nil?
|
44
|
-
end
|
45
|
-
end
|
46
|
-
private
|
47
|
-
|
48
|
-
# assigns the data for this series
|
49
|
-
def data=(v) DataTypeValidator.validate "Series.data", [SimpleTypedList], v; @data = v; end
|
50
|
-
|
51
|
-
# assigns the labels for this series
|
52
|
-
def labels=(v) DataTypeValidator.validate "Series.labels", [SimpleTypedList], v; @labels = v; end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
# The Scaling class defines axis scaling
|
3
|
-
class Scaling
|
4
|
-
|
5
|
-
# logarithmic base for a logarithmic axis.
|
6
|
-
# must be between 2 and 1000
|
7
|
-
# @return [Integer]
|
8
|
-
attr_reader :logBase
|
9
|
-
|
10
|
-
# the orientation of the axis
|
11
|
-
# must be one of [:minMax, :maxMin]
|
12
|
-
# @return [Symbol]
|
13
|
-
attr_reader :orientation
|
14
|
-
|
15
|
-
# the maximum scaling
|
16
|
-
# @return [Float]
|
17
|
-
attr_reader :max
|
18
|
-
|
19
|
-
# the minimu scaling
|
20
|
-
# @return [Float]
|
21
|
-
attr_reader :min
|
22
|
-
|
23
|
-
# creates a new Scaling object
|
24
|
-
# @option options [Integer, Fixnum] logBase
|
25
|
-
# @option options [Symbol] orientation
|
26
|
-
# @option options [Float] max
|
27
|
-
# @option options [Float] min
|
28
|
-
def initialize(options={})
|
29
|
-
@orientation = :minMax
|
30
|
-
@logBase, @min, @max = nil, nil, nil
|
31
|
-
options.each do |o|
|
32
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# @see logBase
|
37
|
-
def logBase=(v) DataTypeValidator.validate "Scaling.logBase", [Integer, Fixnum], v, lambda { |arg| arg >= 2 && arg <= 1000}; @logBase = v; end
|
38
|
-
# @see orientation
|
39
|
-
def orientation=(v) RestrictionValidator.validate "Scaling.orientation", [:minMax, :maxMin], v; @orientation = v; end
|
40
|
-
# @see max
|
41
|
-
def max=(v) DataTypeValidator.validate "Scaling.max", Float, v; @max = v; end
|
42
|
-
|
43
|
-
# @see min
|
44
|
-
def min=(v) DataTypeValidator.validate "Scaling.min", Float, v; @min = v; end
|
45
|
-
|
46
|
-
# Serializes the axId
|
47
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
48
|
-
# @return [String]
|
49
|
-
def to_xml(xml)
|
50
|
-
xml.send('c:scaling') {
|
51
|
-
xml.send('c:logBase', :val=> @logBase) unless @logBase.nil?
|
52
|
-
xml.send('c:orientation', :val=> @orientation) unless @orientation.nil?
|
53
|
-
xml.send('c:min', :val => @min) unless @min.nil?
|
54
|
-
xml.send('c:max', :val => @max) unless @max.nil?
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
end
|
59
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
#A SerAxis object defines a series axis
|
3
|
-
class SerAxis < Axis
|
4
|
-
|
5
|
-
# The number of tick lables to skip between labels
|
6
|
-
# @return [Integer]
|
7
|
-
attr_reader :tickLblSkip
|
8
|
-
|
9
|
-
# The number of tickmarks to be skipped before the next one is rendered.
|
10
|
-
# @return [Boolean]
|
11
|
-
attr_reader :tickMarkSkip
|
12
|
-
|
13
|
-
# Creates a new SerAxis object
|
14
|
-
# @param [Integer] axId the id of this axis. Inherited
|
15
|
-
# @param [Integer] crossAx the id of the perpendicular axis. Inherited
|
16
|
-
# @option options [Symbol] axPos. Inherited
|
17
|
-
# @option options [Symbol] tickLblPos. Inherited
|
18
|
-
# @option options [Symbol] crosses. Inherited
|
19
|
-
# @option options [Integer] tickLblSkip
|
20
|
-
# @option options [Integer] tickMarkSkip
|
21
|
-
def initialize(axId, crossAx, options={})
|
22
|
-
@tickLblSkip, @tickMarkSkip = nil, nil
|
23
|
-
super(axId, crossAx, options)
|
24
|
-
end
|
25
|
-
|
26
|
-
# @see tickLblSkip
|
27
|
-
def tickLblSkip=(v) Axlsx::validate_unsigned_int(v); @tickLblSkip = v; end
|
28
|
-
|
29
|
-
# @see tickMarkSkip
|
30
|
-
def tickMarkSkip=(v) Axlsx::validate_unsigned_int(v); @tickMarkSkip = v; end
|
31
|
-
|
32
|
-
# Serializes the series axis
|
33
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
34
|
-
# @return [String]
|
35
|
-
def to_xml(xml)
|
36
|
-
xml.send('c:serAx') {
|
37
|
-
super(xml)
|
38
|
-
xml.send('c:tickLblSkip', :val=>@tickLblSkip) unless @tickLblSkip.nil?
|
39
|
-
xml.send('c:tickMarkSkip', :val=>@tickMarkSkip) unless @tickMarkSkip.nil?
|
40
|
-
}
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
end
|
data/lib/axlsx/drawing/series.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
module Axlsx
|
2
|
-
# A Series defines the common series attributes and is the super class for all concrete series types.
|
3
|
-
# @note The recommended way to manage series is to use Chart#add_series
|
4
|
-
# @see Worksheet#add_chart
|
5
|
-
# @see Chart#add_series
|
6
|
-
class Series
|
7
|
-
|
8
|
-
# The chart that owns this series
|
9
|
-
# @return [Chart]
|
10
|
-
attr_reader :chart
|
11
|
-
|
12
|
-
# The title of the series
|
13
|
-
# @return [SeriesTitle]
|
14
|
-
attr_reader :title
|
15
|
-
|
16
|
-
# Creates a new series
|
17
|
-
# @param [Chart] chart
|
18
|
-
# @option options [Integer] order
|
19
|
-
# @option options [String] title
|
20
|
-
def initialize(chart, options={})
|
21
|
-
@order = nil
|
22
|
-
self.chart = chart
|
23
|
-
@chart.series << self
|
24
|
-
options.each do |o|
|
25
|
-
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# The index of this series in the chart's series.
|
30
|
-
# @return [Integer]
|
31
|
-
def index
|
32
|
-
@chart.series.index(self)
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
# The order of this series in the chart's series. By default the order is the index of the series.
|
37
|
-
# @return [Integer]
|
38
|
-
def order
|
39
|
-
@order || index
|
40
|
-
end
|
41
|
-
|
42
|
-
# @see order
|
43
|
-
def order=(v) Axlsx::validate_unsigned_int(v); @order = v; end
|
44
|
-
|
45
|
-
# @see title
|
46
|
-
def title=(v)
|
47
|
-
v = SeriesTitle.new(v) if v.is_a?(String) || v.is_a?(Cell)
|
48
|
-
DataTypeValidator.validate "#{self.class}.title", SeriesTitle, v
|
49
|
-
@title = v
|
50
|
-
end
|
51
|
-
|
52
|
-
private
|
53
|
-
|
54
|
-
# assigns the chart for this series
|
55
|
-
def chart=(v) DataTypeValidator.validate "Series.chart", Chart, v; @chart = v; end
|
56
|
-
|
57
|
-
# Serializes the series
|
58
|
-
# @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
|
59
|
-
# @return [String]
|
60
|
-
def to_xml(xml)
|
61
|
-
xml.send('c:ser') {
|
62
|
-
xml.send('c:idx', :val=>index)
|
63
|
-
xml.send('c:order', :val=>order || index)
|
64
|
-
title.to_xml(xml) unless title.nil?
|
65
|
-
yield xml if block_given?
|
66
|
-
}
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
70
|
-
|
71
|
-
end
|