xlsxwriter 0.2.1.pre.2 → 0.2.3.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -3
  3. data/ext/xlsxwriter/chart.c +84 -20
  4. data/ext/xlsxwriter/chart.h +1 -0
  5. data/ext/xlsxwriter/chartsheet.c +34 -13
  6. data/ext/xlsxwriter/common.h +5 -5
  7. data/ext/xlsxwriter/extconf.rb +8 -8
  8. data/ext/xlsxwriter/libxlsxwriter/License.txt +24 -2
  9. data/ext/xlsxwriter/libxlsxwriter/Makefile +46 -12
  10. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +1 -1
  11. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +196 -30
  12. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chartsheet.h +3 -3
  13. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
  14. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +24 -5
  15. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +5 -1
  16. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +1 -1
  17. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
  18. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +6 -17
  19. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +20 -6
  20. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
  21. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +3 -1
  22. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
  23. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
  24. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +11 -5
  25. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
  26. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/md5.h +43 -0
  27. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +42 -3
  28. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
  29. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +83 -18
  30. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +1519 -109
  31. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +4 -2
  32. data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +3 -2
  33. data/ext/xlsxwriter/libxlsxwriter/src/Makefile +25 -7
  34. data/ext/xlsxwriter/libxlsxwriter/src/app.c +1 -1
  35. data/ext/xlsxwriter/libxlsxwriter/src/chart.c +332 -48
  36. data/ext/xlsxwriter/libxlsxwriter/src/chartsheet.c +20 -19
  37. data/ext/xlsxwriter/libxlsxwriter/src/comment.c +443 -0
  38. data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +20 -1
  39. data/ext/xlsxwriter/libxlsxwriter/src/core.c +2 -2
  40. data/ext/xlsxwriter/libxlsxwriter/src/custom.c +1 -1
  41. data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +58 -20
  42. data/ext/xlsxwriter/libxlsxwriter/src/format.c +98 -25
  43. data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +1 -1
  44. data/ext/xlsxwriter/libxlsxwriter/src/packager.c +269 -12
  45. data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +1 -1
  46. data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +2 -4
  47. data/ext/xlsxwriter/libxlsxwriter/src/styles.c +334 -48
  48. data/ext/xlsxwriter/libxlsxwriter/src/theme.c +1 -1
  49. data/ext/xlsxwriter/libxlsxwriter/src/utility.c +71 -8
  50. data/ext/xlsxwriter/libxlsxwriter/src/vml.c +1032 -0
  51. data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +343 -27
  52. data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +3759 -478
  53. data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +81 -2
  54. data/ext/xlsxwriter/libxlsxwriter/third_party/md5/Makefile +42 -0
  55. data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.c +291 -0
  56. data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.h +43 -0
  57. data/ext/xlsxwriter/rich_string.c +28 -9
  58. data/ext/xlsxwriter/shared_strings.c +75 -0
  59. data/ext/xlsxwriter/shared_strings.h +15 -0
  60. data/ext/xlsxwriter/workbook.c +87 -13
  61. data/ext/xlsxwriter/workbook.h +1 -0
  62. data/ext/xlsxwriter/workbook_properties.c +2 -2
  63. data/ext/xlsxwriter/worksheet.c +75 -23
  64. data/ext/xlsxwriter/worksheet.h +1 -0
  65. data/ext/xlsxwriter/xlsxwriter.c +2 -0
  66. data/lib/xlsxwriter/rich_string.rb +0 -2
  67. data/lib/xlsxwriter/version.rb +1 -1
  68. data/lib/xlsxwriter/worksheet.rb +2 -2
  69. data/test/{run-test.rb → run_test.rb} +3 -3
  70. data/test/support/chart_test.rb +3 -3
  71. data/test/support/with_xlsx_file.rb +4 -2
  72. data/test/support/xlsx_comparable.rb +40 -26
  73. data/test/test_array_formula.rb +42 -0
  74. data/test/test_autofilter.rb +72 -0
  75. data/test/{test-chart-area.rb → test_chart_area.rb} +2 -2
  76. data/test/{test-chart-axis.rb → test_chart_axis.rb} +16 -16
  77. data/test/test_chart_bar.rb +382 -0
  78. data/test/test_chart_blank.rb +27 -0
  79. data/test/{test-chart-column.rb → test_chart_column.rb} +2 -2
  80. data/test/{test-chart-doughnut.rb → test_chart_doughnut.rb} +2 -2
  81. data/test/{test-chart-legend.rb → test_chart_legend.rb} +2 -2
  82. data/test/{test-chart-pie.rb → test_chart_pie.rb} +2 -2
  83. data/test/{test-chart-scatter.rb → test_chart_scatter.rb} +3 -4
  84. data/test/{test-chart-size.rb → test_chart_size.rb} +2 -2
  85. data/test/{test-chart-title.rb → test_chart_title.rb} +3 -3
  86. data/test/{test-chartsheet.rb → test_chartsheet.rb} +2 -2
  87. data/test/{test-data.rb → test_data.rb} +1 -1
  88. data/test/{test-data-validation.rb → test_data_validation.rb} +23 -24
  89. data/test/{test-default-row.rb → test_default_row.rb} +1 -1
  90. data/test/{test-defined-name.rb → test_defined_name.rb} +12 -12
  91. data/test/{test-escapes.rb → test_escapes.rb} +5 -2
  92. data/test/{test-fit-to-pages.rb → test_fit_to_pages.rb} +6 -6
  93. data/test/{test-formatting.rb → test_formatting.rb} +10 -10
  94. data/test/{test-gridlines.rb → test_gridlines.rb} +3 -3
  95. data/test/{test-hyperlink.rb → test_hyperlink.rb} +22 -11
  96. data/test/{test-image.rb → test_image.rb} +6 -4
  97. data/test/{test-macro.rb → test_macro.rb} +1 -1
  98. data/test/{test-merge-range.rb → test_merge_range.rb} +1 -1
  99. data/test/{test-misc.rb → test_misc.rb} +2 -2
  100. data/test/{test-optimize.rb → test_optimize.rb} +2 -4
  101. data/test/{test-outline.rb → test_outline.rb} +14 -14
  102. data/test/{test-page-breaks.rb → test_page_breaks.rb} +2 -2
  103. data/test/{test-page-setup.rb → test_page_setup.rb} +2 -2
  104. data/test/{test-panes.rb → test_panes.rb} +1 -1
  105. data/test/{test-print-area.rb → test_print_area.rb} +3 -3
  106. data/test/{test-print-options.rb → test_print_options.rb} +7 -7
  107. data/test/{test-print-scale.rb → test_print_scale.rb} +2 -2
  108. data/test/{test-properties.rb → test_properties.rb} +2 -2
  109. data/test/{test-protect.rb → test_protect.rb} +3 -3
  110. data/test/{test-repeat.rb → test_repeat.rb} +3 -3
  111. data/test/{test-rich-string.rb → test_rich_string.rb} +5 -9
  112. data/test/{test-row-col-format.rb → test_row_col_format.rb} +1 -1
  113. data/test/{test-ruby-worksheet.rb → test_ruby_worksheet.rb} +2 -2
  114. data/test/{test-set-selection.rb → test_set_selection.rb} +2 -2
  115. data/test/{test-set-start-page.rb → test_set_start_page.rb} +2 -2
  116. data/test/{test-simple.rb → test_simple.rb} +10 -10
  117. data/test/{test-types.rb → test_types.rb} +1 -1
  118. data/test/{xlsx-func-testcase.rb → xlsx_func_testcase.rb} +1 -0
  119. metadata +127 -106
  120. data/test/test-array-formula.rb +0 -35
  121. data/test/test-autofilter.rb +0 -72
  122. data/test/test-chart-bar.rb +0 -74
  123. /data/test/{test-errors.rb → test_errors.rb} +0 -0
@@ -0,0 +1,382 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './xlsx_func_testcase'
4
+ require_relative './support/chart_test'
5
+
6
+ class TestChartBar < XlsxWriterTestCase
7
+ extend ChartTest
8
+
9
+ DATA = [
10
+ [1, 2, 3],
11
+ [2, 4, 6],
12
+ [3, 6, 9],
13
+ [4, 8, 12],
14
+ [5, 10, 15]
15
+ ].freeze
16
+
17
+ chart_test 'chart_bar01', XlsxWriter::Workbook::Chart::BAR do |chart|
18
+ chart.axis_id_1 = 64_052_224
19
+ chart.axis_id_2 = 64_055_552
20
+
21
+ chart.add_series '=Sheet1!$A$1:$A$5', '=Sheet1!$B$1:$B$5'
22
+ chart.add_series '=Sheet1!$A$1:$A$5', '=Sheet1!$C$1:$C$5'
23
+ end
24
+
25
+ test 'chart_bar02' do |wb|
26
+ wb.add_worksheet do |ws|
27
+ ws.write_string('A1', 'Foo')
28
+ end
29
+
30
+ wb.add_worksheet do |ws|
31
+ DATA.each { |row| ws.add_row row }
32
+
33
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
34
+ chart.axis_id_1 = 93_218_304
35
+ chart.axis_id_2 = 93_219_840
36
+
37
+ chart.add_series '=Sheet2!$A$1:$A$5', '=Sheet2!$B$1:$B$5'
38
+ chart.add_series '=Sheet2!$A$1:$A$5', '=Sheet2!$C$1:$C$5'
39
+
40
+ ws.insert_chart 'E9', chart
41
+ end
42
+ end
43
+ end
44
+
45
+ test 'chart_bar03' do |wb|
46
+ wb.add_worksheet do |ws|
47
+ DATA.each { |row| ws.add_row row }
48
+
49
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
50
+ chart.axis_id_1 = 64_265_216
51
+ chart.axis_id_2 = 64_447_616
52
+
53
+ chart.add_series '=Sheet1!$A$1:$A$5', '=Sheet1!$B$1:$B$5'
54
+ chart.add_series '=Sheet1!$A$1:$A$5', '=Sheet1!$C$1:$C$5'
55
+
56
+ ws.insert_chart 'E9', chart
57
+ end
58
+
59
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
60
+ chart.axis_id_1 = 86_048_128
61
+ chart.axis_id_2 = 86_058_112
62
+
63
+ chart.add_series '=Sheet1!$A$1:$A$4', '=Sheet1!$B$1:$B$4'
64
+ chart.add_series '=Sheet1!$A$1:$A$4', '=Sheet1!$C$1:$C$4'
65
+
66
+ ws.insert_chart 'F25', chart
67
+ end
68
+ end
69
+ end
70
+
71
+ test 'chart_bar04' do |wb|
72
+ wb.add_worksheet do |ws|
73
+ DATA.each { |row| ws.add_row row }
74
+
75
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
76
+ chart.axis_id_1 = 64_446_848
77
+ chart.axis_id_2 = 64_448_384
78
+
79
+ chart.add_series '=Sheet1!$A$1:$A$5', '=Sheet1!$B$1:$B$5'
80
+ chart.add_series '=Sheet1!$A$1:$A$5', '=Sheet1!$C$1:$C$5'
81
+
82
+ ws.insert_chart 'E9', chart
83
+ end
84
+ end
85
+
86
+ wb.add_worksheet do |ws|
87
+ DATA.each { |row| ws.add_row row }
88
+
89
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
90
+ chart.axis_id_1 = 85_389_696
91
+ chart.axis_id_2 = 85_391_232
92
+
93
+ chart.add_series '=Sheet2!$A$1:$A$5', '=Sheet2!$B$1:$B$5'
94
+ chart.add_series '=Sheet2!$A$1:$A$5', '=Sheet2!$C$1:$C$5'
95
+
96
+ ws.insert_chart 'E9', chart
97
+ end
98
+ end
99
+ end
100
+
101
+ chart_test 'chart_bar05', XlsxWriter::Workbook::Chart::BAR do |chart|
102
+ chart.axis_id_1 = 64_264_064
103
+ chart.axis_id_2 = 64_447_232
104
+
105
+ chart.add_series '=Sheet1!$A$1:$A$5'
106
+ chart.add_series '=Sheet1!$B$1:$B$5'
107
+ chart.add_series '=Sheet1!$C$1:$C$5'
108
+ end
109
+
110
+ chart_test 'chart_bar06', XlsxWriter::Workbook::Chart::BAR do |chart|
111
+ chart.axis_id_1 = 64_053_248
112
+ chart.axis_id_2 = 64_446_464
113
+
114
+ chart.add_series '=Sheet1!$A$1:$A$5'
115
+ chart.add_series '=Sheet1!$B$1:$B$5'
116
+ chart.add_series '=Sheet1!$C$1:$C$5'
117
+
118
+ chart.x_axis.name = 'Apple'
119
+ chart.y_axis.name = 'Pear'
120
+ chart.title = 'Title'
121
+ end
122
+
123
+ chart_test 'chart_bar08', XlsxWriter::Workbook::Chart::BAR do |chart, ws|
124
+ ws.workbook.unset_default_url_format
125
+ chart.axis_id_1 = 40_522_880
126
+ chart.axis_id_2 = 40_524_416
127
+
128
+ ws.write_url('A7', 'http://www.perl.com/')
129
+
130
+ chart.add_series '=Sheet1!$A$1:$A$5'
131
+ chart.add_series '=Sheet1!$B$1:$B$5'
132
+ chart.add_series '=Sheet1!$C$1:$C$5'
133
+ end
134
+
135
+ chart_test 'chart_bar09', XlsxWriter::Workbook::Chart::BAR_STACKED do |chart|
136
+ chart.axis_id_1 = 40_274_560
137
+ chart.axis_id_2 = 40_295_040
138
+
139
+ chart.add_series '=Sheet1!$A$1:$A$5'
140
+ chart.add_series '=Sheet1!$B$1:$B$5'
141
+ chart.add_series '=Sheet1!$C$1:$C$5'
142
+ end
143
+
144
+ chart_test 'chart_bar10', XlsxWriter::Workbook::Chart::BAR_STACKED_PERCENT do |chart|
145
+ chart.axis_id_1 = 40_274_560
146
+ chart.axis_id_2 = 40_295_040
147
+
148
+ chart.add_series '=Sheet1!$A$1:$A$5'
149
+ chart.add_series '=Sheet1!$B$1:$B$5'
150
+ chart.add_series '=Sheet1!$C$1:$C$5'
151
+ end
152
+
153
+ test 'chart_bar14' do |wb|
154
+ wb.unset_default_url_format
155
+ wb.add_worksheet
156
+
157
+ wb.add_worksheet do |ws|
158
+ DATA.each { |row| ws.add_row row }
159
+ ws.add_row ['http://www.perl.com/'], types: :url
160
+
161
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
162
+ chart.axis_id_1 = 40_294_272
163
+ chart.axis_id_2 = 40_295_808
164
+
165
+ chart.add_series '=Sheet2!$A$1:$A$5'
166
+ chart.add_series '=Sheet2!$B$1:$B$5'
167
+ chart.add_series '=Sheet2!$C$1:$C$5'
168
+
169
+ ws.insert_chart 'E9', chart
170
+ end
171
+
172
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
173
+ chart.axis_id_1 = 40_261_504
174
+ chart.axis_id_2 = 65_749_760
175
+
176
+ chart.add_series '=Sheet2!$A$1:$A$5'
177
+
178
+ ws.insert_chart 'F25', chart
179
+ end
180
+ end
181
+
182
+ wb.add_worksheet
183
+
184
+ wb.add_chart(XlsxWriter::Workbook::Chart::COLUMN) do |chart|
185
+ chart.axis_id_1 = 65_465_728
186
+ chart.axis_id_2 = 66_388_352
187
+
188
+ chart.add_series '=Sheet2!$A$1:$A$5'
189
+ chart.add_series '=Sheet2!$B$1:$B$5'
190
+ chart.add_series '=Sheet2!$C$1:$C$5'
191
+
192
+ wb.add_chartsheet.chart = chart
193
+ end
194
+ end
195
+
196
+ test 'chart_bar15' do |wb|
197
+ wb.add_worksheet do |ws|
198
+ DATA.each { |row| ws.add_row row }
199
+
200
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
201
+ chart.axis_id_1 = 62_576_896
202
+ chart.axis_id_2 = 62_582_784
203
+
204
+ chart.add_series '=Sheet1!$A$1:$A$5'
205
+ chart.add_series '=Sheet1!$B$1:$B$5'
206
+ chart.add_series '=Sheet1!$C$1:$C$5'
207
+
208
+ wb.add_chartsheet.chart = chart
209
+ end
210
+ end
211
+
212
+ wb.add_worksheet do |ws|
213
+ DATA.each { |row| ws.add_row row }
214
+
215
+ wb.add_chart(XlsxWriter::Workbook::Chart::COLUMN) do |chart|
216
+ chart.axis_id_1 = 65_979_904
217
+ chart.axis_id_2 = 65_981_440
218
+
219
+ chart.add_series '=Sheet2!$A$1:$A$5'
220
+
221
+ wb.add_chartsheet.chart = chart
222
+ end
223
+ end
224
+ end
225
+
226
+ chart_test 'chart_bar16', XlsxWriter::Workbook::Chart::BAR do |chart|
227
+ chart.axis_id_1 = 64_784_640
228
+ chart.axis_id_2 = 65_429_504
229
+
230
+ chart.add_series '=Sheet1!$A$1:$A$5'
231
+ chart.add_series '=Sheet1!$B$1:$B$5'
232
+ chart.add_series '=Sheet1!$C$1:$C$5'
233
+
234
+ chart.title = 'Title'
235
+ chart.x_axis.name = 'Apple'
236
+ chart.y_axis.name = 'Pear'
237
+ chart.legend_position = XlsxWriter::Workbook::Chart::LEGEND_BOTTOM
238
+
239
+ chart.workbook.add_chartsheet.chart = chart
240
+ end
241
+
242
+ chart_test 'chart_bar17', XlsxWriter::Workbook::Chart::BAR do |chart|
243
+ chart.axis_id_1 = 40_294_272
244
+ chart.axis_id_2 = 40_295_808
245
+
246
+ chart.add_series '=Sheet1!$A$1:$A$5'
247
+ chart.add_series '=Sheet1!$B$1:$B$5'
248
+ chart.add_series '=Sheet1!$C$1:$C$5'
249
+
250
+ cs = chart.workbook.add_chartsheet
251
+ cs.activate
252
+ cs.chart = chart
253
+ end
254
+
255
+ chart_test 'chart_bar18', XlsxWriter::Workbook::Chart::BAR do |chart|
256
+ chart.axis_id_1 = 61_298_176
257
+ chart.axis_id_2 = 61_300_096
258
+
259
+ chart.add_series '=Sheet1!$A$1:$A$5'
260
+ chart.add_series '=Sheet1!$B$1:$B$5'
261
+ chart.add_series '=Sheet1!$C$1:$C$5'
262
+
263
+ chart.workbook.add_chartsheet do |cs|
264
+ cs.set_margins(0.7086614173228347, 0.7086614173228347, 0.7480314960629921, 0.7480314960629921)
265
+ cs.paper = 9
266
+ cs.set_header('Page &P', margin: 0.3149606299212598)
267
+ cs.set_footer('&A', margin: 0.3149606299212598)
268
+ cs.activate
269
+ cs.horizontal_dpi = 200
270
+ cs.vertical_dpi = 200
271
+ cs.chart = chart
272
+ end
273
+ end
274
+
275
+ chart_test 'chart_bar19', XlsxWriter::Workbook::Chart::BAR do |chart|
276
+ chart.axis_id_1 = 66_558_592
277
+ chart.axis_id_2 = 66_569_344
278
+
279
+ chart.add_series.set_values 'Sheet1', 0, 0, 4, 0
280
+ chart.add_series.set_values 'Sheet1', 0, 1, 4, 1
281
+ chart.add_series.set_values 'Sheet1', 0, 2, 4, 2
282
+
283
+ chart.x_axis.name = '=Sheet1!$A$2'
284
+ chart.y_axis.name = '=Sheet1!$A$3'
285
+ chart.title = '=Sheet1!$A$1'
286
+ end
287
+
288
+ chart_test 'chart_bar20', XlsxWriter::Workbook::Chart::BAR do |chart, ws|
289
+ chart.axis_id_1 = 45_925_120
290
+ chart.axis_id_2 = 45_927_040
291
+
292
+ ws.add_row []
293
+ ws.add_row ['Pear']
294
+
295
+ chart.add_series('=Sheet1!$A$1:$A$5')
296
+ chart.add_series('=Sheet1!$B$1:$B$5').name = 'Apple'
297
+ chart.add_series('=Sheet1!$C$1:$C$5').name = '=Sheet1!$A$7'
298
+ end
299
+
300
+ chart_test 'chart_bar21', XlsxWriter::Workbook::Chart::BAR do |chart|
301
+ chart.axis_id_1 = 64_052_224
302
+ chart.axis_id_2 = 64_055_552
303
+
304
+ chart.add_series '=Sheet1!$A$1:$A$5', '=Sheet1!$B$1:$B$5'
305
+ chart.add_series '=Sheet1!$A$1:$A$5', '=Sheet1!$C$1:$C$5'
306
+ end
307
+
308
+ test 'chart_bar22' do |wb|
309
+ wb.add_worksheet do |ws|
310
+ [
311
+ [nil, *(1..3).map { |i| "Series #{i}" }],
312
+ ['Category 1', 4.3, 2.4, 2],
313
+ ['Category 2', 2.5, 4.5, 2],
314
+ ['Category 3', 3.5, 1.8, 3],
315
+ ['Category 4', 4.5, 2.8, 5]
316
+ ].each { |row| ws.add_row row }
317
+ ws.set_column('A', 'D', width: 11)
318
+
319
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
320
+ chart.axis_id_1 = 43_706_240
321
+ chart.axis_id_2 = 43_727_104
322
+
323
+ chart.add_series '=Sheet1!$A$2:$A$5', '=Sheet1!$B$2:$B$5'
324
+ chart.add_series '=Sheet1!$A$2:$A$5', '=Sheet1!$C$2:$C$5'
325
+ chart.add_series '=Sheet1!$A$2:$A$5', '=Sheet1!$D$2:$D$5'
326
+
327
+ ws.insert_chart 'E9', chart
328
+ end
329
+ end
330
+ end
331
+
332
+ # tests 51 - 55 use +lxw_chart_add_data_cache+ which is not exposed
333
+ # in this library
334
+
335
+ chart_test 'chart_bar61', XlsxWriter::Workbook::Chart::BAR, ref_file_name: 'chart_bar01' do |chart|
336
+ chart.axis_id_1 = 64_052_224
337
+ chart.axis_id_2 = 64_055_552
338
+
339
+ series1 = chart.add_series
340
+ series2 = chart.add_series
341
+
342
+ series1.set_categories 'Sheet1', 0, 0, 4, 0
343
+ series1.set_values 'Sheet1', 0, 1, 4, 1
344
+
345
+ series2.set_categories 'Sheet1', 0, 0, 4, 0
346
+ series2.set_values 'Sheet1', 0, 2, 4, 2
347
+ end
348
+
349
+ chart_test 'chart_bar65', XlsxWriter::Workbook::Chart::BAR, ref_file_name: 'chart_bar05' do |chart|
350
+ chart.axis_id_1 = 64_264_064
351
+ chart.axis_id_2 = 64_447_232
352
+
353
+ chart.add_series.set_values 'Sheet1', 0, 0, 4, 0
354
+ chart.add_series.set_values 'Sheet1', 0, 1, 4, 1
355
+ chart.add_series.set_values 'Sheet1', 0, 2, 4, 2
356
+ end
357
+
358
+ chart_test 'chart_bar69', XlsxWriter::Workbook::Chart::BAR, ref_file_name: 'chart_bar19' do |chart|
359
+ chart.axis_id_1 = 66_558_592
360
+ chart.axis_id_2 = 66_569_344
361
+
362
+ chart.add_series.set_values 'Sheet1', 'A1:A5'
363
+ chart.add_series.set_values 'Sheet1', 'B1', 'B5'
364
+ chart.add_series.set_values 'Sheet1', 0, 2, 4, 2
365
+
366
+ chart.x_axis.set_name_range 'Sheet1', 'A2'
367
+ chart.y_axis.set_name_range 'Sheet1', 'A3'
368
+ chart.set_name_range 'Sheet1', 'A1'
369
+ end
370
+
371
+ chart_test 'chart_bar70', XlsxWriter::Workbook::Chart::BAR, ref_file_name: 'chart_bar20' do |chart, ws|
372
+ chart.axis_id_1 = 45_925_120
373
+ chart.axis_id_2 = 45_927_040
374
+
375
+ ws.add_row []
376
+ ws.add_row ['Pear']
377
+
378
+ chart.add_series.set_values('Sheet1', 'A1:A5')
379
+ chart.add_series.set_values('Sheet1', 'B1:B5').name = 'Apple'
380
+ chart.add_series.set_values('Sheet1', 'C1:C5').name = '=Sheet1!$A$7'
381
+ end
382
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './xlsx_func_testcase'
4
+ require_relative './support/chart_test'
5
+
6
+ class TestChartBlank < XlsxWriterTestCase
7
+ extend ChartTest
8
+
9
+ DATA = [
10
+ [1, 2, 3],
11
+ [2, 4, 6],
12
+ [3, 6, 9],
13
+ [4, 8, 12],
14
+ [5, 10, 15]
15
+ ].freeze
16
+
17
+ chart_test 'chart_blank01', XlsxWriter::Workbook::Chart::LINE do |chart|
18
+ chart.axis_id_1 = 45_705_856
19
+ chart.axis_id_2 = 45_843_584
20
+
21
+ chart.add_series '=Sheet1!$A$1:$A$5'
22
+ chart.add_series '=Sheet1!$B$1:$B$5'
23
+ chart.add_series '=Sheet1!$C$1:$C$5'
24
+
25
+ chart.show_blank_as = XlsxWriter::Workbook::Chart::BLANKS_AS_GAP
26
+ end
27
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestChartColumn < XlsxWriterTestCase
6
6
  DATA = [
@@ -9,7 +9,7 @@ class TestChartColumn < XlsxWriterTestCase
9
9
  [3, 6, 9],
10
10
  [4, 8, 12],
11
11
  [5, 10, 15]
12
- ]
12
+ ].freeze
13
13
 
14
14
  test 'chart_column11' do |wb|
15
15
  wb.add_worksheet do |ws|
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestChartDoughnut < XlsxWriterTestCase
6
- DATA = [ [2, 60], [4, 30], [6, 10] ]
6
+ DATA = [[2, 60], [4, 30], [6, 10]].freeze
7
7
 
8
8
  test 'chart_doughnut02' do |wb|
9
9
  wb.add_worksheet do |ws|
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestChartLegend < XlsxWriterTestCase
6
6
  DATA = [
@@ -9,7 +9,7 @@ class TestChartLegend < XlsxWriterTestCase
9
9
  [3, 6, 9],
10
10
  [4, 8, 12],
11
11
  [5, 10, 15]
12
- ]
12
+ ].freeze
13
13
 
14
14
  test 'chart_legend01' do |wb|
15
15
  wb.add_worksheet do |ws|
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestChartPie < XlsxWriterTestCase
6
- DATA = [ [2, 60], [4, 30], [6, 10] ]
6
+ DATA = [[2, 60], [4, 30], [6, 10]].freeze
7
7
 
8
8
  test 'chart_pie02' do |wb|
9
9
  wb.add_worksheet do |ws|
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestChartScatter < XlsxWriterTestCase
6
6
  test 'chart_scatter15' do |wb|
@@ -9,12 +9,11 @@ class TestChartScatter < XlsxWriterTestCase
9
9
  chart.axis_id_1 = 58_843_520
10
10
  chart.axis_id_2 = 58_845_440
11
11
 
12
-
13
12
  ws.write_string 0, 0, 'X'
14
13
  ws.write_string 0, 1, 'Y'
15
- ws.write_number 1, 0, 1
14
+ ws.write_number 1, 0, 1
16
15
  ws.write_number 1, 1, 10
17
- ws.write_number 2, 0, 3
16
+ ws.write_number 2, 0, 3
18
17
  ws.write_number 2, 1, 30
19
18
 
20
19
  chart.add_series '=Sheet1!$A$2:$A$3', '=Sheet1!$B$2:$B$3'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestChartSize < XlsxWriterTestCase
6
6
  DATA = [
@@ -9,7 +9,7 @@ class TestChartSize < XlsxWriterTestCase
9
9
  [3, 6, 9],
10
10
  [4, 8, 12],
11
11
  [5, 10, 15]
12
- ]
12
+ ].freeze
13
13
 
14
14
  test 'chart_size01' do |wb|
15
15
  wb.add_worksheet do |ws|
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestChartTitle < XlsxWriterTestCase
6
6
  DATA = [
@@ -9,7 +9,7 @@ class TestChartTitle < XlsxWriterTestCase
9
9
  [3, 6, 9],
10
10
  [4, 8, 12],
11
11
  [5, 10, 15]
12
- ]
12
+ ].freeze
13
13
 
14
14
  test 'chart_title01' do |wb|
15
15
  wb.add_worksheet do |ws|
@@ -36,7 +36,7 @@ class TestChartTitle < XlsxWriterTestCase
36
36
  chart.axis_id_1 = 73_655_040
37
37
  chart.axis_id_2 = 73_656_576
38
38
 
39
- series = chart.add_series('=Sheet1!$A$1:$A$5')
39
+ chart.add_series '=Sheet1!$A$1:$A$5'
40
40
  chart.title = 'Title!'
41
41
 
42
42
  ws.insert_chart 'E9', chart
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestChartsheet < XlsxWriterTestCase
6
6
  DATA = [
@@ -9,7 +9,7 @@ class TestChartsheet < XlsxWriterTestCase
9
9
  [3, 6, 9],
10
10
  [4, 8, 12],
11
11
  [5, 10, 15]
12
- ]
12
+ ].freeze
13
13
 
14
14
  test 'chartsheet01' do |wb|
15
15
  wb.add_worksheet do |ws|
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative './xlsx-func-testcase'
3
+ require_relative './xlsx_func_testcase'
4
4
 
5
5
  class TestData < XlsxWriterTestCase
6
6
  test 'data01' do |wb|