write_xlsx 0.97.0 → 1.04.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Changes +78 -0
  4. data/LICENSE.txt +1 -1
  5. data/README.md +2 -2
  6. data/examples/a_simple.rb +1 -1
  7. data/examples/add_vba_project.rb +1 -1
  8. data/examples/array_formula.rb +1 -1
  9. data/examples/chart_area.rb +5 -2
  10. data/examples/chart_bar.rb +5 -2
  11. data/examples/chart_clustered.rb +1 -1
  12. data/examples/chart_column.rb +5 -2
  13. data/examples/chart_combined.rb +1 -1
  14. data/examples/chart_data_table.rb +9 -3
  15. data/examples/chart_data_tools.rb +25 -7
  16. data/examples/chart_doughnut.rb +17 -5
  17. data/examples/chart_gauge.rb +73 -0
  18. data/examples/chart_line.rb +90 -12
  19. data/examples/chart_pareto.rb +1 -1
  20. data/examples/chart_pie.rb +9 -3
  21. data/examples/chart_radar.rb +13 -4
  22. data/examples/chart_scatter.rb +5 -2
  23. data/examples/chart_secondary_axis.rb +5 -2
  24. data/examples/chart_stock.rb +1 -1
  25. data/examples/chart_styles.rb +1 -1
  26. data/examples/colors.rb +1 -1
  27. data/examples/data_validate.rb +1 -1
  28. data/examples/date_time.rb +1 -1
  29. data/examples/demo.rb +4 -1
  30. data/examples/formats.rb +1 -1
  31. data/examples/headers.rb +1 -1
  32. data/examples/hide_row_col.rb +1 -1
  33. data/examples/hide_sheet.rb +1 -1
  34. data/examples/hyperlink1.rb +1 -1
  35. data/examples/indent.rb +1 -1
  36. data/examples/macros.rb +1 -1
  37. data/examples/merge1.rb +1 -1
  38. data/examples/merge2.rb +1 -1
  39. data/examples/merge3.rb +1 -1
  40. data/examples/merge4.rb +1 -1
  41. data/examples/merge5.rb +1 -1
  42. data/examples/merge6.rb +1 -1
  43. data/examples/outline.rb +1 -1
  44. data/examples/outline_collapsed.rb +1 -1
  45. data/examples/panes.rb +1 -1
  46. data/examples/properties.rb +1 -1
  47. data/examples/regions.rb +1 -1
  48. data/examples/rich_strings.rb +1 -1
  49. data/examples/right_to_left.rb +1 -1
  50. data/examples/shape1.rb +1 -1
  51. data/examples/shape2.rb +1 -1
  52. data/examples/shape3.rb +1 -1
  53. data/examples/shape4.rb +1 -1
  54. data/examples/shape5.rb +1 -1
  55. data/examples/shape6.rb +1 -1
  56. data/examples/shape7.rb +1 -1
  57. data/examples/shape8.rb +1 -1
  58. data/examples/shape_all.rb +1 -1
  59. data/examples/sparklines1.rb +1 -1
  60. data/examples/sparklines2.rb +1 -1
  61. data/examples/stats.rb +1 -1
  62. data/examples/stats_ext.rb +1 -1
  63. data/examples/stocks.rb +1 -1
  64. data/examples/tab_colors.rb +1 -1
  65. data/examples/tables.rb +78 -43
  66. data/lib/write_xlsx/chart.rb +43 -35
  67. data/lib/write_xlsx/chart/area.rb +1 -1
  68. data/lib/write_xlsx/chart/axis.rb +2 -2
  69. data/lib/write_xlsx/chart/bar.rb +1 -1
  70. data/lib/write_xlsx/chart/column.rb +1 -1
  71. data/lib/write_xlsx/chart/doughnut.rb +1 -1
  72. data/lib/write_xlsx/chart/legend.rb +14 -0
  73. data/lib/write_xlsx/chart/line.rb +16 -2
  74. data/lib/write_xlsx/chart/pie.rb +30 -15
  75. data/lib/write_xlsx/chart/radar.rb +1 -1
  76. data/lib/write_xlsx/chart/scatter.rb +1 -1
  77. data/lib/write_xlsx/chart/stock.rb +1 -1
  78. data/lib/write_xlsx/chartsheet.rb +35 -7
  79. data/lib/write_xlsx/drawing.rb +86 -30
  80. data/lib/write_xlsx/format.rb +9 -9
  81. data/lib/write_xlsx/package/comments.rb +61 -58
  82. data/lib/write_xlsx/package/conditional_format.rb +9 -1
  83. data/lib/write_xlsx/package/relationships.rb +4 -4
  84. data/lib/write_xlsx/package/styles.rb +26 -8
  85. data/lib/write_xlsx/package/table.rb +13 -7
  86. data/lib/write_xlsx/package/vml.rb +20 -19
  87. data/lib/write_xlsx/shape.rb +4 -3
  88. data/lib/write_xlsx/sheets.rb +18 -16
  89. data/lib/write_xlsx/sparkline.rb +1 -1
  90. data/lib/write_xlsx/utility.rb +96 -7
  91. data/lib/write_xlsx/version.rb +1 -1
  92. data/lib/write_xlsx/workbook.rb +99 -49
  93. data/lib/write_xlsx/worksheet.rb +225 -145
  94. data/lib/write_xlsx/worksheet/data_validation.rb +10 -14
  95. data/lib/write_xlsx/worksheet/hyperlink.rb +16 -37
  96. data/test/chart/test_write_legend_pos.rb +9 -1
  97. data/test/chartsheet/test_write_sheet_protection.rb +91 -0
  98. data/test/drawing/test_drawing_chart_01.rb +6 -2
  99. data/test/drawing/test_drawing_image_01.rb +12 -3
  100. data/test/drawing/test_drawing_shape_01.rb +8 -5
  101. data/test/drawing/test_drawing_shape_02.rb +12 -5
  102. data/test/drawing/test_drawing_shape_03.rb +8 -5
  103. data/test/drawing/test_drawing_shape_04.rb +8 -24
  104. data/test/drawing/test_drawing_shape_05.rb +8 -5
  105. data/test/drawing/test_drawing_shape_06.rb +11 -6
  106. data/test/drawing/test_drawing_shape_07.rb +11 -6
  107. data/test/drawing/test_write_a_graphic_frame_locks.rb +1 -1
  108. data/test/drawing/test_write_c_chart.rb +1 -1
  109. data/test/drawing/test_write_c_nv_graphic_frame_pr.rb +1 -1
  110. data/test/drawing/test_write_c_nv_pr.rb +1 -1
  111. data/test/drawing/test_write_col.rb +1 -1
  112. data/test/drawing/test_write_col_off.rb +1 -1
  113. data/test/drawing/test_write_ext.rb +1 -1
  114. data/test/drawing/test_write_pos.rb +1 -1
  115. data/test/drawing/test_write_row.rb +1 -1
  116. data/test/drawing/test_write_row_off.rb +1 -1
  117. data/test/drawing/test_write_xfrm_extension.rb +1 -1
  118. data/test/drawing/test_write_xfrm_offset.rb +1 -1
  119. data/test/package/comments/test_comments_01.rb +54 -0
  120. data/test/package/comments/test_comments_02.rb +54 -0
  121. data/test/perl_output/chart_gauge.xlsx +0 -0
  122. data/test/perl_output/chart_line.xlsx +0 -0
  123. data/test/perl_output/comments2.xlsx +0 -0
  124. data/test/perl_output/formats.xlsx +0 -0
  125. data/test/perl_output/tables.xlsx +0 -0
  126. data/test/regression/images/happy.jpg +0 -0
  127. data/test/regression/images/red2.png +0 -0
  128. data/test/regression/test_array_formula03.rb +36 -0
  129. data/test/regression/test_autofilter08.rb +110 -0
  130. data/test/regression/test_autofilter09.rb +110 -0
  131. data/test/regression/test_autofilter10.rb +110 -0
  132. data/test/regression/test_chart_axis26.rb +10 -8
  133. data/test/regression/test_chart_axis27.rb +1 -1
  134. data/test/regression/test_chart_axis28.rb +1 -1
  135. data/test/regression/test_chart_axis29.rb +1 -1
  136. data/test/regression/test_chart_axis33.rb +1 -1
  137. data/test/regression/test_chart_axis42.rb +44 -0
  138. data/test/regression/test_chart_axis43.rb +44 -0
  139. data/test/regression/test_chart_axis44.rb +54 -0
  140. data/test/regression/test_chart_axis45.rb +54 -0
  141. data/test/regression/test_chart_axis46.rb +54 -0
  142. data/test/regression/test_chart_combined10.rb +43 -0
  143. data/test/regression/test_chart_combined11.rb +63 -0
  144. data/test/regression/test_chart_data_labels25.rb +1 -1
  145. data/test/regression/test_chart_doughnut07.rb +37 -0
  146. data/test/regression/test_chart_font09.rb +1 -1
  147. data/test/regression/test_chart_legend03.rb +41 -0
  148. data/test/regression/test_chart_legend04.rb +41 -0
  149. data/test/regression/test_chart_legend05.rb +41 -0
  150. data/test/regression/test_chart_legend06.rb +41 -0
  151. data/test/regression/test_chart_legend07.rb +38 -0
  152. data/test/regression/test_chart_line05.rb +43 -0
  153. data/test/regression/test_chart_line06.rb +43 -0
  154. data/test/regression/test_chart_size03.rb +4 -1
  155. data/test/regression/test_comment13.rb +36 -0
  156. data/test/regression/test_comment14.rb +29 -0
  157. data/test/regression/test_comment15.rb +28 -0
  158. data/test/regression/test_comment16.rb +34 -0
  159. data/test/regression/test_cond_format19.rb +64 -0
  160. data/test/regression/test_cond_format20.rb +43 -0
  161. data/test/regression/test_format15.rb +26 -0
  162. data/test/regression/test_header_image15.rb +36 -0
  163. data/test/regression/test_header_image16.rb +42 -0
  164. data/test/regression/test_header_image17.rb +46 -0
  165. data/test/regression/test_header_image18.rb +48 -0
  166. data/test/regression/test_header_image19.rb +36 -0
  167. data/test/regression/test_hyperlink32.rb +27 -0
  168. data/test/regression/test_hyperlink33.rb +28 -0
  169. data/test/regression/test_hyperlink34.rb +33 -0
  170. data/test/regression/test_hyperlink35.rb +39 -0
  171. data/test/regression/test_hyperlink36.rb +34 -0
  172. data/test/regression/test_hyperlink37.rb +33 -0
  173. data/test/regression/test_hyperlink38.rb +27 -0
  174. data/test/regression/test_hyperlink39.rb +27 -0
  175. data/test/regression/test_hyperlink40.rb +27 -0
  176. data/test/regression/test_hyperlink41.rb +27 -0
  177. data/test/regression/test_hyperlink42.rb +27 -0
  178. data/test/regression/test_hyperlink43.rb +27 -0
  179. data/test/regression/test_hyperlink44.rb +27 -0
  180. data/test/regression/test_hyperlink45.rb +27 -0
  181. data/test/regression/test_hyperlink47.rb +27 -0
  182. data/test/regression/test_hyperlink48.rb +31 -0
  183. data/test/regression/test_hyperlink49.rb +29 -0
  184. data/test/regression/test_image06.rb +5 -5
  185. data/test/regression/test_image08.rb +5 -4
  186. data/test/regression/test_image15.rb +4 -2
  187. data/test/regression/test_image28.rb +1 -1
  188. data/test/regression/test_image36.rb +26 -0
  189. data/test/regression/test_image44.rb +28 -0
  190. data/test/regression/test_image45.rb +29 -0
  191. data/test/regression/test_image46.rb +29 -0
  192. data/test/regression/test_image47.rb +28 -0
  193. data/test/regression/test_image48.rb +32 -0
  194. data/test/regression/test_image49.rb +38 -0
  195. data/test/regression/test_image50.rb +24 -0
  196. data/test/regression/test_image51.rb +30 -0
  197. data/test/regression/test_object_position01.rb +26 -0
  198. data/test/regression/test_object_position02.rb +26 -0
  199. data/test/regression/test_object_position03.rb +26 -0
  200. data/test/regression/test_object_position04.rb +44 -0
  201. data/test/regression/test_object_position06.rb +28 -0
  202. data/test/regression/test_object_position07.rb +28 -0
  203. data/test/regression/test_object_position08.rb +47 -0
  204. data/test/regression/test_object_position09.rb +50 -0
  205. data/test/regression/test_object_position10.rb +28 -0
  206. data/test/regression/test_object_position12.rb +25 -0
  207. data/test/regression/test_object_position13.rb +25 -0
  208. data/test/regression/test_object_position14.rb +25 -0
  209. data/test/regression/test_object_position15.rb +29 -0
  210. data/test/regression/test_object_position16.rb +29 -0
  211. data/test/regression/test_object_position17.rb +29 -0
  212. data/test/regression/test_object_position18.rb +29 -0
  213. data/test/regression/test_object_position19.rb +29 -0
  214. data/test/regression/test_object_position20.rb +29 -0
  215. data/test/regression/test_shape_connect01.rb +4 -2
  216. data/test/regression/test_table23.rb +56 -0
  217. data/test/regression/test_table24.rb +27 -0
  218. data/test/regression/test_table25.rb +27 -0
  219. data/test/regression/xlsx_files/array_formula03.xlsx +0 -0
  220. data/test/regression/xlsx_files/autofilter08.xlsx +0 -0
  221. data/test/regression/xlsx_files/autofilter09.xlsx +0 -0
  222. data/test/regression/xlsx_files/autofilter10.xlsx +0 -0
  223. data/test/regression/xlsx_files/chart_axis26.xlsx +0 -0
  224. data/test/regression/xlsx_files/chart_axis27.xlsx +0 -0
  225. data/test/regression/xlsx_files/chart_axis28.xlsx +0 -0
  226. data/test/regression/xlsx_files/chart_axis29.xlsx +0 -0
  227. data/test/regression/xlsx_files/chart_axis33.xlsx +0 -0
  228. data/test/regression/xlsx_files/chart_axis42.xlsx +0 -0
  229. data/test/regression/xlsx_files/chart_axis43.xlsx +0 -0
  230. data/test/regression/xlsx_files/chart_axis44.xlsx +0 -0
  231. data/test/regression/xlsx_files/chart_axis45.xlsx +0 -0
  232. data/test/regression/xlsx_files/chart_axis46.xlsx +0 -0
  233. data/test/regression/xlsx_files/chart_combined10.xlsx +0 -0
  234. data/test/regression/xlsx_files/chart_combined11.xlsx +0 -0
  235. data/test/regression/xlsx_files/chart_data_labels25.xlsx +0 -0
  236. data/test/regression/xlsx_files/chart_doughnut07.xlsx +0 -0
  237. data/test/regression/xlsx_files/chart_font09.xlsx +0 -0
  238. data/test/regression/xlsx_files/chart_legend03.xlsx +0 -0
  239. data/test/regression/xlsx_files/chart_legend04.xlsx +0 -0
  240. data/test/regression/xlsx_files/chart_legend05.xlsx +0 -0
  241. data/test/regression/xlsx_files/chart_legend06.xlsx +0 -0
  242. data/test/regression/xlsx_files/chart_legend07.xlsx +0 -0
  243. data/test/regression/xlsx_files/chart_line05.xlsx +0 -0
  244. data/test/regression/xlsx_files/chart_line06.xlsx +0 -0
  245. data/test/regression/xlsx_files/comment13.xlsx +0 -0
  246. data/test/regression/xlsx_files/comment14.xlsx +0 -0
  247. data/test/regression/xlsx_files/comment15.xlsx +0 -0
  248. data/test/regression/xlsx_files/comment16.xlsx +0 -0
  249. data/test/regression/xlsx_files/cond_format19.xlsx +0 -0
  250. data/test/regression/xlsx_files/cond_format20.xlsx +0 -0
  251. data/test/regression/xlsx_files/format15.xlsx +0 -0
  252. data/test/regression/xlsx_files/header_image15.xlsx +0 -0
  253. data/test/regression/xlsx_files/header_image16.xlsx +0 -0
  254. data/test/regression/xlsx_files/header_image17.xlsx +0 -0
  255. data/test/regression/xlsx_files/header_image18.xlsx +0 -0
  256. data/test/regression/xlsx_files/header_image19.xlsx +0 -0
  257. data/test/regression/xlsx_files/hyperlink32.xlsx +0 -0
  258. data/test/regression/xlsx_files/hyperlink33.xlsx +0 -0
  259. data/test/regression/xlsx_files/hyperlink34.xlsx +0 -0
  260. data/test/regression/xlsx_files/hyperlink35.xlsx +0 -0
  261. data/test/regression/xlsx_files/hyperlink36.xlsx +0 -0
  262. data/test/regression/xlsx_files/hyperlink37.xlsx +0 -0
  263. data/test/regression/xlsx_files/hyperlink38.xlsx +0 -0
  264. data/test/regression/xlsx_files/hyperlink39.xlsx +0 -0
  265. data/test/regression/xlsx_files/hyperlink40.xlsx +0 -0
  266. data/test/regression/xlsx_files/hyperlink41.xlsx +0 -0
  267. data/test/regression/xlsx_files/hyperlink42.xlsx +0 -0
  268. data/test/regression/xlsx_files/hyperlink43.xlsx +0 -0
  269. data/test/regression/xlsx_files/hyperlink44.xlsx +0 -0
  270. data/test/regression/xlsx_files/hyperlink45.xlsx +0 -0
  271. data/test/regression/xlsx_files/hyperlink46.xlsx +0 -0
  272. data/test/regression/xlsx_files/hyperlink47.xlsx +0 -0
  273. data/test/regression/xlsx_files/hyperlink48.xlsx +0 -0
  274. data/test/regression/xlsx_files/hyperlink49.xlsx +0 -0
  275. data/test/regression/xlsx_files/image06.xlsx +0 -0
  276. data/test/regression/xlsx_files/image36.xlsx +0 -0
  277. data/test/regression/xlsx_files/image44.xlsx +0 -0
  278. data/test/regression/xlsx_files/image45.xlsx +0 -0
  279. data/test/regression/xlsx_files/image46.xlsx +0 -0
  280. data/test/regression/xlsx_files/image47.xlsx +0 -0
  281. data/test/regression/xlsx_files/image48.xlsx +0 -0
  282. data/test/regression/xlsx_files/image49.xlsx +0 -0
  283. data/test/regression/xlsx_files/image50.xlsx +0 -0
  284. data/test/regression/xlsx_files/image51.xlsx +0 -0
  285. data/test/regression/xlsx_files/object_position01.xlsx +0 -0
  286. data/test/regression/xlsx_files/object_position02.xlsx +0 -0
  287. data/test/regression/xlsx_files/object_position03.xlsx +0 -0
  288. data/test/regression/xlsx_files/object_position04.xlsx +0 -0
  289. data/test/regression/xlsx_files/object_position06.xlsx +0 -0
  290. data/test/regression/xlsx_files/object_position07.xlsx +0 -0
  291. data/test/regression/xlsx_files/object_position08.xlsx +0 -0
  292. data/test/regression/xlsx_files/object_position09.xlsx +0 -0
  293. data/test/regression/xlsx_files/object_position10.xlsx +0 -0
  294. data/test/regression/xlsx_files/object_position12.xlsx +0 -0
  295. data/test/regression/xlsx_files/object_position13.xlsx +0 -0
  296. data/test/regression/xlsx_files/object_position14.xlsx +0 -0
  297. data/test/regression/xlsx_files/object_position15.xlsx +0 -0
  298. data/test/regression/xlsx_files/object_position16.xlsx +0 -0
  299. data/test/regression/xlsx_files/object_position17.xlsx +0 -0
  300. data/test/regression/xlsx_files/object_position18.xlsx +0 -0
  301. data/test/regression/xlsx_files/object_position19.xlsx +0 -0
  302. data/test/regression/xlsx_files/object_position20.xlsx +0 -0
  303. data/test/regression/xlsx_files/table23.xlsx +0 -0
  304. data/test/regression/xlsx_files/table24.xlsx +0 -0
  305. data/test/regression/xlsx_files/table25.xlsx +0 -0
  306. data/test/test_example_match.rb +955 -780
  307. data/test/workbook/test_check_sheetname.rb +51 -0
  308. data/test/workbook/test_write_workbook_view.rb +36 -0
  309. data/test/worksheet/test_write_data_validation_02.rb +17 -0
  310. data/test/worksheet/test_write_sheet_view.rb +19 -1
  311. data/write_xlsx.gemspec +1 -0
  312. metadata +349 -7
  313. data/test/package/comments/test_write_text_t.rb +0 -44
@@ -0,0 +1,63 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartCombined11 < 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_combined11
14
+ @xlsx = 'chart_combined11.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+ chart_doughnut = workbook.add_chart(:type => 'doughnut', :embedded => 1)
18
+ chart_pie = workbook.add_chart(:type => 'pie', :embedded => 1)
19
+
20
+ worksheet.write_col('H2', ['Donut', 25, 50, 25, 100])
21
+ worksheet.write_col('I2', ['Pie', 75, 1, 124])
22
+
23
+ chart_doughnut.add_series(
24
+ :name => '=Sheet1!$H$2',
25
+ :values => '=Sheet1!$H$3:$H$6',
26
+ :points => [
27
+ { :fill => { :color => '#FF0000' } },
28
+ { :fill => { :color => '#FFC000' } },
29
+ { :fill => { :color => '#00B050' } },
30
+ { :fill => { :none => 1 } }
31
+ ]
32
+ )
33
+
34
+ chart_doughnut.set_rotation(270)
35
+ chart_doughnut.set_legend(:none => 1)
36
+ chart_doughnut.set_chartarea(
37
+ :border => { :none => 1 },
38
+ :fill => { :none => 1 }
39
+ )
40
+
41
+ chart_pie.add_series(
42
+ :name => '=Sheet1!$I$2',
43
+ :values => '=Sheet1!$I$3:$I$6',
44
+ :points => [
45
+ { :fill => { :none => 1 } },
46
+ { :fill => { :color => '#FF0000' } },
47
+ { :fill => { :none => 1 } }
48
+ ]
49
+ )
50
+
51
+ chart_pie.set_rotation(270)
52
+
53
+ chart_doughnut.combine(chart_pie)
54
+
55
+ worksheet.insert_chart('A1', chart_doughnut)
56
+
57
+ workbook.close
58
+ compare_for_regression(
59
+ [],
60
+ { 'xl/charts/chart1.xml' => ['<c:dispBlanksAs'] }
61
+ )
62
+ end
63
+ end
@@ -17,7 +17,7 @@ def test_chart_data_labels25
17
17
  chart = workbook.add_chart(:type => 'column', :embedded => 1)
18
18
 
19
19
  # For testing, copy the randomly generated axis ids in the target xlsx file.
20
- chart.instance_variable_set(:@axis_ids, [108652800, 108656128])
20
+ chart.instance_variable_set(:@axis_ids, [108315392, 108329600])
21
21
 
22
22
  data = [
23
23
  [1, 2, 3, 4, 5],
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartDoughnut07 < 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_doughnut07
14
+ @xlsx = 'chart_doughnut07.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+ chart_doughnut = workbook.add_chart(:type => 'doughnut', :embedded => 1)
18
+
19
+ worksheet.write_col('H2', ['Donut', 25, 50, 25, 100])
20
+ worksheet.write_col('I2', ['Pie', 75, 1, 124])
21
+
22
+ chart_doughnut.add_series(
23
+ :name => '=Sheet1!$H$2',
24
+ :values => '=Sheet1!$H$3:$H$6'
25
+ )
26
+
27
+ chart_doughnut.add_series(
28
+ :name => '=Sheet1!$I$2',
29
+ :values => '=Sheet1!$I$3:$I$6'
30
+ )
31
+
32
+ worksheet.insert_chart('E9', chart_doughnut)
33
+
34
+ workbook.close
35
+ compare_for_regression
36
+ end
37
+ end
@@ -13,7 +13,7 @@ def test_chart_font09
13
13
  chart = workbook.add_chart(:type => 'bar', :embedded => 1)
14
14
 
15
15
  # For testing, copy the randomly generated axis ids in the target xlsx file.
16
- chart.instance_variable_set(:@axis_ids, [68825472, 68827392])
16
+ chart.instance_variable_set(:@axis_ids, [108178432, 108321408])
17
17
 
18
18
  data = [
19
19
  [1, 2, 3, 4, 5],
@@ -0,0 +1,41 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartLegend03 < 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_legend03
14
+ @xlsx = 'chart_legend03.xlsx'
15
+ workbook = WriteXLSX.new(@io)
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, [93548928, 93550464])
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_legend(:position => 'top_right')
35
+
36
+ worksheet.insert_chart('E9', chart)
37
+
38
+ workbook.close
39
+ compare_for_regression
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartLegend04 < 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_legend04
14
+ @xlsx = 'chart_legend04.xlsx'
15
+ workbook = WriteXLSX.new(@io)
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, [93548928, 93550464])
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_legend(:position => 'overlay_top_right')
35
+
36
+ worksheet.insert_chart('E9', chart)
37
+
38
+ workbook.close
39
+ compare_for_regression
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartLegend06 < 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_legend06
14
+ @xlsx = 'chart_legend06.xlsx'
15
+ workbook = WriteXLSX.new(@io)
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, [79972224, 79973760])
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_legend(:fill => { :color => 'yellow' })
35
+
36
+ worksheet.insert_chart('E9', chart)
37
+
38
+ workbook.close
39
+ compare_for_regression
40
+ end
41
+ end
@@ -0,0 +1,41 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartLegend04 < 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_legend04
14
+ @xlsx = 'chart_legend04.xlsx'
15
+ workbook = WriteXLSX.new(@io)
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, [93548928, 93550464])
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_legend(:position => 'overlay_top_right')
35
+
36
+ worksheet.insert_chart('E9', chart)
37
+
38
+ workbook.close
39
+ compare_for_regression
40
+ end
41
+ end
@@ -0,0 +1,38 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartLegend07 < 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_legend07
14
+ @xlsx = 'chart_legend07.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+ chart = workbook.add_chart(:type => 'pie', :embedded => 1)
18
+
19
+ data = [
20
+ [ 2, 4, 6],
21
+ [60, 30, 10]
22
+ ]
23
+
24
+ worksheet.write('A1', data)
25
+
26
+ chart.add_series(
27
+ :categories => '=Sheet1!$A$1:$A$3',
28
+ :values => '=Sheet1!$B$1:$B$3'
29
+ )
30
+
31
+ chart.set_legend(:fill => { :color => 'yellow' })
32
+
33
+ worksheet.insert_chart('E9', chart)
34
+
35
+ workbook.close
36
+ compare_for_regression
37
+ end
38
+ end
@@ -0,0 +1,43 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartLine05 < 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_line05
14
+ @xlsx = 'chart_line05.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+ chart = workbook.add_chart(
18
+ :type => 'line',
19
+ :subtype => 'stacked',
20
+ :embedded => 1
21
+ )
22
+
23
+ # For testing, copy the randomly generated axis ids in the target xlsx file.
24
+ chart.instance_variable_set(:@axis_ids, [108321408, 108634112])
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_for_regression
42
+ end
43
+ end
@@ -0,0 +1,43 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartLine06 < 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_line06
14
+ @xlsx = 'chart_line06.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+ chart = workbook.add_chart(
18
+ :type => 'line',
19
+ :subtype => 'percent_stacked',
20
+ :embedded => 1
21
+ )
22
+
23
+ # For testing, copy the randomly generated axis ids in the target xlsx file.
24
+ chart.instance_variable_set(:@axis_ids, [108321408, 108634112])
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_for_regression
42
+ end
43
+ end
@@ -31,7 +31,10 @@ def test_chart_size03
31
31
  chart.add_series(:values => '=Sheet1!$B$1:$B$5')
32
32
  chart.add_series(:values => '=Sheet1!$C$1:$C$5')
33
33
 
34
- worksheet.insert_chart('E9', chart, 0, 0, 1.066666666, 1.11111111)
34
+ worksheet.insert_chart(
35
+ 'E9', chart,
36
+ :x_scale => 1.066666666, :y_scale => 1.11111111
37
+ )
35
38
 
36
39
  workbook.close
37
40
  compare_for_regression
@@ -0,0 +1,36 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionComment13 < 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_comment13
14
+ @xlsx = 'comment13.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ worksheet.write('A1', 'Foo')
19
+ worksheet.write_comment(
20
+ 'B2',
21
+ 'Some text',
22
+ :font => 'Courier',
23
+ :font_size => 10,
24
+ :font_family => 3
25
+ )
26
+
27
+ # Set the author to match the target XLSX file.
28
+ worksheet.comments_author = 'John'
29
+
30
+ workbook.close
31
+ compare_for_regression(
32
+ ['xl/styles.xml'],
33
+ {}
34
+ )
35
+ end
36
+ end