write_xlsx 0.51.0 → 0.54.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +39 -0
- data/Gemfile +4 -14
- data/LICENSE.txt +3 -1
- data/README.rdoc +5 -0
- data/Rakefile +4 -71
- data/examples/chart_radar.rb +127 -0
- data/examples/chart_secondary_axis.rb +1 -1
- data/lib/write_xlsx/chart/area.rb +7 -18
- data/lib/write_xlsx/chart/bar.rb +20 -23
- data/lib/write_xlsx/chart/column.rb +7 -20
- data/lib/write_xlsx/chart/radar.rb +94 -0
- data/lib/write_xlsx/chart/stock.rb +6 -0
- data/lib/write_xlsx/chart.rb +317 -116
- data/lib/write_xlsx/package/xml_writer_simple.rb +2 -2
- data/lib/write_xlsx/version.rb +5 -0
- data/test/chart/test_write_a_latin.rb +22 -0
- data/test/chart/test_write_auto.rb +1 -1
- data/test/chart/test_write_ax_id.rb +1 -1
- data/test/chart/test_write_ax_pos.rb +1 -1
- data/test/chart/test_write_cross_ax.rb +1 -1
- data/test/chart/test_write_crosses.rb +1 -1
- data/test/chart/test_write_d_lbls.rb +18 -18
- data/test/chart/test_write_idx.rb +1 -1
- data/test/chart/test_write_label_align.rb +1 -1
- data/test/chart/test_write_label_offset.rb +1 -1
- data/test/chart/test_write_lang.rb +1 -1
- data/test/chart/test_write_layout.rb +1 -1
- data/test/chart/test_write_legend.rb +1 -1
- data/test/chart/test_write_legend_pos.rb +1 -1
- data/test/chart/test_write_major_gridlines.rb +2 -2
- data/test/chart/test_write_marker.rb +1 -1
- data/test/chart/test_write_marker_size.rb +1 -1
- data/test/chart/test_write_marker_value.rb +1 -1
- data/test/chart/test_write_num_cache.rb +1 -1
- data/test/chart/test_write_number_format.rb +40 -2
- data/test/chart/test_write_order.rb +1 -1
- data/test/chart/test_write_orientation.rb +1 -1
- data/test/chart/test_write_page_margins.rb +1 -1
- data/test/chart/test_write_page_setup.rb +1 -1
- data/test/chart/test_write_plot_vis_only.rb +1 -1
- data/test/chart/test_write_pt_count.rb +1 -1
- data/test/chart/test_write_style.rb +1 -1
- data/test/chart/test_write_symbol.rb +1 -1
- data/test/chart/test_write_tick_lbl_pos.rb +1 -1
- data/test/drawing/test_write_a_graphic_frame_locks.rb +1 -1
- data/test/drawing/test_write_c_chart.rb +1 -1
- data/test/drawing/test_write_c_nv_graphic_frame_pr.rb +2 -2
- data/test/drawing/test_write_c_nv_pr.rb +1 -1
- data/test/drawing/test_write_ext.rb +1 -1
- data/test/drawing/test_write_pos.rb +1 -1
- data/test/drawing/test_write_xfrm_extension.rb +1 -1
- data/test/drawing/test_write_xfrm_offset.rb +1 -1
- data/test/helper.rb +1 -1
- data/test/package/content_types/test_write_default.rb +1 -1
- data/test/package/content_types/test_write_override.rb +1 -1
- data/test/package/table/test_write_auto_filter.rb +1 -1
- data/test/package/table/test_write_table_column.rb +1 -1
- data/test/package/table/test_write_table_style_info.rb +1 -1
- data/test/package/vml/test_write_fill.rb +1 -1
- data/test/package/vml/test_write_idmap.rb +1 -1
- data/test/package/vml/test_write_move_with_cells.rb +1 -1
- data/test/package/vml/test_write_path.rb +2 -2
- data/test/package/vml/test_write_shadow.rb +1 -1
- data/test/package/vml/test_write_shapelayout.rb +1 -1
- data/test/package/vml/test_write_shapetype.rb +1 -1
- data/test/package/vml/test_write_size_with_cells.rb +1 -1
- data/test/package/vml/test_write_stroke.rb +1 -1
- data/test/perl_output/chart_radar.xlsx +0 -0
- data/test/perl_output/chart_secondary_axis.xlsx +0 -0
- data/test/regression/test_chart_axis22.rb +45 -0
- data/test/regression/test_chart_axis23.rb +46 -0
- data/test/regression/test_chart_axis24.rb +46 -0
- data/test/regression/test_chart_font01.rb +54 -0
- data/test/regression/test_chart_font02.rb +56 -0
- data/test/regression/test_chart_font03.rb +59 -0
- data/test/regression/test_chart_font04.rb +57 -0
- data/test/regression/test_chart_font05.rb +54 -0
- data/test/regression/test_chart_font06.rb +84 -0
- data/test/regression/test_chart_radar01.rb +39 -0
- data/test/regression/test_chart_radar02.rb +43 -0
- data/test/regression/test_chart_radar03.rb +43 -0
- data/test/regression/test_escapes04.rb +30 -0
- data/test/regression/test_escapes05.rb +31 -0
- data/test/regression/test_rich_string01.rb +1 -1
- data/test/regression/test_rich_string02.rb +1 -1
- data/test/regression/test_rich_string03.rb +1 -1
- data/test/regression/test_rich_string04.rb +1 -1
- data/test/regression/test_rich_string05.rb +1 -1
- data/test/regression/test_rich_string06.rb +1 -1
- data/test/regression/test_rich_string07.rb +1 -1
- data/test/regression/test_rich_string08.rb +1 -1
- data/test/regression/test_rich_string09.rb +1 -1
- data/test/regression/test_rich_string10.rb +1 -1
- data/test/regression/test_rich_string11.rb +1 -1
- data/test/regression/test_shape_connect01.rb +1 -1
- data/test/regression/test_shape_connect02.rb +1 -1
- data/test/regression/test_shape_connect03.rb +1 -1
- data/test/regression/test_shape_connect04.rb +1 -1
- data/test/regression/xlsx_files/chart_axis22.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis23.xlsx +0 -0
- data/test/regression/xlsx_files/chart_axis24.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font03.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font05.xlsx +0 -0
- data/test/regression/xlsx_files/chart_font06.xlsx +0 -0
- data/test/regression/xlsx_files/chart_radar01.xlsx +0 -0
- data/test/regression/xlsx_files/chart_radar02.xlsx +0 -0
- data/test/regression/xlsx_files/chart_radar03.xlsx +0 -0
- data/test/regression/xlsx_files/escapes04.xlsx +0 -0
- data/test/regression/xlsx_files/escapes05.xlsx +0 -0
- data/test/test_example_match.rb +119 -1
- data/test/test_xml_writer_simple.rb +4 -4
- data/test/worksheet/test_write_autofilter.rb +21 -21
- data/test/worksheet/test_write_brk.rb +1 -1
- data/test/worksheet/test_write_col_breaks.rb +2 -2
- data/test/worksheet/test_write_col_info.rb +6 -6
- data/test/worksheet/test_write_custom_filter.rb +1 -1
- data/test/worksheet/test_write_custom_filters.rb +2 -2
- data/test/worksheet/test_write_dimension.rb +9 -9
- data/test/worksheet/test_write_ext.rb +1 -1
- data/test/worksheet/test_write_ext_lst.rb +1 -1
- data/test/worksheet/test_write_filter.rb +1 -1
- data/test/worksheet/test_write_filter_column.rb +1 -1
- data/test/worksheet/test_write_filters.rb +3 -3
- data/test/worksheet/test_write_hyperlink.rb +4 -4
- data/test/worksheet/test_write_hyperlinks.rb +2 -2
- data/test/worksheet/test_write_legacy_drawing.rb +1 -1
- data/test/worksheet/test_write_merge_cell.rb +1 -1
- data/test/worksheet/test_write_mx_plv.rb +1 -1
- data/test/worksheet/test_write_page_margins.rb +11 -11
- data/test/worksheet/test_write_page_set_up_pr.rb +1 -1
- data/test/worksheet/test_write_page_setup.rb +4 -4
- data/test/worksheet/test_write_pane.rb +14 -14
- data/test/worksheet/test_write_phonetic_pr.rb +1 -1
- data/test/worksheet/test_write_print_options.rb +5 -5
- data/test/worksheet/test_write_row_breaks.rb +2 -2
- data/test/worksheet/test_write_row_element.rb +1 -1
- data/test/worksheet/test_write_selection.rb +1 -1
- data/test/worksheet/test_write_sheet_calc_pr.rb +1 -1
- data/test/worksheet/test_write_sheet_data.rb +1 -1
- data/test/worksheet/test_write_sheet_format_pr.rb +1 -1
- data/test/worksheet/test_write_sheet_pr.rb +3 -3
- data/test/worksheet/test_write_sheet_protection.rb +18 -18
- data/test/worksheet/test_write_sheet_view.rb +6 -6
- data/test/worksheet/test_write_sheet_view1.rb +6 -6
- data/test/worksheet/test_write_sheet_view2.rb +5 -5
- data/test/worksheet/test_write_sheet_view3.rb +8 -8
- data/test/worksheet/test_write_sheet_view4.rb +8 -8
- data/test/worksheet/test_write_sheet_view5.rb +7 -7
- data/test/worksheet/test_write_sheet_view6.rb +4 -4
- data/test/worksheet/test_write_sheet_view7.rb +6 -6
- data/test/worksheet/test_write_sheet_view8.rb +4 -4
- data/test/worksheet/test_write_sheet_view9.rb +4 -4
- data/test/worksheet/test_write_tab_color.rb +1 -1
- data/write_xlsx.gemspec +18 -935
- metadata +881 -32
- data/VERSION +0 -1
- data/test/chart/test_write_num_fmt.rb +0 -16
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartRadar01 < 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_radar01
|
14
|
+
@xlsx = 'chart_radar01.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'radar', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [56801152, 56802688])
|
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
|
+
worksheet.insert_chart('E9', chart)
|
35
|
+
|
36
|
+
workbook.close
|
37
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartRadar02 < 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_radar02
|
14
|
+
@xlsx = 'chart_radar02.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(
|
18
|
+
:type => 'radar',
|
19
|
+
:embedded => 1,
|
20
|
+
:subtype => 'with_markers'
|
21
|
+
)
|
22
|
+
|
23
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
24
|
+
chart.instance_variable_set(:@axis_ids, [48543616, 48545152])
|
25
|
+
|
26
|
+
data = [
|
27
|
+
[1, 2, 3, 4, 5],
|
28
|
+
[2, 4, 6, 8, 10],
|
29
|
+
[3, 6, 9, 12, 15]
|
30
|
+
]
|
31
|
+
|
32
|
+
worksheet.write('A1', data)
|
33
|
+
|
34
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
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_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartRadar03 < 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_radar03
|
14
|
+
@xlsx = 'chart_radar03.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(
|
18
|
+
:type => 'radar',
|
19
|
+
:embedded => 1,
|
20
|
+
:subtype => 'filled'
|
21
|
+
)
|
22
|
+
|
23
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
24
|
+
chart.instance_variable_set(:@axis_ids, [56802304, 56845440])
|
25
|
+
|
26
|
+
data = [
|
27
|
+
[1, 2, 3, 4, 5],
|
28
|
+
[2, 4, 6, 8, 10],
|
29
|
+
[3, 6, 9, 12, 15]
|
30
|
+
]
|
31
|
+
|
32
|
+
worksheet.write('A1', data)
|
33
|
+
|
34
|
+
chart.add_series(:values => '=Sheet1!$A$1:$A$5')
|
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_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionEscapes04 < 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_escapes04
|
14
|
+
@xlsx = 'escapes04.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
|
18
|
+
worksheet.write_url('A1', 'http://www.perl.com/?a=1&b=2')
|
19
|
+
|
20
|
+
workbook.close
|
21
|
+
compare_xlsx_for_regression(
|
22
|
+
File.join(@regression_output, @xlsx),
|
23
|
+
@xlsx,
|
24
|
+
nil,
|
25
|
+
{
|
26
|
+
'xl/workbook.xml' => ['<workbookView']
|
27
|
+
}
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionEscapes05 < 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_escapes05
|
14
|
+
@xlsx = 'escapes05.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet1 = workbook.add_worksheet('Start')
|
17
|
+
worksheet2 = workbook.add_worksheet('A & B')
|
18
|
+
|
19
|
+
worksheet1.write_url('A1', "internal:'A & B'!A1", 'Jump to A & B')
|
20
|
+
|
21
|
+
workbook.close
|
22
|
+
compare_xlsx_for_regression(
|
23
|
+
File.join(@regression_output, @xlsx),
|
24
|
+
@xlsx,
|
25
|
+
nil,
|
26
|
+
{
|
27
|
+
'xl/workbook.xml' => ['<workbookView']
|
28
|
+
}
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
@@ -23,6 +23,6 @@ class TestRegressionRichString01 < Test::Unit::TestCase
|
|
23
23
|
worksheet.write_rich_string('A3', 'a', bold, 'bc', 'defg')
|
24
24
|
|
25
25
|
workbook.close
|
26
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
26
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
27
27
|
end
|
28
28
|
end
|
@@ -23,6 +23,6 @@ class TestRegressionRichString02 < Test::Unit::TestCase
|
|
23
23
|
worksheet.write_rich_string('A3', 'abcd', italic, 'ef', 'g')
|
24
24
|
|
25
25
|
workbook.close
|
26
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
26
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
27
27
|
end
|
28
28
|
end
|
@@ -23,6 +23,6 @@ class TestRegressionRichString03 < Test::Unit::TestCase
|
|
23
23
|
worksheet.write_rich_string('A3', bold, 'abc', 'defg')
|
24
24
|
|
25
25
|
workbook.close
|
26
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
26
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
27
27
|
end
|
28
28
|
end
|
@@ -23,6 +23,6 @@ class TestRegressionRichString04 < Test::Unit::TestCase
|
|
23
23
|
worksheet.write_rich_string('A3', bold, 'abc', italic, 'defg')
|
24
24
|
|
25
25
|
workbook.close
|
26
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
26
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
27
27
|
end
|
28
28
|
end
|
@@ -25,6 +25,6 @@ class TestRegressionRichString05 < Test::Unit::TestCase
|
|
25
25
|
worksheet.write_rich_string('A3', 'This is ', bold, 'bold', ' and this is ', italic, 'italic')
|
26
26
|
|
27
27
|
workbook.close
|
28
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
28
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
29
29
|
end
|
30
30
|
end
|
@@ -22,6 +22,6 @@ class TestRegressionRichString06 < Test::Unit::TestCase
|
|
22
22
|
worksheet.write_rich_string('A3', 'ab', red, 'cde', 'fg')
|
23
23
|
|
24
24
|
workbook.close
|
25
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
25
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
26
26
|
end
|
27
27
|
end
|
@@ -28,6 +28,6 @@ class TestRegressionRichString07 < Test::Unit::TestCase
|
|
28
28
|
worksheet.write_rich_string('F8', italic, 'abcd', 'efg')
|
29
29
|
|
30
30
|
workbook.close
|
31
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
31
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
32
32
|
end
|
33
33
|
end
|
@@ -24,6 +24,6 @@ class TestRegressionRichString08 < Test::Unit::TestCase
|
|
24
24
|
worksheet.write_rich_string('A3', 'ab', bold, 'cd', 'efg', format)
|
25
25
|
|
26
26
|
workbook.close
|
27
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
27
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
28
28
|
end
|
29
29
|
end
|
@@ -26,6 +26,6 @@ class TestRegressionRichString09 < Test::Unit::TestCase
|
|
26
26
|
worksheet.write_rich_string('A3', 'a', bold, bold, 'bc', 'defg')
|
27
27
|
|
28
28
|
workbook.close
|
29
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
29
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
30
30
|
end
|
31
31
|
end
|
@@ -25,6 +25,6 @@ class TestRegressionRichString10 < Test::Unit::TestCase
|
|
25
25
|
worksheet.write_rich_string('A3', ' a', bold, 'bc', 'defg ')
|
26
26
|
|
27
27
|
workbook.close
|
28
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
28
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
29
29
|
end
|
30
30
|
end
|
@@ -24,6 +24,6 @@ class TestRegressionRichString11 < Test::Unit::TestCase
|
|
24
24
|
worksheet.write_rich_string('A3', 'a', bold, smiley, 'defg')
|
25
25
|
|
26
26
|
workbook.close
|
27
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
27
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
28
28
|
end
|
29
29
|
end
|
@@ -41,6 +41,6 @@ class TestRegressionShapeConnect01 < Test::Unit::TestCase
|
|
41
41
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
42
42
|
|
43
43
|
workbook.close
|
44
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
44
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
45
45
|
end
|
46
46
|
end
|
@@ -37,6 +37,6 @@ class TestRegressionShapeConnect02 < Test::Unit::TestCase
|
|
37
37
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
38
38
|
|
39
39
|
workbook.close
|
40
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
40
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
41
41
|
end
|
42
42
|
end
|
@@ -73,6 +73,6 @@ class TestRegressionShapeConnect03 < Test::Unit::TestCase
|
|
73
73
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
74
74
|
|
75
75
|
workbook.close
|
76
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
76
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
77
77
|
end
|
78
78
|
end
|
@@ -70,6 +70,6 @@ class TestRegressionShapeConnect04 < Test::Unit::TestCase
|
|
70
70
|
worksheet.insert_shape('A1', cxn_shape, 0, 0)
|
71
71
|
|
72
72
|
workbook.close
|
73
|
-
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx
|
73
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx)
|
74
74
|
end
|
75
75
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/test_example_match.rb
CHANGED
@@ -572,6 +572,124 @@ EOS
|
|
572
572
|
compare_xlsx(File.join(@perl_output, @xlsx), @xlsx)
|
573
573
|
end
|
574
574
|
|
575
|
+
def test_chart_radar
|
576
|
+
@xlsx = 'chart_radar.xlsx'
|
577
|
+
workbook = WriteXLSX.new(@xlsx)
|
578
|
+
worksheet = workbook.add_worksheet
|
579
|
+
bold = workbook.add_format(:bold => 1)
|
580
|
+
|
581
|
+
# Add the worksheet data that the charts will refer to.
|
582
|
+
headings = [ 'Number', 'Batch 1', 'Batch 2' ]
|
583
|
+
data = [
|
584
|
+
[ 2, 3, 4, 5, 6, 7 ],
|
585
|
+
[ 30, 60, 70, 50, 40, 30 ],
|
586
|
+
[ 25, 40, 50, 30, 50, 40 ]
|
587
|
+
]
|
588
|
+
|
589
|
+
worksheet.write('A1', headings, bold)
|
590
|
+
worksheet.write('A2', data)
|
591
|
+
|
592
|
+
# Create a new chart object. In this case an embedded chart.
|
593
|
+
chart1 = workbook.add_chart(:type => 'radar', :embedded => 1)
|
594
|
+
|
595
|
+
# Configure the first series.
|
596
|
+
chart1.add_series(
|
597
|
+
:name => '=Sheet1!$B$1',
|
598
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
599
|
+
:values => '=Sheet1!$B$2:$B$7'
|
600
|
+
)
|
601
|
+
|
602
|
+
# Configure second series. Note alternative use of array ref to define
|
603
|
+
# ranges: [ sheetname, row_start, row_end, col_start, col_end ].
|
604
|
+
chart1.add_series(
|
605
|
+
:name => '=Sheet1!$C$1',
|
606
|
+
:categories => [ 'Sheet1', 1, 6, 0, 0 ],
|
607
|
+
:values => [ 'Sheet1', 1, 6, 2, 2 ]
|
608
|
+
)
|
609
|
+
|
610
|
+
# Add a chart title and some axis labels.
|
611
|
+
chart1.set_title(:name => 'Results of sample analysis')
|
612
|
+
chart1.set_x_axis(:name => 'Test number')
|
613
|
+
chart1.set_y_axis(:name => 'Sample length (mm)')
|
614
|
+
|
615
|
+
# Set an Excel chart style. Blue colors with white outline and shadow.
|
616
|
+
chart1.set_style(11)
|
617
|
+
|
618
|
+
# Insert the chart into the worksheet (with an offset).
|
619
|
+
worksheet.insert_chart('D2', chart1, 25, 10)
|
620
|
+
|
621
|
+
#
|
622
|
+
# Create a with_markers chart sub-type
|
623
|
+
#
|
624
|
+
chart2 = workbook.add_chart(
|
625
|
+
:type => 'radar',
|
626
|
+
:embedded => 1,
|
627
|
+
:subtype => 'with_markers'
|
628
|
+
)
|
629
|
+
|
630
|
+
# Configure the first series.
|
631
|
+
chart2.add_series(
|
632
|
+
:name => '=Sheet1!$B$1',
|
633
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
634
|
+
:values => '=Sheet1!$B$2:$B$7'
|
635
|
+
)
|
636
|
+
|
637
|
+
# Configure second series.
|
638
|
+
chart2.add_series(
|
639
|
+
:name => '=Sheet1!$C$1',
|
640
|
+
:categories => [ 'Sheet1', 1, 6, 0, 0 ],
|
641
|
+
:values => [ 'Sheet1', 1, 6, 2, 2 ]
|
642
|
+
)
|
643
|
+
|
644
|
+
# Add a chart title and some axis labels.
|
645
|
+
chart2.set_title(:name => 'Stacked Chart')
|
646
|
+
chart2.set_x_axis(:name => 'Test number')
|
647
|
+
chart2.set_y_axis(:name => 'Sample length (mm)')
|
648
|
+
|
649
|
+
# Set an Excel chart style. Blue colors with white outline and shadow.
|
650
|
+
chart2.set_style(12)
|
651
|
+
|
652
|
+
# Insert the chart into the worksheet (with an offset).
|
653
|
+
worksheet.insert_chart('D18', chart2, 25, 11)
|
654
|
+
|
655
|
+
#
|
656
|
+
# Create a filled chart sub-type
|
657
|
+
#
|
658
|
+
chart3 = workbook.add_chart(
|
659
|
+
:type => 'radar',
|
660
|
+
:embedded => 1,
|
661
|
+
:subtype => 'filled'
|
662
|
+
)
|
663
|
+
|
664
|
+
# Configure the first series.
|
665
|
+
chart3.add_series(
|
666
|
+
:name => '=Sheet1!$B$1',
|
667
|
+
:categories => '=Sheet1!$A$2:$A$7',
|
668
|
+
:values => '=Sheet1!$B$2:$B$7'
|
669
|
+
)
|
670
|
+
|
671
|
+
# Configure second series.
|
672
|
+
chart3.add_series(
|
673
|
+
:name => '=Sheet1!$C$1',
|
674
|
+
:categories => [ 'Sheet1', 1, 6, 0, 0 ],
|
675
|
+
:values => [ 'Sheet1', 1, 6, 2, 2 ]
|
676
|
+
)
|
677
|
+
|
678
|
+
# Add a chart title and some axis labels.
|
679
|
+
chart3.set_title(:name => 'Percent Stacked Chart')
|
680
|
+
chart3.set_x_axis(:name => 'Test number')
|
681
|
+
chart3.set_y_axis(:name => 'Sample length (mm)')
|
682
|
+
|
683
|
+
# Set an Excel chart style. Blue colors with white outline and shadow.
|
684
|
+
chart3.set_style(13)
|
685
|
+
|
686
|
+
# Insert the chart into the worksheet (with an offset).
|
687
|
+
worksheet.insert_chart('D34', chart3, 25, 11)
|
688
|
+
|
689
|
+
workbook.close
|
690
|
+
compare_xlsx(File.join(@perl_output, @xlsx), @xlsx)
|
691
|
+
end
|
692
|
+
|
575
693
|
def test_chart_scatter
|
576
694
|
@xlsx = 'chart_scatter.xlsx'
|
577
695
|
workbook = WriteXLSX.new(@xlsx)
|
@@ -714,7 +832,7 @@ EOS
|
|
714
832
|
# Add a chart title and some axis labels.
|
715
833
|
chart.set_title(:name => 'Survey results')
|
716
834
|
chart.set_x_axis(:name => 'Days')
|
717
|
-
chart.set_y_axis(:name => 'Population', :major_gridlines => {:
|
835
|
+
chart.set_y_axis(:name => 'Population', :major_gridlines => {:visible => 0})
|
718
836
|
chart.set_y2_axis(:name => 'Laser wounds')
|
719
837
|
|
720
838
|
# Insert the chart into the worksheet (with an offset).
|
@@ -15,13 +15,13 @@ class TestXMLWriterSimple < Test::Unit::TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_empty_tag
|
18
|
-
assert_equal('<foo
|
18
|
+
assert_equal('<foo/>', @obj.empty_tag('foo'))
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_empty_tag_with_xml_decl
|
22
22
|
expected = <<EOS
|
23
23
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
24
|
-
<foo
|
24
|
+
<foo/>
|
25
25
|
EOS
|
26
26
|
assert_equal(expected, @obj.xml_decl << @obj.empty_tag('foo') << "\n")
|
27
27
|
end
|
@@ -32,7 +32,7 @@ EOS
|
|
32
32
|
|
33
33
|
def test_attribute
|
34
34
|
assert_equal(
|
35
|
-
"<foo x=\"1>2\"
|
35
|
+
"<foo x=\"1>2\"/>", @obj.empty_tag("foo", ['x', '1>2'])
|
36
36
|
)
|
37
37
|
end
|
38
38
|
|
@@ -55,7 +55,7 @@ EOS
|
|
55
55
|
'name', '_xlnm.Print_Titles',
|
56
56
|
'localSheetId', 0
|
57
57
|
]
|
58
|
-
expected =
|
58
|
+
expected =
|
59
59
|
"<definedName name=\"_xlnm.Print_Titles\" localSheetId=\"0\">Sheet1!$1:$1</definedName>"
|
60
60
|
@obj.data_element('definedName', 'Sheet1!$1:$1', attributes)
|
61
61
|
result = @obj.string
|