write_xlsx 1.02.0 → 1.08.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/Changes +72 -0
- data/README.md +1 -1
- data/examples/chart_data_labels.rb +320 -0
- data/examples/chart_line.rb +85 -10
- data/examples/tables.rb +77 -42
- data/lib/write_xlsx/chart/line.rb +15 -1
- data/lib/write_xlsx/chart/series.rb +100 -0
- data/lib/write_xlsx/chart.rb +155 -33
- data/lib/write_xlsx/drawing.rb +80 -17
- data/lib/write_xlsx/format.rb +5 -5
- data/lib/write_xlsx/package/app.rb +3 -3
- data/lib/write_xlsx/package/comments.rb +4 -4
- data/lib/write_xlsx/package/conditional_format.rb +2 -8
- data/lib/write_xlsx/package/packager.rb +1 -0
- data/lib/write_xlsx/package/relationships.rb +2 -2
- data/lib/write_xlsx/package/styles.rb +42 -11
- data/lib/write_xlsx/package/table.rb +16 -7
- data/lib/write_xlsx/package/vml.rb +20 -19
- data/lib/write_xlsx/sheets.rb +12 -20
- data/lib/write_xlsx/utility.rb +9 -3
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +76 -35
- data/lib/write_xlsx/worksheet/data_validation.rb +1 -6
- data/lib/write_xlsx/worksheet.rb +197 -57
- data/test/drawing/{test_write_ext.rb → test_write_xdr_ext.rb} +2 -2
- data/test/perl_output/chart_data_labels.xlsx +0 -0
- data/test/perl_output/chart_line.xlsx +0 -0
- data/test/perl_output/comments2.xlsx +0 -0
- data/test/perl_output/tables.xlsx +0 -0
- data/test/regression/images/red2.png +0 -0
- data/test/regression/test_array_formula04.rb +31 -0
- data/test/regression/test_chart_crossing01.rb +1 -1
- data/test/regression/test_chart_crossing05.rb +46 -0
- data/test/regression/test_chart_crossing06.rb +46 -0
- data/test/regression/test_chart_data_labels26.rb +44 -0
- data/test/regression/test_chart_data_labels27.rb +44 -0
- data/test/regression/test_chart_data_labels28.rb +52 -0
- data/test/regression/test_chart_data_labels29.rb +43 -0
- data/test/regression/test_chart_data_labels30.rb +46 -0
- data/test/regression/test_chart_data_labels31.rb +49 -0
- data/test/regression/test_chart_data_labels32.rb +54 -0
- data/test/regression/test_chart_data_labels33.rb +52 -0
- data/test/regression/test_chart_data_labels34.rb +54 -0
- data/test/regression/test_chart_data_labels35.rb +46 -0
- data/test/regression/test_chart_data_labels36.rb +54 -0
- data/test/regression/test_chart_data_labels37.rb +51 -0
- data/test/regression/test_chart_data_labels38.rb +54 -0
- data/test/regression/test_chart_data_labels39.rb +53 -0
- data/test/regression/test_chart_data_labels40.rb +53 -0
- data/test/regression/test_chart_data_labels41.rb +54 -0
- data/test/regression/test_chart_data_labels42.rb +58 -0
- data/test/regression/test_chart_data_labels43.rb +58 -0
- data/test/regression/test_chart_data_labels44.rb +56 -0
- data/test/regression/test_chart_data_labels45.rb +57 -0
- data/test/regression/test_chart_data_labels46.rb +61 -0
- data/test/regression/test_chart_data_labels47.rb +61 -0
- data/test/regression/test_chart_data_labels48.rb +55 -0
- data/test/regression/test_chart_data_labels49.rb +55 -0
- data/test/regression/test_chart_data_labels50.rb +57 -0
- data/test/regression/test_chart_line05.rb +43 -0
- data/test/regression/test_chart_line06.rb +43 -0
- data/test/regression/test_comment15.rb +28 -0
- data/test/regression/test_comment16.rb +34 -0
- data/test/regression/test_format16.rb +24 -0
- data/test/regression/test_format17.rb +24 -0
- data/test/regression/test_header04.rb +30 -0
- data/test/regression/test_header_image15.rb +36 -0
- data/test/regression/test_header_image16.rb +42 -0
- data/test/regression/test_header_image17.rb +46 -0
- data/test/regression/test_header_image18.rb +48 -0
- data/test/regression/test_header_image19.rb +36 -0
- data/test/regression/test_hyperlink48.rb +31 -0
- data/test/regression/test_hyperlink49.rb +29 -0
- data/test/regression/test_hyperlink50.rb +27 -0
- data/test/regression/test_hyperlink51.rb +27 -0
- data/test/regression/test_ignore_error01.rb +23 -0
- data/test/regression/test_ignore_error02.rb +24 -0
- data/test/regression/test_ignore_error03.rb +26 -0
- data/test/regression/test_ignore_error04.rb +26 -0
- data/test/regression/test_ignore_error05.rb +32 -0
- data/test/regression/test_ignore_error06.rb +32 -0
- data/test/regression/test_image45.rb +2 -1
- data/test/regression/test_image46.rb +1 -1
- data/test/regression/test_image48.rb +32 -0
- data/test/regression/test_image49.rb +38 -0
- data/test/regression/test_image50.rb +24 -0
- data/test/regression/test_image51.rb +30 -0
- data/test/regression/test_image52.rb +26 -0
- data/test/regression/test_image53.rb +26 -0
- data/test/regression/test_image54.rb +26 -0
- data/test/regression/test_image55.rb +27 -0
- data/test/regression/test_object_position12.rb +25 -0
- data/test/regression/test_object_position13.rb +25 -0
- data/test/regression/test_object_position14.rb +25 -0
- data/test/regression/test_object_position15.rb +29 -0
- data/test/regression/test_object_position16.rb +29 -0
- data/test/regression/test_object_position17.rb +29 -0
- data/test/regression/test_object_position18.rb +29 -0
- data/test/regression/test_object_position19.rb +29 -0
- data/test/regression/test_object_position20.rb +29 -0
- data/test/regression/test_protect04.rb +32 -0
- data/test/regression/test_protect05.rb +35 -0
- data/test/regression/test_protect06.rb +35 -0
- data/test/regression/test_protect07.rb +23 -0
- data/test/regression/test_table24.rb +27 -0
- data/test/regression/test_table25.rb +27 -0
- data/test/regression/test_table26.rb +38 -0
- data/test/regression/xlsx_files/array_formula04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_crossing05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_crossing06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels26.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels27.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels28.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels29.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels30.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels31.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels32.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels33.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels34.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels35.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels36.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels37.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels38.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels39.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels40.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels41.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels42.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels43.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels44.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels45.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels46.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels47.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels48.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels49.xlsx +0 -0
- data/test/regression/xlsx_files/chart_data_labels50.xlsx +0 -0
- data/test/regression/xlsx_files/chart_line05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_line06.xlsx +0 -0
- data/test/regression/xlsx_files/comment15.xlsx +0 -0
- data/test/regression/xlsx_files/comment16.xlsx +0 -0
- data/test/regression/xlsx_files/format16.xlsx +0 -0
- data/test/regression/xlsx_files/format17.xlsx +0 -0
- data/test/regression/xlsx_files/header04.xlsx +0 -0
- data/test/regression/xlsx_files/header_image15.xlsx +0 -0
- data/test/regression/xlsx_files/header_image16.xlsx +0 -0
- data/test/regression/xlsx_files/header_image17.xlsx +0 -0
- data/test/regression/xlsx_files/header_image18.xlsx +0 -0
- data/test/regression/xlsx_files/header_image19.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink46.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink50.xlsx +0 -0
- data/test/regression/xlsx_files/hyperlink51.xlsx +0 -0
- data/test/regression/xlsx_files/ignore_error01.xlsx +0 -0
- data/test/regression/xlsx_files/ignore_error02.xlsx +0 -0
- data/test/regression/xlsx_files/ignore_error03.xlsx +0 -0
- data/test/regression/xlsx_files/ignore_error04.xlsx +0 -0
- data/test/regression/xlsx_files/ignore_error05.xlsx +0 -0
- data/test/regression/xlsx_files/ignore_error06.xlsx +0 -0
- data/test/regression/xlsx_files/image45.xlsx +0 -0
- data/test/regression/xlsx_files/image46.xlsx +0 -0
- data/test/regression/xlsx_files/image48.xlsx +0 -0
- data/test/regression/xlsx_files/image49.xlsx +0 -0
- data/test/regression/xlsx_files/image50.xlsx +0 -0
- data/test/regression/xlsx_files/image51.xlsx +0 -0
- data/test/regression/xlsx_files/image52.xlsx +0 -0
- data/test/regression/xlsx_files/image53.xlsx +0 -0
- data/test/regression/xlsx_files/image54.xlsx +0 -0
- data/test/regression/xlsx_files/image55.xlsx +0 -0
- data/test/regression/xlsx_files/object_position12.xlsx +0 -0
- data/test/regression/xlsx_files/object_position13.xlsx +0 -0
- data/test/regression/xlsx_files/object_position14.xlsx +0 -0
- data/test/regression/xlsx_files/object_position15.xlsx +0 -0
- data/test/regression/xlsx_files/object_position16.xlsx +0 -0
- data/test/regression/xlsx_files/object_position17.xlsx +0 -0
- data/test/regression/xlsx_files/object_position18.xlsx +0 -0
- data/test/regression/xlsx_files/object_position19.xlsx +0 -0
- data/test/regression/xlsx_files/object_position20.xlsx +0 -0
- data/test/regression/xlsx_files/protect04.xlsx +0 -0
- data/test/regression/xlsx_files/protect05.xlsx +0 -0
- data/test/regression/xlsx_files/protect06.xlsx +0 -0
- data/test/regression/xlsx_files/protect07.xlsx +0 -0
- data/test/regression/xlsx_files/table24.xlsx +0 -0
- data/test/regression/xlsx_files/table25.xlsx +0 -0
- data/test/regression/xlsx_files/table26.xlsx +0 -0
- data/test/test_example_match.rb +433 -10
- data/test/utility/test_range.rb +20 -0
- data/test/workbook/test_check_sheetname.rb +0 -10
- data/write_xlsx.gemspec +1 -0
- metadata +323 -8
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels27 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels27
|
14
|
+
@xlsx = 'chart_data_labels27.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [48514944, 48516480])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5],
|
24
|
+
[ 2, 4, 6, 8, 10],
|
25
|
+
[ 3, 6, 9, 12, 15],
|
26
|
+
[10, 20, 30, 40, 50]
|
27
|
+
]
|
28
|
+
|
29
|
+
worksheet.write('A1', data)
|
30
|
+
|
31
|
+
chart.add_series(
|
32
|
+
:values => '=Sheet1!$A$1:$A$5',
|
33
|
+
:data_labels => {:value => 1, :custom => [{:value => '=Sheet1!$D$1'}]}
|
34
|
+
)
|
35
|
+
|
36
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
37
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
38
|
+
|
39
|
+
worksheet.insert_chart('E9', chart)
|
40
|
+
|
41
|
+
workbook.close
|
42
|
+
compare_for_regression
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels28 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels28
|
14
|
+
@xlsx = 'chart_data_labels28.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [48514944, 48516480])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5],
|
24
|
+
[ 2, 4, 6, 8, 10],
|
25
|
+
[ 3, 6, 9, 12, 15],
|
26
|
+
['foo', 'bar']
|
27
|
+
]
|
28
|
+
|
29
|
+
worksheet.write('A1', data)
|
30
|
+
|
31
|
+
custom = [
|
32
|
+
{:value => 123},
|
33
|
+
{:value => 'abc'},
|
34
|
+
nil,
|
35
|
+
{:formula => 'Sheet1!$D$1'},
|
36
|
+
{:formula => 'Sheet1!$D$2'}
|
37
|
+
]
|
38
|
+
|
39
|
+
chart.add_series(
|
40
|
+
:values => '=Sheet1!$A$1:$A$5',
|
41
|
+
:data_labels => {:value => 1, :custom => custom }
|
42
|
+
)
|
43
|
+
|
44
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
45
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
46
|
+
|
47
|
+
worksheet.insert_chart('E9', chart)
|
48
|
+
|
49
|
+
workbook.close
|
50
|
+
compare_for_regression
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels29 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels29
|
14
|
+
@xlsx = 'chart_data_labels29.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [67858816, 67863296])
|
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
|
+
:values => '=Sheet1!$A$1:$A$5',
|
32
|
+
:data_labels => {:value => 1, :custom => [{:delete => 1}] }
|
33
|
+
)
|
34
|
+
|
35
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
36
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
37
|
+
|
38
|
+
worksheet.insert_chart('E9', chart)
|
39
|
+
|
40
|
+
workbook.close
|
41
|
+
compare_for_regression
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels30 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels30
|
14
|
+
@xlsx = 'chart_data_labels30.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [67858816, 67863296])
|
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
|
+
:values => '=Sheet1!$A$1:$A$5',
|
32
|
+
:data_labels => {
|
33
|
+
:value => 1,
|
34
|
+
:custom => [{:delete => 1}, nil, {:delete => 1}, nil, {:delete => 1}]
|
35
|
+
}
|
36
|
+
)
|
37
|
+
|
38
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
39
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
40
|
+
|
41
|
+
worksheet.insert_chart('E9', chart)
|
42
|
+
|
43
|
+
workbook.close
|
44
|
+
compare_for_regression
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels31 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels31
|
14
|
+
@xlsx = 'chart_data_labels31.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [71248896, 71373568])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5],
|
24
|
+
[ 2, 4, 6, 8, 10],
|
25
|
+
[ 3, 6, 9, 12, 15],
|
26
|
+
[ 10, 20, 30, 40, 50]
|
27
|
+
]
|
28
|
+
|
29
|
+
worksheet.write('A1', data)
|
30
|
+
|
31
|
+
chart.add_series(
|
32
|
+
:values => '=Sheet1!$A$1:$A$5',
|
33
|
+
:data_labels => {
|
34
|
+
:value => 1,
|
35
|
+
:category => 1,
|
36
|
+
:series_name => 1,
|
37
|
+
:custom => [{:value => 33}]
|
38
|
+
}
|
39
|
+
)
|
40
|
+
|
41
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
42
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
43
|
+
|
44
|
+
worksheet.insert_chart('E9', chart)
|
45
|
+
|
46
|
+
workbook.close
|
47
|
+
compare_for_regression
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels32 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels32
|
14
|
+
@xlsx = 'chart_data_labels32.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [71374336, 71414144])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5],
|
24
|
+
[ 2, 4, 6, 8, 10],
|
25
|
+
[ 3, 6, 9, 12, 15],
|
26
|
+
[ 10, 20, 30, 40, 50]
|
27
|
+
]
|
28
|
+
|
29
|
+
worksheet.write('A1', data)
|
30
|
+
|
31
|
+
chart.add_series(
|
32
|
+
:values => '=Sheet1!$A$1:$A$5',
|
33
|
+
:data_labels => {
|
34
|
+
:value => 1,
|
35
|
+
:custom => [
|
36
|
+
{
|
37
|
+
:value => 33,
|
38
|
+
:font => {
|
39
|
+
:bold => 1, :italic => 1, :color => 'red', :baseline => -1
|
40
|
+
}
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
44
|
+
)
|
45
|
+
|
46
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
47
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
48
|
+
|
49
|
+
worksheet.insert_chart('E9', chart)
|
50
|
+
|
51
|
+
workbook.close
|
52
|
+
compare_for_regression
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels33 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels33
|
14
|
+
@xlsx = 'chart_data_labels33.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [65546112, 70217728])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5],
|
24
|
+
[ 2, 4, 6, 8, 10],
|
25
|
+
[ 3, 6, 9, 12, 15],
|
26
|
+
[ 10, 20, 30, 40, 50]
|
27
|
+
]
|
28
|
+
|
29
|
+
worksheet.write('A1', data)
|
30
|
+
|
31
|
+
chart.add_series(
|
32
|
+
:values => '=Sheet1!$A$1:$A$5',
|
33
|
+
:data_labels => {
|
34
|
+
:value => 1,
|
35
|
+
:custom => [
|
36
|
+
{:font => {
|
37
|
+
:bold => 1, :italic => 1, :baseline => -1
|
38
|
+
}
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
42
|
+
)
|
43
|
+
|
44
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
45
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
46
|
+
|
47
|
+
worksheet.insert_chart('E9', chart)
|
48
|
+
|
49
|
+
workbook.close
|
50
|
+
compare_for_regression
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels34 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels34
|
14
|
+
@xlsx = 'chart_data_labels34.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [48497792, 48499712])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5],
|
24
|
+
[ 2, 4, 6, 8, 10],
|
25
|
+
[ 3, 6, 9, 12, 15],
|
26
|
+
[ 10, 20, 30, 40, 50]
|
27
|
+
]
|
28
|
+
|
29
|
+
worksheet.write('A1', data)
|
30
|
+
|
31
|
+
chart.add_series(
|
32
|
+
:values => '=Sheet1!$A$1:$A$5',
|
33
|
+
:data_labels => {
|
34
|
+
:value => 1,
|
35
|
+
:custom => [
|
36
|
+
{
|
37
|
+
:value => '=Sheet1!$D$1',
|
38
|
+
:font => {
|
39
|
+
:bold => 1, :italic => 1, :color => 'red', :baseline => -1
|
40
|
+
}
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
44
|
+
)
|
45
|
+
|
46
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
47
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
48
|
+
|
49
|
+
worksheet.insert_chart('E9', chart)
|
50
|
+
|
51
|
+
workbook.close
|
52
|
+
compare_for_regression
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels35 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels35
|
14
|
+
@xlsx = 'chart_data_labels35.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [48498944, 48508928])
|
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
|
+
:values => '=Sheet1!$A$1:$A$5',
|
32
|
+
:data_labels => {
|
33
|
+
:value => 1,
|
34
|
+
:border => { :color => 'red' }
|
35
|
+
}
|
36
|
+
)
|
37
|
+
|
38
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
39
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
40
|
+
|
41
|
+
worksheet.insert_chart('E9', chart)
|
42
|
+
|
43
|
+
workbook.close
|
44
|
+
compare_for_regression
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels36 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels36
|
14
|
+
@xlsx = 'chart_data_labels36.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'pie', :embedded => 1)
|
18
|
+
|
19
|
+
data = [
|
20
|
+
[ 1, 2, 3, 4, 5],
|
21
|
+
[ 2, 4, 6, 8, 10],
|
22
|
+
[ 3, 6, 9, 12, 15]
|
23
|
+
]
|
24
|
+
|
25
|
+
worksheet.write('A1', data)
|
26
|
+
|
27
|
+
chart.add_series(
|
28
|
+
:values => '=Sheet1!$A$1:$A$5',
|
29
|
+
:data_labels => {
|
30
|
+
:value => 1,
|
31
|
+
:category => 1,
|
32
|
+
:series_name => 1,
|
33
|
+
:percentage => 1,
|
34
|
+
:separator => ';',
|
35
|
+
:leader_lines => 1,
|
36
|
+
:position => 'inside_end',
|
37
|
+
:legend_key => 1,
|
38
|
+
:num_format => '#,##0.00',
|
39
|
+
:font => {
|
40
|
+
:name => 'Consolas',
|
41
|
+
:baseline => -1,
|
42
|
+
:pitch_family => 49,
|
43
|
+
:charset => 0
|
44
|
+
},
|
45
|
+
:border => { :color => 'red' }
|
46
|
+
}
|
47
|
+
)
|
48
|
+
|
49
|
+
worksheet.insert_chart('E9', chart)
|
50
|
+
|
51
|
+
workbook.close
|
52
|
+
compare_for_regression
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels37 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels37
|
14
|
+
@xlsx = 'chart_data_labels37.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [48498944, 48508928])
|
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
|
+
:values => '=Sheet1!$A$1:$A$5',
|
32
|
+
:data_labels => {
|
33
|
+
:value => 1,
|
34
|
+
:border => {
|
35
|
+
:color => 'red',
|
36
|
+
:width => 1,
|
37
|
+
:dash_type => 'dash'
|
38
|
+
},
|
39
|
+
:fill => { :color => '#00B050' }
|
40
|
+
}
|
41
|
+
)
|
42
|
+
|
43
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
44
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
45
|
+
|
46
|
+
worksheet.insert_chart('E9', chart)
|
47
|
+
|
48
|
+
workbook.close
|
49
|
+
compare_for_regression
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels38 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels38
|
14
|
+
@xlsx = 'chart_data_labels38.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [48498944, 48508928])
|
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
|
+
:values => '=Sheet1!$A$1:$A$5',
|
32
|
+
:data_labels => {
|
33
|
+
:value => 1,
|
34
|
+
:border => {
|
35
|
+
:color => 'red',
|
36
|
+
:width => 1,
|
37
|
+
:dash_type => 'dash'
|
38
|
+
},
|
39
|
+
:pattern => {
|
40
|
+
:pattern => 'light_vertical',
|
41
|
+
:fg_color => '#00B050'
|
42
|
+
}
|
43
|
+
}
|
44
|
+
)
|
45
|
+
|
46
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
47
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
48
|
+
|
49
|
+
worksheet.insert_chart('E9', chart)
|
50
|
+
|
51
|
+
workbook.close
|
52
|
+
compare_for_regression
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDataLabels39 < Minitest::Test
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
@tempfile.close(true)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_data_labels39
|
14
|
+
@xlsx = 'chart_data_labels39.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@io)
|
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, [56179712, 56185600])
|
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
|
+
:values => '=Sheet1!$A$1:$A$5',
|
32
|
+
:data_labels => {
|
33
|
+
:value => 1,
|
34
|
+
:border => {
|
35
|
+
:color => 'red',
|
36
|
+
:width => 1,
|
37
|
+
:dash_type => 'dash'
|
38
|
+
},
|
39
|
+
:gradient => {
|
40
|
+
:colors => ['#DDEBCF', '#9CB86E', '#156B13']
|
41
|
+
}
|
42
|
+
}
|
43
|
+
)
|
44
|
+
|
45
|
+
chart.add_series(:values => '=Sheet1!$B$1:$B$5')
|
46
|
+
chart.add_series(:values => '=Sheet1!$C$1:$C$5')
|
47
|
+
|
48
|
+
worksheet.insert_chart('E9', chart)
|
49
|
+
|
50
|
+
workbook.close
|
51
|
+
compare_for_regression
|
52
|
+
end
|
53
|
+
end
|