write_xlsx 0.89.0 → 1.01.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (340) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/Changes +98 -0
  4. data/LICENSE.txt +1 -1
  5. data/README.md +2 -2
  6. data/examples/a_simple.rb +2 -7
  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 +5 -2
  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/conditional_format.rb +73 -46
  28. data/examples/data_validate.rb +1 -1
  29. data/examples/date_time.rb +1 -1
  30. data/examples/demo.rb +5 -8
  31. data/examples/formats.rb +1 -1
  32. data/examples/headers.rb +1 -1
  33. data/examples/hide_row_col.rb +1 -1
  34. data/examples/hide_sheet.rb +1 -1
  35. data/examples/hyperlink1.rb +5 -12
  36. data/examples/indent.rb +1 -1
  37. data/examples/macros.rb +1 -1
  38. data/examples/merge1.rb +1 -1
  39. data/examples/merge2.rb +1 -1
  40. data/examples/merge3.rb +1 -1
  41. data/examples/merge4.rb +1 -1
  42. data/examples/merge5.rb +1 -1
  43. data/examples/merge6.rb +1 -1
  44. data/examples/outline.rb +1 -1
  45. data/examples/outline_collapsed.rb +1 -1
  46. data/examples/panes.rb +1 -1
  47. data/examples/properties.rb +1 -1
  48. data/examples/regions.rb +1 -1
  49. data/examples/rich_strings.rb +1 -1
  50. data/examples/right_to_left.rb +1 -1
  51. data/examples/shape1.rb +1 -1
  52. data/examples/shape2.rb +1 -1
  53. data/examples/shape3.rb +1 -1
  54. data/examples/shape4.rb +1 -1
  55. data/examples/shape5.rb +1 -1
  56. data/examples/shape6.rb +1 -1
  57. data/examples/shape7.rb +1 -1
  58. data/examples/shape8.rb +1 -1
  59. data/examples/shape_all.rb +1 -1
  60. data/examples/sparklines1.rb +1 -1
  61. data/examples/sparklines2.rb +1 -1
  62. data/examples/stats.rb +1 -1
  63. data/examples/stats_ext.rb +1 -1
  64. data/examples/stocks.rb +1 -1
  65. data/examples/tab_colors.rb +1 -1
  66. data/examples/tables.rb +1 -1
  67. data/lib/write_xlsx/chart.rb +124 -240
  68. data/lib/write_xlsx/chart/area.rb +1 -1
  69. data/lib/write_xlsx/chart/axis.rb +4 -4
  70. data/lib/write_xlsx/chart/bar.rb +1 -1
  71. data/lib/write_xlsx/chart/caption.rb +3 -1
  72. data/lib/write_xlsx/chart/column.rb +1 -1
  73. data/lib/write_xlsx/chart/doughnut.rb +1 -1
  74. data/lib/write_xlsx/chart/legend.rb +14 -0
  75. data/lib/write_xlsx/chart/line.rb +1 -1
  76. data/lib/write_xlsx/chart/pie.rb +32 -15
  77. data/lib/write_xlsx/chart/radar.rb +1 -1
  78. data/lib/write_xlsx/chart/scatter.rb +1 -1
  79. data/lib/write_xlsx/chart/series.rb +11 -7
  80. data/lib/write_xlsx/chart/stock.rb +1 -1
  81. data/lib/write_xlsx/chartsheet.rb +35 -7
  82. data/lib/write_xlsx/drawing.rb +28 -8
  83. data/lib/write_xlsx/format.rb +19 -15
  84. data/lib/write_xlsx/package/comments.rb +57 -54
  85. data/lib/write_xlsx/package/conditional_format.rb +360 -39
  86. data/lib/write_xlsx/package/content_types.rb +10 -0
  87. data/lib/write_xlsx/package/core.rb +8 -6
  88. data/lib/write_xlsx/package/custom.rb +125 -0
  89. data/lib/write_xlsx/package/packager.rb +26 -0
  90. data/lib/write_xlsx/package/styles.rb +53 -21
  91. data/lib/write_xlsx/package/table.rb +16 -4
  92. data/lib/write_xlsx/shape.rb +4 -3
  93. data/lib/write_xlsx/sheets.rb +11 -1
  94. data/lib/write_xlsx/sparkline.rb +1 -1
  95. data/lib/write_xlsx/utility.rb +305 -35
  96. data/lib/write_xlsx/version.rb +1 -1
  97. data/lib/write_xlsx/workbook.rb +132 -12
  98. data/lib/write_xlsx/worksheet.rb +397 -163
  99. data/lib/write_xlsx/worksheet/data_validation.rb +10 -14
  100. data/lib/write_xlsx/worksheet/hyperlink.rb +4 -13
  101. data/test/chart/test_write_legend_pos.rb +9 -1
  102. data/test/chartsheet/test_write_sheet_protection.rb +91 -0
  103. data/test/drawing/test_drawing_chart_01.rb +6 -2
  104. data/test/drawing/test_drawing_image_01.rb +12 -3
  105. data/test/drawing/test_drawing_shape_01.rb +8 -5
  106. data/test/drawing/test_drawing_shape_02.rb +12 -5
  107. data/test/drawing/test_drawing_shape_03.rb +8 -5
  108. data/test/drawing/test_drawing_shape_04.rb +8 -24
  109. data/test/drawing/test_drawing_shape_05.rb +8 -5
  110. data/test/drawing/test_drawing_shape_06.rb +11 -6
  111. data/test/drawing/test_drawing_shape_07.rb +11 -6
  112. data/test/drawing/test_write_a_graphic_frame_locks.rb +1 -1
  113. data/test/drawing/test_write_c_chart.rb +1 -1
  114. data/test/drawing/test_write_c_nv_graphic_frame_pr.rb +1 -1
  115. data/test/drawing/test_write_c_nv_pr.rb +1 -1
  116. data/test/drawing/test_write_col.rb +1 -1
  117. data/test/drawing/test_write_col_off.rb +1 -1
  118. data/test/drawing/test_write_ext.rb +1 -1
  119. data/test/drawing/test_write_pos.rb +1 -1
  120. data/test/drawing/test_write_row.rb +1 -1
  121. data/test/drawing/test_write_row_off.rb +1 -1
  122. data/test/drawing/test_write_xfrm_extension.rb +1 -1
  123. data/test/drawing/test_write_xfrm_offset.rb +1 -1
  124. data/test/helper.rb +6 -1
  125. data/test/package/comments/test_comments_01.rb +54 -0
  126. data/test/package/comments/test_comments_02.rb +54 -0
  127. data/test/perl_output/chart_gauge.xlsx +0 -0
  128. data/test/perl_output/formats.xlsx +0 -0
  129. data/test/regression/_test_hyperlink31.rb +26 -0
  130. data/test/regression/images/happy.jpg +0 -0
  131. data/test/regression/images/zero_dpi.jpg +0 -0
  132. data/test/regression/test_array_formula03.rb +36 -0
  133. data/test/regression/test_autofilter08.rb +110 -0
  134. data/test/regression/test_autofilter09.rb +110 -0
  135. data/test/regression/test_autofilter10.rb +110 -0
  136. data/test/regression/test_chart_axis26.rb +10 -8
  137. data/test/regression/test_chart_axis27.rb +1 -1
  138. data/test/regression/test_chart_axis28.rb +1 -1
  139. data/test/regression/test_chart_axis29.rb +1 -1
  140. data/test/regression/test_chart_axis33.rb +1 -1
  141. data/test/regression/test_chart_axis42.rb +44 -0
  142. data/test/regression/test_chart_axis43.rb +44 -0
  143. data/test/regression/test_chart_axis44.rb +54 -0
  144. data/test/regression/test_chart_axis45.rb +54 -0
  145. data/test/regression/test_chart_axis46.rb +54 -0
  146. data/test/regression/test_chart_bar08.rb +3 -0
  147. data/test/regression/test_chart_bar11.rb +3 -0
  148. data/test/regression/test_chart_bar14.rb +3 -0
  149. data/test/regression/test_chart_chartarea05.rb +16 -17
  150. data/test/regression/test_chart_chartarea06.rb +49 -0
  151. data/test/regression/test_chart_combined10.rb +43 -0
  152. data/test/regression/test_chart_combined11.rb +63 -0
  153. data/test/regression/test_chart_data_labels25.rb +61 -0
  154. data/test/regression/test_chart_doughnut07.rb +37 -0
  155. data/test/regression/test_chart_font09.rb +1 -1
  156. data/test/regression/test_chart_format26.rb +48 -0
  157. data/test/regression/test_chart_format27.rb +58 -0
  158. data/test/regression/test_chart_format28.rb +52 -0
  159. data/test/regression/test_chart_format29.rb +59 -0
  160. data/test/regression/test_chart_format30.rb +53 -0
  161. data/test/regression/test_chart_format31.rb +60 -0
  162. data/test/regression/test_chart_legend03.rb +41 -0
  163. data/test/regression/test_chart_legend04.rb +41 -0
  164. data/test/regression/test_chart_legend05.rb +41 -0
  165. data/test/regression/test_chart_legend06.rb +41 -0
  166. data/test/regression/test_chart_legend07.rb +38 -0
  167. data/test/regression/test_chart_size03.rb +4 -1
  168. data/test/regression/test_chart_table03.rb +56 -0
  169. data/test/regression/test_comment13.rb +36 -0
  170. data/test/regression/test_comment14.rb +29 -0
  171. data/test/regression/test_cond_format14.rb +42 -0
  172. data/test/regression/test_cond_format15.rb +53 -0
  173. data/test/regression/test_cond_format16.rb +53 -0
  174. data/test/regression/test_cond_format17.rb +37 -0
  175. data/test/regression/test_cond_format18.rb +136 -0
  176. data/test/regression/test_cond_format19.rb +64 -0
  177. data/test/regression/test_cond_format20.rb +43 -0
  178. data/test/regression/test_date_1904_01.rb +1 -1
  179. data/test/regression/test_escapes04.rb +3 -0
  180. data/test/regression/test_escapes05.rb +3 -0
  181. data/test/regression/test_escapes07.rb +3 -0
  182. data/test/regression/test_escapes08.rb +3 -0
  183. data/test/regression/test_format15.rb +26 -0
  184. data/test/regression/test_hyperlink01.rb +3 -0
  185. data/test/regression/test_hyperlink02.rb +3 -0
  186. data/test/regression/test_hyperlink03.rb +4 -0
  187. data/test/regression/test_hyperlink04.rb +3 -0
  188. data/test/regression/test_hyperlink05.rb +3 -0
  189. data/test/regression/test_hyperlink06.rb +3 -0
  190. data/test/regression/test_hyperlink07.rb +3 -0
  191. data/test/regression/test_hyperlink08.rb +3 -0
  192. data/test/regression/test_hyperlink09.rb +3 -0
  193. data/test/regression/test_hyperlink10.rb +3 -0
  194. data/test/regression/test_hyperlink11.rb +3 -0
  195. data/test/regression/test_hyperlink12.rb +3 -0
  196. data/test/regression/test_hyperlink13.rb +3 -0
  197. data/test/regression/test_hyperlink14.rb +3 -0
  198. data/test/regression/test_hyperlink15.rb +3 -0
  199. data/test/regression/test_hyperlink16.rb +3 -0
  200. data/test/regression/test_hyperlink17.rb +3 -0
  201. data/test/regression/test_hyperlink18.rb +3 -0
  202. data/test/regression/test_hyperlink20.rb +3 -0
  203. data/test/regression/test_hyperlink21.rb +3 -0
  204. data/test/regression/test_hyperlink22.rb +3 -0
  205. data/test/regression/test_hyperlink23.rb +3 -0
  206. data/test/regression/test_hyperlink24.rb +3 -0
  207. data/test/regression/test_hyperlink25.rb +3 -0
  208. data/test/regression/test_hyperlink26.rb +3 -0
  209. data/test/regression/test_hyperlink27.rb +27 -0
  210. data/test/regression/test_hyperlink28.rb +50 -0
  211. data/test/regression/test_hyperlink29.rb +27 -0
  212. data/test/regression/test_hyperlink30.rb +36 -0
  213. data/test/regression/test_image08.rb +5 -4
  214. data/test/regression/test_image15.rb +4 -2
  215. data/test/regression/test_image28.rb +1 -1
  216. data/test/regression/test_image35.rb +26 -0
  217. data/test/regression/test_image36.rb +26 -0
  218. data/test/regression/test_image44.rb +28 -0
  219. data/test/regression/test_image45.rb +28 -0
  220. data/test/regression/test_image46.rb +29 -0
  221. data/test/regression/test_image47.rb +28 -0
  222. data/test/regression/test_object_position01.rb +26 -0
  223. data/test/regression/test_object_position02.rb +26 -0
  224. data/test/regression/test_object_position03.rb +26 -0
  225. data/test/regression/test_object_position04.rb +44 -0
  226. data/test/regression/test_object_position06.rb +28 -0
  227. data/test/regression/test_object_position07.rb +28 -0
  228. data/test/regression/test_object_position08.rb +47 -0
  229. data/test/regression/test_object_position09.rb +50 -0
  230. data/test/regression/test_object_position10.rb +28 -0
  231. data/test/regression/test_properties01.rb +1 -4
  232. data/test/regression/test_properties02.rb +1 -4
  233. data/test/regression/test_properties03.rb +26 -0
  234. data/test/regression/test_properties04.rb +61 -0
  235. data/test/regression/test_properties05.rb +30 -0
  236. data/test/regression/test_shape_connect01.rb +4 -2
  237. data/test/regression/test_table03.rb +3 -0
  238. data/test/regression/test_table04.rb +3 -0
  239. data/test/regression/test_table05.rb +3 -0
  240. data/test/regression/test_table06.rb +3 -0
  241. data/test/regression/test_table20.rb +34 -0
  242. data/test/regression/test_table21.rb +36 -0
  243. data/test/regression/test_table22.rb +32 -0
  244. data/test/regression/test_table23.rb +56 -0
  245. data/test/regression/test_utf8_11.rb +23 -0
  246. data/test/regression/xlsx_files/array_formula03.xlsx +0 -0
  247. data/test/regression/xlsx_files/autofilter08.xlsx +0 -0
  248. data/test/regression/xlsx_files/autofilter09.xlsx +0 -0
  249. data/test/regression/xlsx_files/autofilter10.xlsx +0 -0
  250. data/test/regression/xlsx_files/chart_axis26.xlsx +0 -0
  251. data/test/regression/xlsx_files/chart_axis27.xlsx +0 -0
  252. data/test/regression/xlsx_files/chart_axis28.xlsx +0 -0
  253. data/test/regression/xlsx_files/chart_axis29.xlsx +0 -0
  254. data/test/regression/xlsx_files/chart_axis33.xlsx +0 -0
  255. data/test/regression/xlsx_files/chart_axis42.xlsx +0 -0
  256. data/test/regression/xlsx_files/chart_axis43.xlsx +0 -0
  257. data/test/regression/xlsx_files/chart_axis44.xlsx +0 -0
  258. data/test/regression/xlsx_files/chart_axis45.xlsx +0 -0
  259. data/test/regression/xlsx_files/chart_axis46.xlsx +0 -0
  260. data/test/regression/xlsx_files/chart_chartarea05.xlsx +0 -0
  261. data/test/regression/xlsx_files/chart_chartarea06.xlsx +0 -0
  262. data/test/regression/xlsx_files/chart_combined10.xlsx +0 -0
  263. data/test/regression/xlsx_files/chart_combined11.xlsx +0 -0
  264. data/test/regression/xlsx_files/chart_data_labels25.xlsx +0 -0
  265. data/test/regression/xlsx_files/chart_doughnut07.xlsx +0 -0
  266. data/test/regression/xlsx_files/chart_font09.xlsx +0 -0
  267. data/test/regression/xlsx_files/chart_format26.xlsx +0 -0
  268. data/test/regression/xlsx_files/chart_format27.xlsx +0 -0
  269. data/test/regression/xlsx_files/chart_format28.xlsx +0 -0
  270. data/test/regression/xlsx_files/chart_format29.xlsx +0 -0
  271. data/test/regression/xlsx_files/chart_format30.xlsx +0 -0
  272. data/test/regression/xlsx_files/chart_format31.xlsx +0 -0
  273. data/test/regression/xlsx_files/chart_legend03.xlsx +0 -0
  274. data/test/regression/xlsx_files/chart_legend04.xlsx +0 -0
  275. data/test/regression/xlsx_files/chart_legend05.xlsx +0 -0
  276. data/test/regression/xlsx_files/chart_legend06.xlsx +0 -0
  277. data/test/regression/xlsx_files/chart_legend07.xlsx +0 -0
  278. data/test/regression/xlsx_files/chart_table03.xlsx +0 -0
  279. data/test/regression/xlsx_files/comment13.xlsx +0 -0
  280. data/test/regression/xlsx_files/comment14.xlsx +0 -0
  281. data/test/regression/xlsx_files/cond_format14.xlsx +0 -0
  282. data/test/regression/xlsx_files/cond_format15.xlsx +0 -0
  283. data/test/regression/xlsx_files/cond_format16.xlsx +0 -0
  284. data/test/regression/xlsx_files/cond_format17.xlsx +0 -0
  285. data/test/regression/xlsx_files/cond_format18.xlsx +0 -0
  286. data/test/regression/xlsx_files/cond_format19.xlsx +0 -0
  287. data/test/regression/xlsx_files/cond_format20.xlsx +0 -0
  288. data/test/regression/xlsx_files/date_1904_01.xlsx +0 -0
  289. data/test/regression/xlsx_files/format15.xlsx +0 -0
  290. data/test/regression/xlsx_files/hyperlink27.xlsx +0 -0
  291. data/test/regression/xlsx_files/hyperlink28.xlsx +0 -0
  292. data/test/regression/xlsx_files/hyperlink29.xlsx +0 -0
  293. data/test/regression/xlsx_files/hyperlink30.xlsx +0 -0
  294. data/test/regression/xlsx_files/hyperlink31.xlsx +0 -0
  295. data/test/regression/xlsx_files/image35.xlsx +0 -0
  296. data/test/regression/xlsx_files/image36.xlsx +0 -0
  297. data/test/regression/xlsx_files/image44.xlsx +0 -0
  298. data/test/regression/xlsx_files/image45.xlsx +0 -0
  299. data/test/regression/xlsx_files/image46.xlsx +0 -0
  300. data/test/regression/xlsx_files/image47.xlsx +0 -0
  301. data/test/regression/xlsx_files/object_position01.xlsx +0 -0
  302. data/test/regression/xlsx_files/object_position02.xlsx +0 -0
  303. data/test/regression/xlsx_files/object_position03.xlsx +0 -0
  304. data/test/regression/xlsx_files/object_position04.xlsx +0 -0
  305. data/test/regression/xlsx_files/object_position06.xlsx +0 -0
  306. data/test/regression/xlsx_files/object_position07.xlsx +0 -0
  307. data/test/regression/xlsx_files/object_position08.xlsx +0 -0
  308. data/test/regression/xlsx_files/object_position09.xlsx +0 -0
  309. data/test/regression/xlsx_files/object_position10.xlsx +0 -0
  310. data/test/regression/xlsx_files/properties03.xlsx +0 -0
  311. data/test/regression/xlsx_files/properties04.xlsx +0 -0
  312. data/test/regression/xlsx_files/properties05.xlsx +0 -0
  313. data/test/regression/xlsx_files/table21.xlsx +0 -0
  314. data/test/regression/xlsx_files/table22.xlsx +0 -0
  315. data/test/regression/xlsx_files/table23.xlsx +0 -0
  316. data/test/regression/xlsx_files/utf8_11.xlsx +0 -0
  317. data/test/test_example_match.rb +836 -771
  318. data/test/workbook/test_check_sheetname.rb +61 -0
  319. data/test/workbook/test_worksheet_by_name.rb +35 -0
  320. data/test/workbook/test_write_workbook_view.rb +117 -0
  321. data/test/worksheet/test_cond_format_22.rb +266 -0
  322. data/test/worksheet/test_cond_format_23.rb +242 -0
  323. data/test/worksheet/test_cond_format_24.rb +303 -0
  324. data/test/worksheet/test_data_bar_01.rb +53 -0
  325. data/test/worksheet/test_data_bar_02.rb +79 -0
  326. data/test/worksheet/test_data_bar_03.rb +147 -0
  327. data/test/worksheet/test_data_bar_04.rb +145 -0
  328. data/test/worksheet/test_data_bar_05.rb +147 -0
  329. data/test/worksheet/test_data_bar_06.rb +145 -0
  330. data/test/worksheet/test_data_bar_07.rb +146 -0
  331. data/test/worksheet/test_data_bar_08.rb +54 -0
  332. data/test/worksheet/test_data_bar_09.rb +80 -0
  333. data/test/worksheet/test_data_bar_10.rb +165 -0
  334. data/test/worksheet/test_data_bar_11.rb +167 -0
  335. data/test/worksheet/test_data_bar_12.rb +104 -0
  336. data/test/worksheet/test_write_data_validation_02.rb +44 -0
  337. data/test/worksheet/test_write_hyperlink.rb +0 -7
  338. data/test/worksheet/test_write_sheet_view.rb +19 -1
  339. metadata +308 -5
  340. data/test/package/comments/test_write_text_t.rb +0 -44
@@ -0,0 +1,110 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionAutofilter10 < 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_autofilter10
14
+ @xlsx = 'autofilter10.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+
18
+ # Extract the data embedded at the end of this file.
19
+ data = []
20
+ data_lines.split(/\n/).each { |line| data << line.split }
21
+
22
+ worksheet.write('A1', headings)
23
+
24
+ # Create a blank cell in out test data.
25
+ data[5][0] = ''
26
+
27
+ worksheet.autofilter('A1:D51')
28
+ worksheet.filter_column_list('A', %w(North South East Blanks))
29
+
30
+ # Hide the rows that don't match the filter criteria.
31
+ row = 1
32
+
33
+ data.each do |row_data|
34
+ region = row_data[0]
35
+ if %w(North South East).include?(region) || region == ''
36
+ # Row is visible.
37
+ else
38
+ # Hide row.
39
+ worksheet.set_row(row, nil, nil, 1)
40
+ end
41
+ worksheet.write(row, 0, row_data)
42
+ row += 1
43
+ end
44
+
45
+ workbook.close
46
+ compare_for_regression(
47
+ nil,
48
+ {'xl/workbook.xml' => ['<workbookView']}
49
+ )
50
+ end
51
+
52
+ def headings
53
+ %w[Region Item Volume Month]
54
+ end
55
+
56
+ def data_lines
57
+ <<EOS
58
+ East Apple 9000 July
59
+ East Apple 5000 July
60
+ South Orange 9000 September
61
+ North Apple 2000 November
62
+ West Apple 9000 November
63
+ South Pear 7000 October
64
+ North Pear 9000 August
65
+ West Orange 1000 December
66
+ West Grape 1000 November
67
+ South Pear 10000 April
68
+ West Grape 6000 January
69
+ South Orange 3000 May
70
+ North Apple 3000 December
71
+ South Apple 7000 February
72
+ West Grape 1000 December
73
+ East Grape 8000 February
74
+ South Grape 10000 June
75
+ West Pear 7000 December
76
+ South Apple 2000 October
77
+ East Grape 7000 December
78
+ North Grape 6000 April
79
+ East Pear 8000 February
80
+ North Apple 7000 August
81
+ North Orange 7000 July
82
+ North Apple 6000 June
83
+ South Grape 8000 September
84
+ West Apple 3000 October
85
+ South Orange 10000 November
86
+ West Grape 4000 July
87
+ North Orange 5000 August
88
+ East Orange 1000 November
89
+ East Orange 4000 October
90
+ North Grape 5000 August
91
+ East Apple 1000 December
92
+ South Apple 10000 March
93
+ East Grape 7000 October
94
+ West Grape 1000 September
95
+ East Grape 10000 October
96
+ South Orange 8000 March
97
+ North Apple 4000 July
98
+ South Orange 5000 July
99
+ West Apple 4000 June
100
+ East Apple 5000 April
101
+ North Pear 3000 August
102
+ East Grape 9000 November
103
+ North Orange 8000 October
104
+ East Apple 10000 June
105
+ South Pear 1000 December
106
+ North Grape 10000 July
107
+ East Grape 6000 February
108
+ EOS
109
+ end
110
+ end
@@ -17,15 +17,17 @@ def test_chart_axis26
17
17
  chart = workbook.add_chart(:type => 'line', :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, [73048448, 73049984])
20
+ chart.instance_variable_set(:@axis_ids, [108315392, 108329216])
21
21
 
22
22
  data = [
23
- [ 1, 2, 3, 4, 5 ],
24
- [ 2, 4, 6, 8, 10 ],
25
- [ 3, 6, 9, 12, 15 ]
26
- ]
23
+ [ 1, 2, 3, 4, 5 ],
24
+ [ 2, 4, 6, 8, 10 ],
25
+ [ 3, 6, 9, 12, 15 ]
26
+ ]
27
27
 
28
- chart.set_x_axis(:num_font => {:rotation => 45})
28
+ chart.set_x_axis(
29
+ :num_font => { :rotation => 45, :baseline => -1 }
30
+ )
29
31
 
30
32
  worksheet.write('A1', data)
31
33
 
@@ -37,8 +39,8 @@ def test_chart_axis26
37
39
 
38
40
  workbook.close
39
41
  compare_for_regression(
40
- nil,
41
- { 'xl/charts/chart1.xml' => ['<a:defRPr'] }
42
+ [],
43
+ {}
42
44
  )
43
45
  end
44
46
  end
@@ -17,7 +17,7 @@ def test_chart_axis27
17
17
  chart = workbook.add_chart(:type => 'line', :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, [73048448, 73049984])
20
+ chart.instance_variable_set(:@axis_ids, [108315392, 108329216])
21
21
 
22
22
  data = [
23
23
  [ 1, 2, 3, 4, 5 ],
@@ -17,7 +17,7 @@ def test_chart_axis28
17
17
  chart = workbook.add_chart(:type => 'line', :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, [45451904, 47401600])
20
+ chart.instance_variable_set(:@axis_ids, [115375104, 115390720])
21
21
 
22
22
  data = [
23
23
  [ 1, 2, 3, 4, 5 ],
@@ -17,7 +17,7 @@ def test_chart_axis29
17
17
  chart = workbook.add_chart(:type => 'line', :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, [45444480, 47402368])
20
+ chart.instance_variable_set(:@axis_ids, [145169024, 145176448])
21
21
  data = [
22
22
  [ 1, 2, 3, 4, 5 ],
23
23
  [ 2, 4, 6, 8, 10 ],
@@ -17,7 +17,7 @@ def test_chart_axis33
17
17
  chart = workbook.add_chart(:type => 'line', :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, [68827008, 68898816])
20
+ chart.instance_variable_set(:@axis_ids, [143682944, 143946496])
21
21
  data = [
22
22
  [ 1, 2, 3, 4, 5 ],
23
23
  [ 2, 4, 6, 8, 10 ],
@@ -0,0 +1,44 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartAxis42 < 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_axis42
14
+ @xlsx = 'chart_axis42.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, [61296640, 61298560])
21
+
22
+ data = [
23
+ [ 1, 2, 3, 4, 5 ],
24
+ [ 2, 4, 6, 8, 10 ],
25
+ [ 3, 6, 9, 12, 15 ]
26
+ ]
27
+
28
+ worksheet.write('A1', data)
29
+
30
+ chart.add_series(:values => '=Sheet1!$A$1:$A$5')
31
+ chart.add_series(:values => '=Sheet1!$B$1:$B$5')
32
+ chart.add_series(:values => '=Sheet1!$C$1:$C$5')
33
+
34
+ chart.set_x_axis(:label_align => 'right')
35
+
36
+ worksheet.insert_chart('E9', chart)
37
+
38
+ workbook.close
39
+ compare_for_regression(
40
+ nil,
41
+ { 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
42
+ )
43
+ end
44
+ end
@@ -0,0 +1,44 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartAxis43 < 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_axis43
14
+ @xlsx = 'chart_axis43.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, [61296640, 61298560])
21
+
22
+ data = [
23
+ [ 1, 2, 3, 4, 5 ],
24
+ [ 2, 4, 6, 8, 10 ],
25
+ [ 3, 6, 9, 12, 15 ]
26
+ ]
27
+
28
+ worksheet.write('A1', data)
29
+
30
+ chart.add_series(:values => '=Sheet1!$A$1:$A$5')
31
+ chart.add_series(:values => '=Sheet1!$B$1:$B$5')
32
+ chart.add_series(:values => '=Sheet1!$C$1:$C$5')
33
+
34
+ chart.set_x_axis(:label_align => 'left')
35
+
36
+ worksheet.insert_chart('E9', chart)
37
+
38
+ workbook.close
39
+ compare_for_regression(
40
+ nil,
41
+ { 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
42
+ )
43
+ end
44
+ end
@@ -0,0 +1,54 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartAxis44 < 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_axis44
14
+ @xlsx = 'chart_axis44.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+ chart = workbook.add_chart(:type => 'bar', :embedded => 1)
18
+
19
+ # For testing, copy the randomly generated axis ids in the target xlsx file.
20
+ chart.instance_variable_set(:@axis_ids, [108176896, 108178816])
21
+
22
+ data = [
23
+ [ 1, 2, 3, 4, 5 ],
24
+ [ 2, 4, 6, 8, 10 ],
25
+ [ 3, 6, 9, 12, 15 ]
26
+ ]
27
+
28
+ worksheet.write('A1', data)
29
+
30
+ chart.add_series(:values => '=Sheet1!$A$1:$A$5')
31
+ chart.add_series(:values => '=Sheet1!$B$1:$B$5')
32
+ chart.add_series(:values => '=Sheet1!$C$1:$C$5')
33
+
34
+ chart.set_x_axis(
35
+ :name => 'XXX',
36
+ :name_font => { :rotation => -45, :baseline => -1},
37
+ :num_font => { :rotation => -45, :baseline => -1}
38
+ )
39
+
40
+ chart.set_y_axis(
41
+ :name => 'YYY',
42
+ :name_font => { :rotation => -45, :baseline => -1},
43
+ :num_font => { :rotation => -45, :baseline => -1}
44
+ )
45
+
46
+ worksheet.insert_chart('E9', chart)
47
+
48
+ workbook.close
49
+ compare_for_regression(
50
+ nil,
51
+ { 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
52
+ )
53
+ end
54
+ end
@@ -0,0 +1,54 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartAxis45 < 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_axis45
14
+ @xlsx = 'chart_axis45.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+ chart = workbook.add_chart(:type => 'bar', :embedded => 1)
18
+
19
+ # For testing, copy the randomly generated axis ids in the target xlsx file.
20
+ chart.instance_variable_set(:@axis_ids, [108178048, 108321408])
21
+
22
+ data = [
23
+ [ 1, 2, 3, 4, 5 ],
24
+ [ 2, 4, 6, 8, 10 ],
25
+ [ 3, 6, 9, 12, 15 ]
26
+ ]
27
+
28
+ worksheet.write('A1', data)
29
+
30
+ chart.add_series(:values => '=Sheet1!$A$1:$A$5')
31
+ chart.add_series(:values => '=Sheet1!$B$1:$B$5')
32
+ chart.add_series(:values => '=Sheet1!$C$1:$C$5')
33
+
34
+ chart.set_x_axis(
35
+ :name => 'XXX',
36
+ :name_font => { :rotation => 270, :baseline => -1},
37
+ :num_font => { :rotation => 270, :baseline => -1}
38
+ )
39
+
40
+ chart.set_y_axis(
41
+ :name => 'YYY',
42
+ :name_font => { :rotation => 270, :baseline => -1},
43
+ :num_font => { :rotation => 270, :baseline => -1}
44
+ )
45
+
46
+ worksheet.insert_chart('E9', chart)
47
+
48
+ workbook.close
49
+ compare_for_regression(
50
+ nil,
51
+ { 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
52
+ )
53
+ end
54
+ end
@@ -0,0 +1,54 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'helper'
3
+
4
+ class TestRegressionChartAxis46 < 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_axis46
14
+ @xlsx = 'chart_axis46.xlsx'
15
+ workbook = WriteXLSX.new(@io)
16
+ worksheet = workbook.add_worksheet
17
+ chart = workbook.add_chart(:type => 'bar', :embedded => 1)
18
+
19
+ # For testing, copy the randomly generated axis ids in the target xlsx file.
20
+ chart.instance_variable_set(:@axis_ids, [108178048, 108321408])
21
+
22
+ data = [
23
+ [ 1, 2, 3, 4, 5 ],
24
+ [ 2, 4, 6, 8, 10 ],
25
+ [ 3, 6, 9, 12, 15 ]
26
+ ]
27
+
28
+ worksheet.write('A1', data)
29
+
30
+ chart.add_series(:values => '=Sheet1!$A$1:$A$5')
31
+ chart.add_series(:values => '=Sheet1!$B$1:$B$5')
32
+ chart.add_series(:values => '=Sheet1!$C$1:$C$5')
33
+
34
+ chart.set_x_axis(
35
+ :name => 'XXX',
36
+ :name_font => { :rotation => 271, :baseline => -1},
37
+ :num_font => { :rotation => 271, :baseline => -1}
38
+ )
39
+
40
+ chart.set_y_axis(
41
+ :name => 'YYY',
42
+ :name_font => { :rotation => 271, :baseline => -1},
43
+ :num_font => { :rotation => 271, :baseline => -1}
44
+ )
45
+
46
+ worksheet.insert_chart('E9', chart)
47
+
48
+ workbook.close
49
+ compare_for_regression(
50
+ nil,
51
+ { 'xl/charts/chart1.xml' => ['<c:pageMargins'] }
52
+ )
53
+ end
54
+ end
@@ -25,6 +25,9 @@ def test_chart_bar08
25
25
  [ 3, 6, 9, 12, 15 ]
26
26
  ]
27
27
 
28
+ # Turn off default URL format for testing.
29
+ worksheet.instance_variable_set(:@default_url_format, nil)
30
+
28
31
  worksheet.write('A1', data)
29
32
  worksheet.write('A7', 'http://www.perl.com/')
30
33