axlsx 2.0.1 → 2.1.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -3
- data/Rakefile +9 -10
- data/examples/IMAGE1UP.JPEG +0 -0
- data/examples/auto_filter.rb +10 -1
- data/examples/conditional_formatting/example_conditional_formatting.rb +3 -3
- data/examples/example.rb +72 -4
- data/examples/merge_cells.rb +17 -0
- data/examples/no_grid_with_borders.rb +18 -0
- data/examples/pivot_test.rb +63 -0
- data/examples/split.rb +16 -0
- data/lib/axlsx.rb +30 -16
- data/lib/axlsx/content_type/abstract_content_type.rb +1 -1
- data/lib/axlsx/content_type/content_type.rb +1 -1
- data/lib/axlsx/doc_props/app.rb +1 -1
- data/lib/axlsx/doc_props/core.rb +5 -5
- data/lib/axlsx/drawing/axes.rb +1 -1
- data/lib/axlsx/drawing/axis.rb +12 -9
- data/lib/axlsx/drawing/bar_3D_chart.rb +13 -13
- data/lib/axlsx/drawing/bar_series.rb +9 -9
- data/lib/axlsx/drawing/bubble_chart.rb +59 -0
- data/lib/axlsx/drawing/bubble_series.rb +63 -0
- data/lib/axlsx/drawing/cat_axis.rb +5 -5
- data/lib/axlsx/drawing/chart.rb +44 -7
- data/lib/axlsx/drawing/drawing.rb +3 -1
- data/lib/axlsx/drawing/graphic_frame.rb +3 -3
- data/lib/axlsx/drawing/hyperlink.rb +1 -3
- data/lib/axlsx/drawing/line_3D_chart.rb +2 -2
- data/lib/axlsx/drawing/line_chart.rb +10 -10
- data/lib/axlsx/drawing/line_series.rb +14 -2
- data/lib/axlsx/drawing/marker.rb +1 -1
- data/lib/axlsx/drawing/num_data.rb +4 -4
- data/lib/axlsx/drawing/num_data_source.rb +6 -6
- data/lib/axlsx/drawing/num_val.rb +1 -1
- data/lib/axlsx/drawing/one_cell_anchor.rb +1 -1
- data/lib/axlsx/drawing/pic.rb +2 -3
- data/lib/axlsx/drawing/picture_locking.rb +1 -3
- data/lib/axlsx/drawing/pie_3D_chart.rb +5 -6
- data/lib/axlsx/drawing/pie_series.rb +6 -6
- data/lib/axlsx/drawing/scaling.rb +4 -4
- data/lib/axlsx/drawing/scatter_chart.rb +10 -10
- data/lib/axlsx/drawing/scatter_series.rb +26 -7
- data/lib/axlsx/drawing/ser_axis.rb +2 -2
- data/lib/axlsx/drawing/series.rb +3 -3
- data/lib/axlsx/drawing/series_title.rb +2 -2
- data/lib/axlsx/drawing/str_data.rb +3 -3
- data/lib/axlsx/drawing/str_val.rb +1 -1
- data/lib/axlsx/drawing/title.rb +3 -3
- data/lib/axlsx/drawing/val_axis.rb +1 -1
- data/lib/axlsx/drawing/vml_drawing.rb +1 -1
- data/lib/axlsx/package.rb +39 -28
- data/lib/axlsx/rels/relationship.rb +1 -1
- data/lib/axlsx/rels/relationships.rb +2 -2
- data/lib/axlsx/stylesheet/border_pr.rb +2 -2
- data/lib/axlsx/stylesheet/cell_alignment.rb +1 -3
- data/lib/axlsx/stylesheet/cell_protection.rb +1 -3
- data/lib/axlsx/stylesheet/cell_style.rb +1 -3
- data/lib/axlsx/stylesheet/color.rb +1 -3
- data/lib/axlsx/stylesheet/font.rb +1 -1
- data/lib/axlsx/stylesheet/gradient_stop.rb +1 -1
- data/lib/axlsx/stylesheet/num_fmt.rb +1 -3
- data/lib/axlsx/stylesheet/pattern_fill.rb +1 -1
- data/lib/axlsx/stylesheet/styles.rb +6 -6
- data/lib/axlsx/stylesheet/table_style_element.rb +1 -3
- data/lib/axlsx/util/accessors.rb +6 -6
- data/lib/axlsx/util/constants.rb +106 -101
- data/lib/axlsx/util/options_parser.rb +2 -1
- data/lib/axlsx/util/parser.rb +4 -4
- data/lib/axlsx/util/serialized_attributes.rb +16 -6
- data/lib/axlsx/util/simple_typed_list.rb +28 -52
- data/lib/axlsx/util/storage.rb +4 -4
- data/lib/axlsx/util/string.rb +7 -0
- data/lib/axlsx/util/validators.rb +20 -13
- data/lib/axlsx/version.rb +1 -1
- data/lib/axlsx/workbook/defined_name.rb +11 -12
- data/lib/axlsx/workbook/defined_names.rb +2 -2
- data/lib/axlsx/workbook/shared_strings_table.rb +5 -5
- data/lib/axlsx/workbook/workbook.rb +19 -12
- data/lib/axlsx/workbook/workbook_view.rb +78 -0
- data/lib/axlsx/workbook/workbook_views.rb +22 -0
- data/lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb +2 -2
- data/lib/axlsx/workbook/worksheet/auto_filter/filters.rb +1 -3
- data/lib/axlsx/workbook/worksheet/break.rb +1 -3
- data/lib/axlsx/workbook/worksheet/cell.rb +128 -73
- data/lib/axlsx/workbook/worksheet/cell_serializer.rb +50 -40
- data/lib/axlsx/workbook/worksheet/cfvo.rb +1 -3
- data/lib/axlsx/workbook/worksheet/cfvos.rb +1 -1
- data/lib/axlsx/workbook/worksheet/col.rb +7 -10
- data/lib/axlsx/workbook/worksheet/col_breaks.rb +2 -2
- data/lib/axlsx/workbook/worksheet/comment.rb +5 -6
- data/lib/axlsx/workbook/worksheet/comments.rb +9 -12
- 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/data_bar.rb +4 -6
- data/lib/axlsx/workbook/worksheet/data_validation.rb +6 -4
- data/lib/axlsx/workbook/worksheet/dimension.rb +2 -2
- data/lib/axlsx/workbook/worksheet/header_footer.rb +6 -8
- data/lib/axlsx/workbook/worksheet/icon_set.rb +3 -5
- data/lib/axlsx/workbook/worksheet/merged_cells.rb +2 -2
- data/lib/axlsx/workbook/worksheet/page_margins.rb +1 -3
- data/lib/axlsx/workbook/worksheet/page_set_up_pr.rb +1 -1
- data/lib/axlsx/workbook/worksheet/page_setup.rb +21 -23
- data/lib/axlsx/workbook/worksheet/pane.rb +1 -3
- data/lib/axlsx/workbook/worksheet/pivot_table.rb +17 -24
- data/lib/axlsx/workbook/worksheet/pivot_table_cache_definition.rb +4 -4
- data/lib/axlsx/workbook/worksheet/print_options.rb +1 -3
- data/lib/axlsx/workbook/worksheet/protected_range.rb +1 -3
- data/lib/axlsx/workbook/worksheet/protected_ranges.rb +1 -1
- data/lib/axlsx/workbook/worksheet/rich_text.rb +35 -0
- data/lib/axlsx/workbook/worksheet/rich_text_run.rb +254 -0
- data/lib/axlsx/workbook/worksheet/row.rb +33 -51
- data/lib/axlsx/workbook/worksheet/row_breaks.rb +2 -2
- data/lib/axlsx/workbook/worksheet/selection.rb +1 -3
- data/lib/axlsx/workbook/worksheet/sheet_data.rb +3 -1
- data/lib/axlsx/workbook/worksheet/sheet_protection.rb +1 -3
- data/lib/axlsx/workbook/worksheet/table.rb +6 -6
- data/lib/axlsx/workbook/worksheet/table_style_info.rb +1 -3
- data/lib/axlsx/workbook/worksheet/tables.rb +1 -1
- data/lib/axlsx/workbook/worksheet/worksheet.rb +59 -30
- data/lib/axlsx/workbook/worksheet/worksheet_hyperlinks.rb +3 -3
- data/test/drawing/tc_axis.rb +27 -0
- data/test/drawing/tc_bubble_chart.rb +44 -0
- data/test/drawing/tc_bubble_series.rb +21 -0
- data/test/drawing/tc_data_source.rb +6 -0
- data/test/drawing/tc_line_chart.rb +5 -5
- data/test/drawing/tc_line_series.rb +10 -2
- data/test/drawing/tc_pic.rb +4 -0
- data/test/drawing/tc_scatter_series.rb +25 -1
- data/test/tc_helper.rb +1 -1
- data/test/tc_package.rb +7 -1
- data/test/util/tc_simple_typed_list.rb +1 -2
- data/test/workbook/tc_defined_name.rb +12 -4
- data/test/workbook/tc_workbook.rb +16 -2
- data/test/workbook/tc_workbook_view.rb +50 -0
- data/test/workbook/worksheet/auto_filter/tc_filters.rb +1 -1
- data/test/workbook/worksheet/tc_break.rb +1 -1
- data/test/workbook/worksheet/tc_cell.rb +30 -4
- data/test/workbook/worksheet/tc_col.rb +2 -2
- data/test/workbook/worksheet/tc_conditional_formatting.rb +2 -2
- data/test/workbook/worksheet/tc_data_bar.rb +1 -1
- data/test/workbook/worksheet/tc_data_validation.rb +11 -11
- data/test/workbook/worksheet/tc_header_footer.rb +2 -2
- data/test/workbook/worksheet/tc_icon_set.rb +1 -1
- data/test/workbook/worksheet/tc_page_setup.rb +3 -3
- data/test/workbook/worksheet/tc_print_options.rb +1 -1
- data/test/workbook/worksheet/tc_rich_text.rb +44 -0
- data/test/workbook/worksheet/tc_rich_text_run.rb +172 -0
- data/test/workbook/worksheet/tc_row.rb +2 -2
- data/test/workbook/worksheet/tc_sheet_calc_pr.rb +1 -1
- data/test/workbook/worksheet/tc_sheet_format_pr.rb +4 -4
- data/test/workbook/worksheet/tc_sheet_protection.rb +5 -5
- data/test/workbook/worksheet/tc_sheet_view.rb +4 -4
- data/test/workbook/worksheet/tc_worksheet.rb +49 -10
- metadata +81 -55
- data/test/axlsx.qcachegrind +0 -2226
@@ -35,7 +35,7 @@ module Axlsx
|
|
35
35
|
# macro attribute should be optional!
|
36
36
|
str << '<xdr:graphicFrame>'
|
37
37
|
str << '<xdr:nvGraphicFramePr>'
|
38
|
-
str << '<xdr:cNvPr id="' << @anchor.drawing.index.to_s << '" name="' << 'item_' << @anchor.drawing.index.to_s << '"/>'
|
38
|
+
str << ('<xdr:cNvPr id="' << @anchor.drawing.index.to_s << '" name="' << 'item_' << @anchor.drawing.index.to_s << '"/>')
|
39
39
|
str << '<xdr:cNvGraphicFramePr/>'
|
40
40
|
str << '</xdr:nvGraphicFramePr>'
|
41
41
|
str << '<xdr:xfrm>'
|
@@ -43,8 +43,8 @@ module Axlsx
|
|
43
43
|
str << '<a:ext cx="0" cy="0"/>'
|
44
44
|
str << '</xdr:xfrm>'
|
45
45
|
str << '<a:graphic>'
|
46
|
-
str << '<a:graphicData uri="' << XML_NS_C << '">'
|
47
|
-
str << '<c:chart xmlns:c="' << XML_NS_C << '" xmlns:r="' << XML_NS_R << '" r:id="' << rId << '"/>'
|
46
|
+
str << ('<a:graphicData uri="' << XML_NS_C << '">')
|
47
|
+
str << ('<c:chart xmlns:c="' << XML_NS_C << '" xmlns:r="' << XML_NS_R << '" r:id="' << rId << '"/>')
|
48
48
|
str << '</a:graphicData>'
|
49
49
|
str << '</a:graphic>'
|
50
50
|
str << '</xdr:graphicFrame>'
|
@@ -93,9 +93,7 @@ module Axlsx
|
|
93
93
|
# @param [String] str
|
94
94
|
# @return [String]
|
95
95
|
def to_xml_string(str = '')
|
96
|
-
|
97
|
-
serialized_attributes str, {:'r:id' => relationship.Id, :'xmlns:r' => XML_NS_R }
|
98
|
-
str << '/>'
|
96
|
+
serialized_tag 'a:hlinkClick', str, {:'r:id' => relationship.Id, :'xmlns:r' => XML_NS_R }
|
99
97
|
end
|
100
98
|
|
101
99
|
end
|
@@ -60,8 +60,8 @@ module Axlsx
|
|
60
60
|
# @param [String] str
|
61
61
|
# @return [String]
|
62
62
|
def to_xml_string(str = '')
|
63
|
-
super(str) do
|
64
|
-
|
63
|
+
super(str) do
|
64
|
+
str << ('<c:gapDepth val="' << @gap_depth.to_s << '"/>') unless @gap_depth.nil?
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -76,16 +76,16 @@ module Axlsx
|
|
76
76
|
# @param [String] str
|
77
77
|
# @return [String]
|
78
78
|
def to_xml_string(str = '')
|
79
|
-
super(str) do
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
@series.each { |ser| ser.to_xml_string(
|
84
|
-
@d_lbls.to_xml_string(
|
85
|
-
yield
|
86
|
-
axes.to_xml_string(
|
87
|
-
|
88
|
-
axes.to_xml_string(
|
79
|
+
super(str) do
|
80
|
+
str << ("<c:" << node_name << ">")
|
81
|
+
str << ('<c:grouping val="' << grouping.to_s << '"/>')
|
82
|
+
str << ('<c:varyColors val="' << vary_colors.to_s << '"/>')
|
83
|
+
@series.each { |ser| ser.to_xml_string(str) }
|
84
|
+
@d_lbls.to_xml_string(str) if @d_lbls
|
85
|
+
yield if block_given?
|
86
|
+
axes.to_xml_string(str, :ids => true)
|
87
|
+
str << ("</c:" << node_name << ">")
|
88
|
+
axes.to_xml_string(str)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
@@ -23,12 +23,17 @@ module Axlsx
|
|
23
23
|
# @return [Boolean]
|
24
24
|
attr_reader :show_marker
|
25
25
|
|
26
|
+
# line smoothing on values
|
27
|
+
# @return [Boolean]
|
28
|
+
attr_reader :smooth
|
29
|
+
|
26
30
|
# Creates a new series
|
27
31
|
# @option options [Array, SimpleTypedList] data
|
28
32
|
# @option options [Array, SimpleTypedList] labels
|
29
33
|
# @param [Chart] chart
|
30
34
|
def initialize(chart, options={})
|
31
35
|
@show_marker = false
|
36
|
+
@smooth = false
|
32
37
|
@labels, @data = nil, nil
|
33
38
|
super(chart, options)
|
34
39
|
@labels = AxDataSource.new(:data => options[:labels]) unless options[:labels].nil?
|
@@ -46,6 +51,12 @@ module Axlsx
|
|
46
51
|
@show_marker = v
|
47
52
|
end
|
48
53
|
|
54
|
+
# @see smooth
|
55
|
+
def smooth=(v)
|
56
|
+
Axlsx::validate_boolean(v)
|
57
|
+
@smooth = v
|
58
|
+
end
|
59
|
+
|
49
60
|
# Serializes the object
|
50
61
|
# @param [String] str
|
51
62
|
# @return [String]
|
@@ -53,11 +64,11 @@ module Axlsx
|
|
53
64
|
super(str) do
|
54
65
|
if color
|
55
66
|
str << '<c:spPr><a:solidFill>'
|
56
|
-
str << '<a:srgbClr val="' << color << '"/>'
|
67
|
+
str << ('<a:srgbClr val="' << color << '"/>')
|
57
68
|
str << '</a:solidFill>'
|
58
69
|
str << '<a:ln w="28800">'
|
59
70
|
str << '<a:solidFill>'
|
60
|
-
str << '<a:srgbClr val="' << color << '"/>'
|
71
|
+
str << ('<a:srgbClr val="' << color << '"/>')
|
61
72
|
str << '</a:solidFill>'
|
62
73
|
str << '</a:ln>'
|
63
74
|
str << '<a:round/>'
|
@@ -66,6 +77,7 @@ module Axlsx
|
|
66
77
|
str << '<c:marker><c:symbol val="none"/></c:marker>' unless @show_marker
|
67
78
|
@labels.to_xml_string(str) unless @labels.nil?
|
68
79
|
@data.to_xml_string(str) unless @data.nil?
|
80
|
+
str << ('<c:smooth val="' << ((smooth) ? '1' : '0') << '"/>')
|
69
81
|
end
|
70
82
|
end
|
71
83
|
|
data/lib/axlsx/drawing/marker.rb
CHANGED
@@ -58,7 +58,7 @@ module Axlsx
|
|
58
58
|
# @return [String]
|
59
59
|
def to_xml_string(str = '')
|
60
60
|
[:col, :colOff, :row, :rowOff].each do |k|
|
61
|
-
str << '<xdr:' << k.to_s << '>' << self.send(k).to_s << '</xdr:' << k.to_s << '>'
|
61
|
+
str << ('<xdr:' << k.to_s << '>' << self.send(k).to_s << '</xdr:' << k.to_s << '>')
|
62
62
|
end
|
63
63
|
end
|
64
64
|
private
|
@@ -38,13 +38,13 @@ module Axlsx
|
|
38
38
|
|
39
39
|
# serialize the object
|
40
40
|
def to_xml_string(str = "")
|
41
|
-
str << '<c:' << @tag_name.to_s << '>'
|
42
|
-
str << '<c:formatCode>' << format_code.to_s << '</c:formatCode>'
|
43
|
-
str << '<c:ptCount val="' << @pt.size.to_s << '"/>'
|
41
|
+
str << ('<c:' << @tag_name.to_s << '>')
|
42
|
+
str << ('<c:formatCode>' << format_code.to_s << '</c:formatCode>')
|
43
|
+
str << ('<c:ptCount val="' << @pt.size.to_s << '"/>')
|
44
44
|
@pt.each_with_index do |num_val, index|
|
45
45
|
num_val.to_xml_string index, str
|
46
46
|
end
|
47
|
-
str << '</c:' << @tag_name.to_s << '>'
|
47
|
+
str << ('</c:' << @tag_name.to_s << '>')
|
48
48
|
end
|
49
49
|
|
50
50
|
end
|
@@ -33,7 +33,7 @@ module Axlsx
|
|
33
33
|
# allowed element tag names
|
34
34
|
# @return [Array]
|
35
35
|
def self.allowed_tag_names
|
36
|
-
[:yVal, :val]
|
36
|
+
[:yVal, :val, :bubbleSize]
|
37
37
|
end
|
38
38
|
|
39
39
|
# sets the tag name for this data source
|
@@ -46,16 +46,16 @@ module Axlsx
|
|
46
46
|
# serialize the object
|
47
47
|
# @param [String] str
|
48
48
|
def to_xml_string(str="")
|
49
|
-
str << '<c:' << tag_name.to_s << '>'
|
49
|
+
str << ('<c:' << tag_name.to_s << '>')
|
50
50
|
if @f
|
51
|
-
str << '<c:' << @ref_tag_name.to_s << '>'
|
52
|
-
str << '<c:f>' << @f.to_s << '</c:f>'
|
51
|
+
str << ('<c:' << @ref_tag_name.to_s << '>')
|
52
|
+
str << ('<c:f>' << @f.to_s << '</c:f>')
|
53
53
|
end
|
54
54
|
@data.to_xml_string str
|
55
55
|
if @f
|
56
|
-
str << '</c:' << @ref_tag_name.to_s << '>'
|
56
|
+
str << ('</c:' << @ref_tag_name.to_s << '>')
|
57
57
|
end
|
58
|
-
str << '</c:' << tag_name.to_s << '>'
|
58
|
+
str << ('</c:' << tag_name.to_s << '>')
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -26,7 +26,7 @@ module Axlsx
|
|
26
26
|
# serialize the object
|
27
27
|
def to_xml_string(idx, str = "")
|
28
28
|
Axlsx::validate_unsigned_int(idx)
|
29
|
-
str << '<c:pt idx="' << idx.to_s << '" formatCode="' << format_code << '"><c:v>' << v.to_s << '</c:v></c:pt>'
|
29
|
+
str << ('<c:pt idx="' << idx.to_s << '" formatCode="' << format_code << '"><c:v>' << v.to_s << '</c:v></c:pt>')
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -77,7 +77,7 @@ module Axlsx
|
|
77
77
|
str << '<xdr:from>'
|
78
78
|
from.to_xml_string(str)
|
79
79
|
str << '</xdr:from>'
|
80
|
-
str << '<xdr:ext cx="' << ext[:cx].to_s << '" cy="' << ext[:cy].to_s << '"/>'
|
80
|
+
str << ('<xdr:ext cx="' << ext[:cx].to_s << '" cy="' << ext[:cy].to_s << '"/>')
|
81
81
|
@object.to_xml_string(str)
|
82
82
|
str << '<xdr:clientData/>'
|
83
83
|
str << '</xdr:oneCellAnchor>'
|
data/lib/axlsx/drawing/pic.rb
CHANGED
@@ -165,17 +165,16 @@ module Axlsx
|
|
165
165
|
def to_xml_string(str = '')
|
166
166
|
str << '<xdr:pic>'
|
167
167
|
str << '<xdr:nvPicPr>'
|
168
|
-
str << '<xdr:cNvPr id="2" name="' << name.to_s << '" descr="' << descr.to_s << '">'
|
168
|
+
str << ('<xdr:cNvPr id="2" name="' << name.to_s << '" descr="' << descr.to_s << '">')
|
169
169
|
@hyperlink.to_xml_string(str) if @hyperlink.is_a?(Hyperlink)
|
170
170
|
str << '</xdr:cNvPr><xdr:cNvPicPr>'
|
171
171
|
picture_locking.to_xml_string(str)
|
172
172
|
str << '</xdr:cNvPicPr></xdr:nvPicPr>'
|
173
173
|
str << '<xdr:blipFill>'
|
174
|
-
str << '<a:blip xmlns:r ="' << XML_NS_R << '" r:embed="' << relationship.Id <<
|
174
|
+
str << ('<a:blip xmlns:r ="' << XML_NS_R << '" r:embed="' << relationship.Id << '"/>')
|
175
175
|
str << '<a:stretch><a:fillRect/></a:stretch></xdr:blipFill><xdr:spPr>'
|
176
176
|
str << '<a:xfrm><a:off x="0" y="0"/><a:ext cx="2336800" cy="2161540"/></a:xfrm>'
|
177
177
|
str << '<a:prstGeom prst="rect"><a:avLst/></a:prstGeom></xdr:spPr></xdr:pic>'
|
178
|
-
|
179
178
|
end
|
180
179
|
|
181
180
|
private
|
@@ -34,13 +34,12 @@ module Axlsx
|
|
34
34
|
# @param [String] str
|
35
35
|
# @return [String]
|
36
36
|
def to_xml_string(str = '')
|
37
|
-
super(str) do
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
@series.each { |ser| ser.to_xml_string(str_inner) }
|
37
|
+
super(str) do
|
38
|
+
str << '<c:pie3DChart>'
|
39
|
+
str << ('<c:varyColors val="' << vary_colors.to_s << '"/>')
|
40
|
+
@series.each { |ser| ser.to_xml_string(str) }
|
42
41
|
d_lbls.to_xml_string(str) if @d_lbls
|
43
|
-
|
42
|
+
str << '</c:pie3DChart>'
|
44
43
|
end
|
45
44
|
end
|
46
45
|
|
@@ -46,17 +46,17 @@ module Axlsx
|
|
46
46
|
# @param [String] str
|
47
47
|
# @return [String]
|
48
48
|
def to_xml_string(str = '')
|
49
|
-
super(str) do
|
50
|
-
|
49
|
+
super(str) do
|
50
|
+
str << '<c:explosion val="' + @explosion + '"/>' unless @explosion.nil?
|
51
51
|
colors.each_with_index do |c, index|
|
52
52
|
str << '<c:dPt>'
|
53
|
-
str << '<c:idx val="' << index.to_s << '"/>'
|
53
|
+
str << ('<c:idx val="' << index.to_s << '"/>')
|
54
54
|
str << '<c:spPr><a:solidFill>'
|
55
|
-
str << '<a:srgbClr val="' << c << '"/>'
|
55
|
+
str << ('<a:srgbClr val="' << c << '"/>')
|
56
56
|
str << '</a:solidFill></c:spPr></c:dPt>'
|
57
57
|
end
|
58
|
-
@labels.to_xml_string
|
59
|
-
@data.to_xml_string
|
58
|
+
@labels.to_xml_string str unless @labels.nil?
|
59
|
+
@data.to_xml_string str unless @data.nil?
|
60
60
|
end
|
61
61
|
str
|
62
62
|
end
|
@@ -49,10 +49,10 @@ module Axlsx
|
|
49
49
|
# @return [String]
|
50
50
|
def to_xml_string(str = '')
|
51
51
|
str << '<c:scaling>'
|
52
|
-
str << '<c:logBase val="' << @logBase.to_s << '"/>' unless @logBase.nil?
|
53
|
-
str << '<c:orientation val="' << @orientation.to_s << '"/>' unless @orientation.nil?
|
54
|
-
str << '<c:min val="' << @min.to_s << '"/>' unless @min.nil?
|
55
|
-
str << '<c:max val="' << @max.to_s << '"/>' unless @max.nil?
|
52
|
+
str << ('<c:logBase val="' << @logBase.to_s << '"/>') unless @logBase.nil?
|
53
|
+
str << ('<c:orientation val="' << @orientation.to_s << '"/>') unless @orientation.nil?
|
54
|
+
str << ('<c:min val="' << @min.to_s << '"/>') unless @min.nil?
|
55
|
+
str << ('<c:max val="' << @max.to_s << '"/>') unless @max.nil?
|
56
56
|
str << '</c:scaling>'
|
57
57
|
end
|
58
58
|
|
@@ -25,7 +25,7 @@ module Axlsx
|
|
25
25
|
# the y value axis
|
26
26
|
# @return [ValAxis]
|
27
27
|
def y_val_axis
|
28
|
-
axes[:
|
28
|
+
axes[:y_val_axis]
|
29
29
|
end
|
30
30
|
alias :yValAxis :y_val_axis
|
31
31
|
|
@@ -51,15 +51,15 @@ module Axlsx
|
|
51
51
|
# @param [String] str
|
52
52
|
# @return [String]
|
53
53
|
def to_xml_string(str = '')
|
54
|
-
super(str) do
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
@series.each { |ser| ser.to_xml_string(
|
59
|
-
d_lbls.to_xml_string(
|
60
|
-
axes.to_xml_string(
|
61
|
-
|
62
|
-
axes.to_xml_string(
|
54
|
+
super(str) do
|
55
|
+
str << '<c:scatterChart>'
|
56
|
+
str << ('<c:scatterStyle val="' << scatter_style.to_s << '"/>')
|
57
|
+
str << ('<c:varyColors val="' << vary_colors.to_s << '"/>')
|
58
|
+
@series.each { |ser| ser.to_xml_string(str) }
|
59
|
+
d_lbls.to_xml_string(str) if @d_lbls
|
60
|
+
axes.to_xml_string(str, :ids => true)
|
61
|
+
str << '</c:scatterChart>'
|
62
|
+
axes.to_xml_string(str)
|
63
63
|
end
|
64
64
|
str
|
65
65
|
end
|
@@ -21,9 +21,21 @@ module Axlsx
|
|
21
21
|
# @return [String]
|
22
22
|
attr_reader :color
|
23
23
|
|
24
|
+
# Line smoothing between data points
|
25
|
+
# @return [Boolean]
|
26
|
+
attr_reader :smooth
|
27
|
+
|
24
28
|
# Creates a new ScatterSeries
|
25
29
|
def initialize(chart, options={})
|
26
30
|
@xData, @yData = nil
|
31
|
+
if options[:smooth].nil?
|
32
|
+
# If caller hasn't specified smoothing or not, turn smoothing on or off based on scatter style
|
33
|
+
@smooth = [:smooth, :smoothMarker].include?(chart.scatter_style)
|
34
|
+
else
|
35
|
+
# Set smoothing according to the option provided
|
36
|
+
Axlsx::validate_boolean(options[:smooth])
|
37
|
+
@smooth = options[:smooth]
|
38
|
+
end
|
27
39
|
super(chart, options)
|
28
40
|
@xData = AxDataSource.new(:tag_name => :xVal, :data => options[:xData]) unless options[:xData].nil?
|
29
41
|
@yData = NumDataSource.new({:tag_name => :yVal, :data => options[:yData]}) unless options[:yData].nil?
|
@@ -34,30 +46,37 @@ module Axlsx
|
|
34
46
|
@color = v
|
35
47
|
end
|
36
48
|
|
49
|
+
# @see smooth
|
50
|
+
def smooth=(v)
|
51
|
+
Axlsx::validate_boolean(v)
|
52
|
+
@smooth = v
|
53
|
+
end
|
54
|
+
|
37
55
|
# Serializes the object
|
38
56
|
# @param [String] str
|
39
57
|
# @return [String]
|
40
58
|
def to_xml_string(str = '')
|
41
|
-
super(str) do
|
59
|
+
super(str) do
|
42
60
|
# needs to override the super color here to push in ln/and something else!
|
43
61
|
if color
|
44
62
|
str << '<c:spPr><a:solidFill>'
|
45
|
-
str << '<a:srgbClr val="' << color << '"/>'
|
63
|
+
str << ('<a:srgbClr val="' << color << '"/>')
|
46
64
|
str << '</a:solidFill>'
|
47
65
|
str << '<a:ln><a:solidFill>'
|
48
|
-
str << '<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>'
|
66
|
+
str << ('<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>')
|
49
67
|
str << '</c:spPr>'
|
50
68
|
str << '<c:marker>'
|
51
69
|
str << '<c:spPr><a:solidFill>'
|
52
|
-
str << '<a:srgbClr val="' << color << '"/>'
|
70
|
+
str << ('<a:srgbClr val="' << color << '"/>')
|
53
71
|
str << '</a:solidFill>'
|
54
72
|
str << '<a:ln><a:solidFill>'
|
55
|
-
str << '<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>'
|
73
|
+
str << ('<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>')
|
56
74
|
str << '</c:spPr>'
|
57
75
|
str << '</c:marker>'
|
58
76
|
end
|
59
|
-
@xData.to_xml_string(
|
60
|
-
@yData.to_xml_string(
|
77
|
+
@xData.to_xml_string(str) unless @xData.nil?
|
78
|
+
@yData.to_xml_string(str) unless @yData.nil?
|
79
|
+
str << ('<c:smooth val="' << ((smooth) ? '1' : '0') << '"/>')
|
61
80
|
end
|
62
81
|
str
|
63
82
|
end
|
@@ -35,8 +35,8 @@ module Axlsx
|
|
35
35
|
def to_xml_string(str = '')
|
36
36
|
str << '<c:serAx>'
|
37
37
|
super(str)
|
38
|
-
str << '<c:tickLblSkip val="' << @tick_lbl_skip.to_s << '"/>' unless @tick_lbl_skip.nil?
|
39
|
-
str << '<c:tickMarkSkip val="' << @tick_mark_skip.to_s << '"/>' unless @tick_mark_skip.nil?
|
38
|
+
str << ('<c:tickLblSkip val="' << @tick_lbl_skip.to_s << '"/>') unless @tick_lbl_skip.nil?
|
39
|
+
str << ('<c:tickMarkSkip val="' << @tick_mark_skip.to_s << '"/>') unless @tick_mark_skip.nil?
|
40
40
|
str << '</c:serAx>'
|
41
41
|
end
|
42
42
|
end
|
data/lib/axlsx/drawing/series.rb
CHANGED
@@ -59,10 +59,10 @@ module Axlsx
|
|
59
59
|
# @return [String]
|
60
60
|
def to_xml_string(str = '')
|
61
61
|
str << '<c:ser>'
|
62
|
-
str << '<c:idx val="' << index.to_s << '"/>'
|
63
|
-
str << '<c:order val="' << (order || index).to_s << '"/>'
|
62
|
+
str << ('<c:idx val="' << index.to_s << '"/>')
|
63
|
+
str << ('<c:order val="' << (order || index).to_s << '"/>')
|
64
64
|
title.to_xml_string(str) unless title.nil?
|
65
|
-
yield
|
65
|
+
yield if block_given?
|
66
66
|
str << '</c:ser>'
|
67
67
|
end
|
68
68
|
end
|
@@ -9,11 +9,11 @@ module Axlsx
|
|
9
9
|
def to_xml_string(str = '')
|
10
10
|
str << '<c:tx>'
|
11
11
|
str << '<c:strRef>'
|
12
|
-
str << '<c:f>' << Axlsx::cell_range([@cell]) << '</c:f>'
|
12
|
+
str << ('<c:f>' << Axlsx::cell_range([@cell]) << '</c:f>')
|
13
13
|
str << '<c:strCache>'
|
14
14
|
str << '<c:ptCount val="1"/>'
|
15
15
|
str << '<c:pt idx="0">'
|
16
|
-
str << '<c:v>' << @text << '</c:v>'
|
16
|
+
str << ('<c:v>' << @text << '</c:v>')
|
17
17
|
str << '</c:pt>'
|
18
18
|
str << '</c:strCache>'
|
19
19
|
str << '</c:strRef>'
|
@@ -29,12 +29,12 @@ module Axlsx
|
|
29
29
|
|
30
30
|
# serialize the object
|
31
31
|
def to_xml_string(str = "")
|
32
|
-
str << '<c:' << @tag_name.to_s << '>'
|
33
|
-
str << '<c:ptCount val="' << @pt.size.to_s << '"/>'
|
32
|
+
str << ('<c:' << @tag_name.to_s << '>')
|
33
|
+
str << ('<c:ptCount val="' << @pt.size.to_s << '"/>')
|
34
34
|
@pt.each_with_index do |value, index|
|
35
35
|
value.to_xml_string index, str
|
36
36
|
end
|
37
|
-
str << '</c:' << @tag_name.to_s << '>'
|
37
|
+
str << ('</c:' << @tag_name.to_s << '>')
|
38
38
|
end
|
39
39
|
|
40
40
|
end
|