write_xlsx 0.80.0 → 0.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changes +3 -0
- data/lib/write_xlsx/chart/axis.rb +13 -2
- data/lib/write_xlsx/chart.rb +9 -1
- data/lib/write_xlsx/version.rb +1 -1
- data/test/regression/test_chart_axis35.rb +44 -0
- data/test/regression/test_chart_axis36.rb +44 -0
- data/test/regression/test_chart_axis37.rb +46 -0
- data/test/regression/test_chart_axis38.rb +48 -0
- data/test/regression/test_chart_axis39.rb +51 -0
- data/test/regression/xlsx_files/chart_axis35.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis36.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis37.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis38.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis39.xlsx +0 -0
- metadata +21 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2393c3aa40869f02381b920ea72227502bd095a6
|
4
|
+
data.tar.gz: f6e538f97000ba15bd3507db94117a9cca492459
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec5a9d30c96b3bd5043b8ee50773cca2b183869d0b9cb3c7a83fbed670baee1970ecdedcc1681d316cd3846515c9b376d2886ff5c95be318d04ad94f72ec1f27
|
7
|
+
data.tar.gz: faac0dcd09879f013e237a9333bbd4a109e1bcbe6c6eb03cc0d9765c9bde376ad2f907ee850b52f51f9df35625fa3ce3cc3c94d9529fb57b3a2273b4c294e393
|
data/Changes
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
Change history of write_xlsx rubygem.
|
2
|
+
2014-12-04 v0.81.0
|
3
|
+
Add chart axis line and fill properties.
|
4
|
+
|
2
5
|
2014-11-30 v0.80.0
|
3
6
|
Chart Data Label enhancements. Added number formatting, font handling
|
4
7
|
(Excel::Writer::XLSX issue #106), separator (Same issue #107) and legend key.
|
@@ -14,7 +14,7 @@ module Writexlsx
|
|
14
14
|
attr_reader :log_base, :crossing, :position_axis, :label_position, :visible
|
15
15
|
attr_reader :num_format_linked, :num_font, :layout, :interval_unit
|
16
16
|
attr_reader :major_gridlines, :minor_gridlines, :reverse
|
17
|
-
|
17
|
+
attr_reader :line, :fill
|
18
18
|
#
|
19
19
|
# Convert user defined axis values into axis instance.
|
20
20
|
#
|
@@ -25,7 +25,8 @@ module Writexlsx
|
|
25
25
|
[
|
26
26
|
:reverse, :min, :max, :minor_unit, :major_unit, :minor_unit_type,
|
27
27
|
:major_unit_type, :log_base, :crossing, :position_axis, :label_position,
|
28
|
-
:num_format, :num_format_linked, :interval_unit, :major_tick_mark
|
28
|
+
:num_format, :num_format_linked, :interval_unit, :major_tick_mark,
|
29
|
+
:line, :fill
|
29
30
|
].each { |val| instance_variable_set("@#{val}", args[val]) }
|
30
31
|
@visible = args[:visible] || 1
|
31
32
|
|
@@ -34,6 +35,8 @@ module Writexlsx
|
|
34
35
|
set_position_axis
|
35
36
|
set_font_properties(args)
|
36
37
|
set_axis_name_layout(args)
|
38
|
+
set_axis_line(args)
|
39
|
+
set_axis_fill(args)
|
37
40
|
end
|
38
41
|
|
39
42
|
#
|
@@ -116,6 +119,14 @@ module Writexlsx
|
|
116
119
|
def set_axis_name_layout(args)
|
117
120
|
@layout = @chart.layout_properties(args[:name_layout], 1)
|
118
121
|
end
|
122
|
+
|
123
|
+
def set_axis_line(args)
|
124
|
+
@line = @chart.line_properties(args[:line])
|
125
|
+
end
|
126
|
+
|
127
|
+
def set_axis_fill(args)
|
128
|
+
@fill = @chart.fill_properties(args[:fill])
|
129
|
+
end
|
119
130
|
end
|
120
131
|
end
|
121
132
|
end
|
data/lib/write_xlsx/chart.rb
CHANGED
@@ -1137,6 +1137,9 @@ module Writexlsx
|
|
1137
1137
|
# Write the c:tickLblPos element.
|
1138
1138
|
write_tick_label_pos(x_axis.label_position)
|
1139
1139
|
|
1140
|
+
# Write the c:spPr element for the axis line.
|
1141
|
+
write_sp_pr(x_axis)
|
1142
|
+
|
1140
1143
|
# Write the axis font elements.
|
1141
1144
|
write_axis_font(x_axis.num_font)
|
1142
1145
|
|
@@ -1204,9 +1207,12 @@ module Writexlsx
|
|
1204
1207
|
# Write the c:majorTickMark element.
|
1205
1208
|
write_major_tick_mark(y_axis.major_tick_mark)
|
1206
1209
|
|
1207
|
-
# Write the tickLblPos element.
|
1210
|
+
# Write the c:tickLblPos element.
|
1208
1211
|
write_tick_label_pos(y_axis.label_position)
|
1209
1212
|
|
1213
|
+
# Write the c:spPr element for the axis line.
|
1214
|
+
write_sp_pr(y_axis)
|
1215
|
+
|
1210
1216
|
# Write the axis font elements.
|
1211
1217
|
write_axis_font(y_axis.num_font)
|
1212
1218
|
|
@@ -1270,6 +1276,8 @@ module Writexlsx
|
|
1270
1276
|
|
1271
1277
|
# Write the c:tickLblPos element.
|
1272
1278
|
write_tick_label_pos(x_axis.label_position)
|
1279
|
+
# Write the c:spPr element for the axis line.
|
1280
|
+
write_sp_pr(x_axis)
|
1273
1281
|
# Write the font elements.
|
1274
1282
|
write_axis_font(x_axis.num_font)
|
1275
1283
|
# Write the c:crossAx element.
|
data/lib/write_xlsx/version.rb
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartAxis35 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_axis35
|
14
|
+
@xlsx = 'chart_axis35.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'column', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [63008128, 62522496])
|
21
|
+
data = [
|
22
|
+
[ 1, 2, 3, 4, 5 ],
|
23
|
+
[ 2, 4, 6, 8, 10 ],
|
24
|
+
[ 3, 6, 9, 12, 15 ]
|
25
|
+
]
|
26
|
+
|
27
|
+
worksheet.write('A1', data)
|
28
|
+
|
29
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
30
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
32
|
+
|
33
|
+
chart.set_y_axis(:line => {:none => 1})
|
34
|
+
|
35
|
+
worksheet.insert_chart('E9', chart)
|
36
|
+
|
37
|
+
workbook.close
|
38
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx),
|
39
|
+
@xlsx,
|
40
|
+
nil,
|
41
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartAxis36 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_axis36
|
14
|
+
@xlsx = 'chart_axis36.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'column', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [45501056, 47505792])
|
21
|
+
data = [
|
22
|
+
[ 1, 2, 3, 4, 5 ],
|
23
|
+
[ 2, 4, 6, 8, 10 ],
|
24
|
+
[ 3, 6, 9, 12, 15 ]
|
25
|
+
]
|
26
|
+
|
27
|
+
worksheet.write('A1', data)
|
28
|
+
|
29
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
30
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
32
|
+
|
33
|
+
chart.set_x_axis(:line => {:none => 1})
|
34
|
+
|
35
|
+
worksheet.insert_chart('E9', chart)
|
36
|
+
|
37
|
+
workbook.close
|
38
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx),
|
39
|
+
@xlsx,
|
40
|
+
nil,
|
41
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
42
|
+
)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartAxis37 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_axis37
|
14
|
+
@xlsx = 'chart_axis37.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'column', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [46032384, 48088960 ])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5 ],
|
24
|
+
[ 2, 4, 6, 8, 10 ],
|
25
|
+
[ 3, 6, 9, 12, 15 ]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_x_axis(:line => {:color => 'yellow'})
|
35
|
+
chart.set_y_axis(:line => {:color => 'red' })
|
36
|
+
|
37
|
+
worksheet.insert_chart('E9', chart)
|
38
|
+
|
39
|
+
workbook.close
|
40
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx),
|
41
|
+
@xlsx,
|
42
|
+
nil,
|
43
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartAxis38 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_axis38
|
14
|
+
@xlsx = 'chart_axis38.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'column', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [45642496, 45644416])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5 ],
|
24
|
+
[ 2, 4, 6, 8, 10 ],
|
25
|
+
[ 3, 6, 9, 12, 15 ]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
31
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
32
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
33
|
+
|
34
|
+
chart.set_y_axis(
|
35
|
+
:line => {:color => 'yellow'},
|
36
|
+
:fill => {:color => 'red'}
|
37
|
+
)
|
38
|
+
|
39
|
+
worksheet.insert_chart('E9', chart)
|
40
|
+
|
41
|
+
workbook.close
|
42
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx),
|
43
|
+
@xlsx,
|
44
|
+
nil,
|
45
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
46
|
+
)
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartAxis39 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_axis39
|
14
|
+
@xlsx = 'chart_axis39.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'scatter', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [45884928, 45883392])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5 ],
|
24
|
+
[ 2, 4, 6, 8, 10 ],
|
25
|
+
[ 3, 6, 9, 12, 15 ]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(
|
31
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
32
|
+
:values => '=Sheet1!$B$1:$B$5'
|
33
|
+
)
|
34
|
+
chart.add_series(
|
35
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
36
|
+
:values => '=Sheet1!$C$1:$C$5'
|
37
|
+
)
|
38
|
+
|
39
|
+
chart.set_x_axis(:line => {:none => 1})
|
40
|
+
chart.set_y_axis(:line => {:none => 1})
|
41
|
+
|
42
|
+
worksheet.insert_chart('E9', chart)
|
43
|
+
|
44
|
+
workbook.close
|
45
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx),
|
46
|
+
@xlsx,
|
47
|
+
nil,
|
48
|
+
{ 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
|
49
|
+
)
|
50
|
+
end
|
51
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: write_xlsx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.81.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hideo NAKAMURA
|
@@ -419,6 +419,11 @@ files:
|
|
419
419
|
- test/regression/test_chart_axis32.rb
|
420
420
|
- test/regression/test_chart_axis33.rb
|
421
421
|
- test/regression/test_chart_axis34.rb
|
422
|
+
- test/regression/test_chart_axis35.rb
|
423
|
+
- test/regression/test_chart_axis36.rb
|
424
|
+
- test/regression/test_chart_axis37.rb
|
425
|
+
- test/regression/test_chart_axis38.rb
|
426
|
+
- test/regression/test_chart_axis39.rb
|
422
427
|
- test/regression/test_chart_bar01.rb
|
423
428
|
- test/regression/test_chart_bar02.rb
|
424
429
|
- test/regression/test_chart_bar03.rb
|
@@ -949,6 +954,11 @@ files:
|
|
949
954
|
- test/regression/xlsx_files/chart_axis32.xlsx
|
950
955
|
- test/regression/xlsx_files/chart_axis33.xlsx
|
951
956
|
- test/regression/xlsx_files/chart_axis34.xlsx
|
957
|
+
- test/regression/xlsx_files/chart_axis35.xlsx
|
958
|
+
- test/regression/xlsx_files/chart_axis36.xlsx
|
959
|
+
- test/regression/xlsx_files/chart_axis37.xlsx
|
960
|
+
- test/regression/xlsx_files/chart_axis38.xlsx
|
961
|
+
- test/regression/xlsx_files/chart_axis39.xlsx
|
952
962
|
- test/regression/xlsx_files/chart_bar01.xlsx
|
953
963
|
- test/regression/xlsx_files/chart_bar02.xlsx
|
954
964
|
- test/regression/xlsx_files/chart_bar03.xlsx
|
@@ -1802,6 +1812,11 @@ test_files:
|
|
1802
1812
|
- test/regression/test_chart_axis32.rb
|
1803
1813
|
- test/regression/test_chart_axis33.rb
|
1804
1814
|
- test/regression/test_chart_axis34.rb
|
1815
|
+
- test/regression/test_chart_axis35.rb
|
1816
|
+
- test/regression/test_chart_axis36.rb
|
1817
|
+
- test/regression/test_chart_axis37.rb
|
1818
|
+
- test/regression/test_chart_axis38.rb
|
1819
|
+
- test/regression/test_chart_axis39.rb
|
1805
1820
|
- test/regression/test_chart_bar01.rb
|
1806
1821
|
- test/regression/test_chart_bar02.rb
|
1807
1822
|
- test/regression/test_chart_bar03.rb
|
@@ -2332,6 +2347,11 @@ test_files:
|
|
2332
2347
|
- test/regression/xlsx_files/chart_axis32.xlsx
|
2333
2348
|
- test/regression/xlsx_files/chart_axis33.xlsx
|
2334
2349
|
- test/regression/xlsx_files/chart_axis34.xlsx
|
2350
|
+
- test/regression/xlsx_files/chart_axis35.xlsx
|
2351
|
+
- test/regression/xlsx_files/chart_axis36.xlsx
|
2352
|
+
- test/regression/xlsx_files/chart_axis37.xlsx
|
2353
|
+
- test/regression/xlsx_files/chart_axis38.xlsx
|
2354
|
+
- test/regression/xlsx_files/chart_axis39.xlsx
|
2335
2355
|
- test/regression/xlsx_files/chart_bar01.xlsx
|
2336
2356
|
- test/regression/xlsx_files/chart_bar02.xlsx
|
2337
2357
|
- test/regression/xlsx_files/chart_bar03.xlsx
|