write_xlsx 0.62.0 → 0.64.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +14 -1
- data/examples/chart_data_tools.rb +215 -0
- data/examples/chart_pie.rb +36 -5
- data/examples/sparklines2.rb +1 -1
- data/examples/tab_colors.rb +3 -3
- data/lib/write_xlsx/chart.rb +559 -516
- data/lib/write_xlsx/chart/area.rb +4 -1
- data/lib/write_xlsx/chart/axis.rb +132 -0
- data/lib/write_xlsx/chart/bar.rb +17 -9
- data/lib/write_xlsx/chart/column.rb +9 -1
- data/lib/write_xlsx/chart/line.rb +24 -0
- data/lib/write_xlsx/chart/radar.rb +2 -2
- data/lib/write_xlsx/chart/scatter.rb +19 -0
- data/lib/write_xlsx/chart/stock.rb +10 -3
- data/lib/write_xlsx/drawing.rb +43 -44
- data/lib/write_xlsx/package/vml.rb +21 -14
- data/lib/write_xlsx/shape.rb +173 -22
- data/lib/write_xlsx/sparkline.rb +524 -0
- data/lib/write_xlsx/version.rb +1 -1
- data/lib/write_xlsx/workbook.rb +183 -115
- data/lib/write_xlsx/worksheet.rb +821 -1073
- data/lib/write_xlsx/worksheet/cell_data.rb +132 -0
- data/lib/write_xlsx/worksheet/print_style.rb +51 -0
- data/test/chart/test_add_series.rb +31 -6
- data/test/chart/test_write_d_lbls.rb +18 -18
- data/test/chart/test_write_number_format.rb +20 -24
- data/test/drawing/test_drawing_shape_01.rb +1 -1
- data/test/drawing/test_drawing_shape_02.rb +2 -2
- data/test/drawing/test_drawing_shape_03.rb +5 -5
- data/test/drawing/test_drawing_shape_04.rb +3 -3
- data/test/drawing/test_drawing_shape_05.rb +4 -4
- data/test/drawing/test_drawing_shape_07.rb +2 -2
- data/test/perl_output/chart_data_tools.xlsx +0 -0
- data/test/perl_output/chart_pie.xlsx +0 -0
- data/test/regression/disabled_test_vml04.rb +2 -2
- data/test/regression/test_chart_drop_lines01.rb +46 -0
- data/test/regression/test_chart_drop_lines02.rb +51 -0
- data/test/regression/test_chart_drop_lines03.rb +46 -0
- data/test/regression/test_chart_drop_lines04.rb +64 -0
- data/test/regression/test_chart_errorbars01.rb +47 -0
- data/test/regression/test_chart_errorbars02.rb +57 -0
- data/test/regression/test_chart_errorbars03.rb +53 -0
- data/test/regression/test_chart_errorbars04.rb +48 -0
- data/test/regression/test_chart_errorbars05.rb +47 -0
- data/test/regression/test_chart_errorbars06.rb +47 -0
- data/test/regression/test_chart_errorbars07.rb +66 -0
- data/test/regression/test_chart_font02.rb +1 -1
- data/test/regression/test_chart_font06.rb +1 -1
- data/test/regression/test_chart_gridlines04.rb +2 -1
- data/test/regression/test_chart_gridlines08.rb +2 -1
- data/test/regression/test_chart_points01.rb +37 -0
- data/test/regression/test_chart_points02.rb +40 -0
- data/test/regression/test_chart_points03.rb +42 -0
- data/test/regression/test_chart_points04.rb +52 -0
- data/test/regression/test_chart_points05.rb +49 -0
- data/test/regression/test_chart_points06.rb +49 -0
- data/test/regression/test_chartsheet05.rb +1 -1
- data/test/regression/test_chartsheet06.rb +1 -1
- data/test/regression/test_comment01.rb +1 -1
- data/test/regression/test_comment02.rb +1 -1
- data/test/regression/test_comment03.rb +1 -1
- data/test/regression/test_comment04.rb +2 -2
- data/test/regression/test_comment06.rb +1 -1
- data/test/regression/test_comment07.rb +1 -1
- data/test/regression/test_comment08.rb +1 -1
- data/test/regression/test_comment09.rb +1 -1
- data/test/regression/test_comment10.rb +1 -1
- data/test/regression/test_default_row04.rb +1 -1
- data/test/regression/test_escapes02.rb +1 -1
- data/test/regression/test_hyperlink15.rb +2 -2
- data/test/regression/test_shape_connect01.rb +6 -6
- data/test/regression/test_shape_connect02.rb +6 -6
- data/test/regression/test_shape_connect03.rb +11 -11
- data/test/regression/test_shape_connect04.rb +10 -10
- data/test/regression/test_shape_scale01.rb +2 -2
- data/test/regression/test_shape_stencil01.rb +3 -3
- data/test/regression/test_tab_color01.rb +1 -1
- data/test/regression/test_table04.rb +1 -1
- data/test/regression/test_table05.rb +1 -1
- data/test/regression/test_table06.rb +1 -1
- data/test/regression/test_vml01.rb +1 -1
- data/test/regression/test_vml02.rb +1 -1
- data/test/regression/test_vml03.rb +2 -2
- data/test/regression/xlsx_files/chart_drop_lines01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_drop_lines02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_drop_lines03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_drop_lines04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_errorbars07.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_points06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_stock02.xlsx +0 -0
- data/test/test_example_match.rb +278 -57
- data/test/worksheet/test_convert_date_time_02.rb +427 -433
- data/test/worksheet/test_convert_date_time_03.rb +1 -1
- data/test/worksheet/test_write_sheet_pr.rb +2 -2
- data/test/worksheet/test_write_sheet_view1.rb +2 -2
- metadata +80 -10
@@ -7,8 +7,8 @@ class DrawingShape02 < Test::Unit::TestCase
|
|
7
7
|
def test_drawing_shape_02
|
8
8
|
shape = Writexlsx::Shape.new
|
9
9
|
# Set shape properties via []= method
|
10
|
-
shape
|
11
|
-
shape
|
10
|
+
shape.id = 1000
|
11
|
+
shape.name = 'Connector 1'
|
12
12
|
|
13
13
|
# Set bulk shape properties via set_properties method
|
14
14
|
shape.set_properties(:type => 'straightConnector1', :connect => 1)
|
@@ -7,11 +7,11 @@ class DrawingShape03 < Test::Unit::TestCase
|
|
7
7
|
def test_drawing_shape_03
|
8
8
|
shape = Writexlsx::Shape.new
|
9
9
|
# Set shape properties via []= method
|
10
|
-
shape
|
11
|
-
shape
|
12
|
-
shape
|
13
|
-
shape
|
14
|
-
shape
|
10
|
+
shape.id = 1000
|
11
|
+
shape.start = 1001
|
12
|
+
shape.start_index = 1
|
13
|
+
shape.end = 1002
|
14
|
+
shape.end_index = 4
|
15
15
|
|
16
16
|
@obj = Writexlsx::Drawing.new
|
17
17
|
@obj.embedded = 1
|
@@ -16,8 +16,8 @@ def test_drawing_shape_04
|
|
16
16
|
shape = Writexlsx::Shape.new(:text => 'test', :id => 1000)
|
17
17
|
|
18
18
|
# Mock up the color palette.
|
19
|
-
shape
|
20
|
-
shape
|
19
|
+
shape.palette[0] = [0x00, 0x00, 0x00, 0x00]
|
20
|
+
shape.palette[7] = [0x00, 0x00, 0x00, 0x00]
|
21
21
|
|
22
22
|
@obj = Writexlsx::Drawing.new
|
23
23
|
@obj.embedded = 2
|
@@ -36,7 +36,7 @@ def test_drawing_shape_04
|
|
36
36
|
inserted = @worksheet.insert_shape(4, 8, shape, 300, 400)
|
37
37
|
|
38
38
|
# Force the shape cell x offset to be non-integer
|
39
|
-
inserted
|
39
|
+
inserted.x_offset += 0.5
|
40
40
|
@worksheet.__send__(:prepare_shape, 0, 1)
|
41
41
|
|
42
42
|
# Truncate drawing object to just the dimensions
|
@@ -14,10 +14,10 @@ def setup
|
|
14
14
|
|
15
15
|
def test_drawing_shape_05
|
16
16
|
shape = Writexlsx::Shape.new
|
17
|
-
shape
|
18
|
-
shape
|
19
|
-
shape
|
20
|
-
shape
|
17
|
+
shape.id = 1000
|
18
|
+
shape.flip_v = 1
|
19
|
+
shape.flip_h = 1
|
20
|
+
shape.rotation = 90
|
21
21
|
|
22
22
|
@obj = Writexlsx::Drawing.new
|
23
23
|
@obj.instance_variable_set(:@palette, @worksheet.instance_variable_get(:@palette))
|
Binary file
|
Binary file
|
@@ -26,8 +26,8 @@ def test_vml04
|
|
26
26
|
worksheet3.write_comment('A1', 'More text')
|
27
27
|
|
28
28
|
# Set the author to match the target XLSX file.
|
29
|
-
worksheet1.
|
30
|
-
worksheet3.
|
29
|
+
worksheet1.comments_author = 'John'
|
30
|
+
worksheet3.comments_author = 'John'
|
31
31
|
|
32
32
|
worksheet1.insert_button('B2', {})
|
33
33
|
worksheet1.insert_button('C4', {})
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDropLines01 < 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_drop_lines01
|
14
|
+
@xlsx = 'chart_drop_lines01.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'line', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [48034944, 48036864])
|
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.set_drop_lines
|
31
|
+
|
32
|
+
chart.add_series(
|
33
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
34
|
+
:values => '=Sheet1!$B$1:$B$5'
|
35
|
+
)
|
36
|
+
chart.add_series(
|
37
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
38
|
+
:values => '=Sheet1!$C$1:$C$5'
|
39
|
+
)
|
40
|
+
|
41
|
+
worksheet.insert_chart('E9', chart)
|
42
|
+
|
43
|
+
workbook.close
|
44
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDropLines02 < 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_drop_lines02
|
14
|
+
@xlsx = 'chart_drop_lines02.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'line', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [70938624, 70940160])
|
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.set_drop_lines(
|
31
|
+
:line => {
|
32
|
+
:color => 'red',
|
33
|
+
:dash_type => 'square_dot'
|
34
|
+
}
|
35
|
+
)
|
36
|
+
|
37
|
+
chart.add_series(
|
38
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
39
|
+
:values => '=Sheet1!$B$1:$B$5'
|
40
|
+
)
|
41
|
+
chart.add_series(
|
42
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
43
|
+
:values => '=Sheet1!$C$1:$C$5'
|
44
|
+
)
|
45
|
+
|
46
|
+
worksheet.insert_chart('E9', chart)
|
47
|
+
|
48
|
+
workbook.close
|
49
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDropLines03 < 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_drop_lines03
|
14
|
+
@xlsx = 'chart_drop_lines03.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'area', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [61151872, 63947136])
|
21
|
+
|
22
|
+
data = [
|
23
|
+
[ 1, 2, 3, 4, 5 ],
|
24
|
+
[ 2, 4, 6, 8, 10 ],
|
25
|
+
[ 3, 6, 1, 12, 15 ]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.set_drop_lines
|
31
|
+
|
32
|
+
chart.add_series(
|
33
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
34
|
+
:values => '=Sheet1!$B$1:$B$5'
|
35
|
+
)
|
36
|
+
chart.add_series(
|
37
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
38
|
+
:values => '=Sheet1!$C$1:$C$5'
|
39
|
+
)
|
40
|
+
|
41
|
+
worksheet.insert_chart('E9', chart)
|
42
|
+
|
43
|
+
workbook.close
|
44
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartDropLines04 < 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_drop_lines04
|
14
|
+
@xlsx = 'chart_drop_lines04.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'stock', :embedded => 1)
|
18
|
+
data_format = workbook.add_format(:num_format => 14)
|
19
|
+
|
20
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
21
|
+
chart.instance_variable_set(:@axis_ids, [49019520, 49222016])
|
22
|
+
|
23
|
+
data = [
|
24
|
+
[ '2007-01-01T', '2007-01-02T', '2007-01-03T', '2007-01-04T', '2007-01-05T' ],
|
25
|
+
[ 27.2, 25.03, 19.05, 20.34, 18.5 ],
|
26
|
+
[ 23.49, 19.55, 15.12, 17.84, 16.34 ],
|
27
|
+
[ 25.45, 23.05, 17.32, 20.45, 17.34 ]
|
28
|
+
]
|
29
|
+
|
30
|
+
(0..4).each do |row|
|
31
|
+
worksheet.write_date_time(row, 0, data[0][row], data_format)
|
32
|
+
worksheet.write(row, 1, data[1][row])
|
33
|
+
worksheet.write(row, 2, data[2][row])
|
34
|
+
worksheet.write(row, 3, data[3][row])
|
35
|
+
end
|
36
|
+
|
37
|
+
worksheet.set_column('A:D', 11)
|
38
|
+
|
39
|
+
chart.set_drop_lines
|
40
|
+
|
41
|
+
chart.add_series(
|
42
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
43
|
+
:values => '=Sheet1!$B$1:$B$5'
|
44
|
+
)
|
45
|
+
chart.add_series(
|
46
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
47
|
+
:values => '=Sheet1!$C$1:$C$5'
|
48
|
+
)
|
49
|
+
chart.add_series(
|
50
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
51
|
+
:values => '=Sheet1!$D$1:$D$5'
|
52
|
+
)
|
53
|
+
|
54
|
+
chart.set_drop_lines
|
55
|
+
|
56
|
+
worksheet.insert_chart('E9', chart)
|
57
|
+
|
58
|
+
workbook.close
|
59
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
60
|
+
[],
|
61
|
+
{ 'xl/charts/chart1.xml' => [ '<c:formatCode', ] }
|
62
|
+
)
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartErrorbars01 < 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_errorbars01
|
14
|
+
@xlsx = 'chart_errorbars01.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'line', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [63386752, 63388288])
|
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
|
+
:y_error_bars => { :type => 'standard_error' }
|
34
|
+
)
|
35
|
+
|
36
|
+
chart.add_series(
|
37
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
38
|
+
:values => '=Sheet1!$C$1:$C$5'
|
39
|
+
)
|
40
|
+
|
41
|
+
worksheet.insert_chart('E9', chart)
|
42
|
+
|
43
|
+
workbook.close
|
44
|
+
compare_xlsx_for_regression(
|
45
|
+
File.join(@regression_output, @xlsx), @xlsx)
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartErrorbars02 < 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_errorbars02
|
14
|
+
@xlsx = 'chart_errorbars02.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'line', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [63385984, 63387904])
|
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
|
+
:y_error_bars => {
|
34
|
+
:type => 'fixed',
|
35
|
+
:value => 2,
|
36
|
+
:end_style => 0,
|
37
|
+
:direction => 'minus'
|
38
|
+
}
|
39
|
+
)
|
40
|
+
|
41
|
+
chart.add_series(
|
42
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
43
|
+
:values => '=Sheet1!$C$1:$C$5',
|
44
|
+
:y_error_bars => {
|
45
|
+
:type => 'percentage',
|
46
|
+
:value => 5,
|
47
|
+
:direction => 'plus'
|
48
|
+
}
|
49
|
+
)
|
50
|
+
|
51
|
+
worksheet.insert_chart('E9', chart)
|
52
|
+
|
53
|
+
workbook.close
|
54
|
+
compare_xlsx_for_regression(
|
55
|
+
File.join(@regression_output, @xlsx), @xlsx)
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartErrorbars03 < 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_errorbars03
|
14
|
+
@xlsx = 'chart_errorbars03.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'line', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [52288896, 53605504])
|
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
|
+
:y_error_bars => {
|
34
|
+
:type => 'standard_error',
|
35
|
+
:line => {
|
36
|
+
:color => 'red',
|
37
|
+
:dash_type => 'round_dot'
|
38
|
+
}
|
39
|
+
}
|
40
|
+
)
|
41
|
+
|
42
|
+
chart.add_series(
|
43
|
+
:categories => '=Sheet1!$A$1:$A$5',
|
44
|
+
:values => '=Sheet1!$C$1:$C$5'
|
45
|
+
)
|
46
|
+
|
47
|
+
worksheet.insert_chart('E9', chart)
|
48
|
+
|
49
|
+
workbook.close
|
50
|
+
compare_xlsx_for_regression(
|
51
|
+
File.join(@regression_output, @xlsx), @xlsx)
|
52
|
+
end
|
53
|
+
end
|