xlsxwriter 0.2.1.pre → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -3
- data/ext/xlsxwriter/chart.c +88 -80
- data/ext/xlsxwriter/chart.h +2 -2
- data/ext/xlsxwriter/chartsheet.c +307 -0
- data/ext/xlsxwriter/chartsheet.h +15 -0
- data/ext/xlsxwriter/common.h +104 -0
- data/ext/xlsxwriter/extconf.rb +8 -8
- data/ext/xlsxwriter/libxlsxwriter/License.txt +24 -2
- data/ext/xlsxwriter/libxlsxwriter/Makefile +46 -12
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +196 -30
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chartsheet.h +3 -3
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +24 -5
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +5 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +6 -17
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +20 -6
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +3 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +11 -5
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/md5.h +43 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +42 -3
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +83 -18
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +1519 -109
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +4 -2
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +3 -2
- data/ext/xlsxwriter/libxlsxwriter/src/Makefile +25 -7
- data/ext/xlsxwriter/libxlsxwriter/src/app.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/chart.c +332 -48
- data/ext/xlsxwriter/libxlsxwriter/src/chartsheet.c +20 -19
- data/ext/xlsxwriter/libxlsxwriter/src/comment.c +443 -0
- data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +20 -1
- data/ext/xlsxwriter/libxlsxwriter/src/core.c +2 -2
- data/ext/xlsxwriter/libxlsxwriter/src/custom.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +58 -20
- data/ext/xlsxwriter/libxlsxwriter/src/format.c +98 -25
- data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/packager.c +269 -12
- data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +2 -4
- data/ext/xlsxwriter/libxlsxwriter/src/styles.c +334 -48
- data/ext/xlsxwriter/libxlsxwriter/src/theme.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/utility.c +71 -8
- data/ext/xlsxwriter/libxlsxwriter/src/vml.c +1032 -0
- data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +343 -27
- data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +3759 -478
- data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +81 -2
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/Makefile +42 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.c +291 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.h +43 -0
- data/ext/xlsxwriter/shared_strings.c +65 -0
- data/ext/xlsxwriter/shared_strings.h +15 -0
- data/ext/xlsxwriter/workbook.c +96 -20
- data/ext/xlsxwriter/worksheet.c +125 -235
- data/ext/xlsxwriter/worksheet.h +2 -1
- data/ext/xlsxwriter/xlsxwriter.c +4 -0
- data/lib/xlsxwriter/rich_string.rb +0 -2
- data/lib/xlsxwriter/version.rb +1 -1
- data/lib/xlsxwriter/worksheet.rb +2 -2
- data/test/{run-test.rb → run_test.rb} +3 -3
- data/test/support/chart_test.rb +3 -3
- data/test/support/with_xlsx_file.rb +4 -2
- data/test/support/xlsx_comparable.rb +40 -26
- data/test/test_array_formula.rb +42 -0
- data/test/test_autofilter.rb +72 -0
- data/test/{test-chart-area.rb → test_chart_area.rb} +2 -2
- data/test/{test-chart-axis.rb → test_chart_axis.rb} +16 -16
- data/test/test_chart_bar.rb +382 -0
- data/test/test_chart_blank.rb +27 -0
- data/test/{test-chart-column.rb → test_chart_column.rb} +2 -2
- data/test/{test-chart-doughnut.rb → test_chart_doughnut.rb} +2 -2
- data/test/{test-chart-legend.rb → test_chart_legend.rb} +2 -2
- data/test/{test-chart-pie.rb → test_chart_pie.rb} +2 -2
- data/test/{test-chart-scatter.rb → test_chart_scatter.rb} +3 -4
- data/test/{test-chart-size.rb → test_chart_size.rb} +2 -2
- data/test/{test-chart-title.rb → test_chart_title.rb} +3 -3
- data/test/test_chartsheet.rb +201 -0
- data/test/{test-data.rb → test_data.rb} +1 -1
- data/test/{test-data-validation.rb → test_data_validation.rb} +23 -24
- data/test/{test-default-row.rb → test_default_row.rb} +1 -1
- data/test/{test-defined-name.rb → test_defined_name.rb} +12 -12
- data/test/{test-escapes.rb → test_escapes.rb} +5 -2
- data/test/{test-fit-to-pages.rb → test_fit_to_pages.rb} +6 -6
- data/test/{test-formatting.rb → test_formatting.rb} +10 -10
- data/test/{test-gridlines.rb → test_gridlines.rb} +3 -3
- data/test/{test-hyperlink.rb → test_hyperlink.rb} +22 -11
- data/test/{test-image.rb → test_image.rb} +6 -4
- data/test/{test-macro.rb → test_macro.rb} +1 -1
- data/test/{test-merge-range.rb → test_merge_range.rb} +1 -1
- data/test/{test-misc.rb → test_misc.rb} +2 -2
- data/test/{test-optimize.rb → test_optimize.rb} +2 -4
- data/test/{test-outline.rb → test_outline.rb} +14 -14
- data/test/{test-page-breaks.rb → test_page_breaks.rb} +2 -2
- data/test/{test-page-setup.rb → test_page_setup.rb} +2 -2
- data/test/{test-panes.rb → test_panes.rb} +1 -1
- data/test/{test-print-area.rb → test_print_area.rb} +3 -3
- data/test/{test-print-options.rb → test_print_options.rb} +7 -7
- data/test/{test-print-scale.rb → test_print_scale.rb} +2 -2
- data/test/{test-properties.rb → test_properties.rb} +2 -2
- data/test/{test-protect.rb → test_protect.rb} +3 -3
- data/test/{test-repeat.rb → test_repeat.rb} +3 -3
- data/test/{test-rich-string.rb → test_rich_string.rb} +5 -9
- data/test/{test-row-col-format.rb → test_row_col_format.rb} +1 -1
- data/test/{test-ruby-worksheet.rb → test_ruby_worksheet.rb} +2 -2
- data/test/{test-set-selection.rb → test_set_selection.rb} +2 -2
- data/test/{test-set-start-page.rb → test_set_start_page.rb} +2 -2
- data/test/{test-simple.rb → test_simple.rb} +10 -10
- data/test/{test-types.rb → test_types.rb} +1 -1
- data/test/{xlsx-func-testcase.rb → xlsx_func_testcase.rb} +1 -0
- metadata +135 -104
- data/test/test-array-formula.rb +0 -35
- data/test/test-autofilter.rb +0 -72
- data/test/test-chart-bar.rb +0 -74
- /data/test/{test-errors.rb → test_errors.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f03eb87d448a902c6067b95d4a3d7598cecd3456a3f8097e40da1bd0351c8d4
|
4
|
+
data.tar.gz: 2af72c3d678d22a1990f960ee0b7f2315e39d37a780b5e589ebce7794b1b23f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ebcf14300b3cbaf46fc3a784c2ad9b5c114fa2ea3dccca08976ae8af7f50265beb05ed4233da92db1398bed7e17144779ca2c973cab59dad55e95fb3ee926ae
|
7
|
+
data.tar.gz: 0cd298302d3c354ced238ed5fba71b7b05498db56c76df2b307d90603c122308c79780db9af55d1f46c7aece7f30da517a39d30f5d0b56acfd3107f79fbc9fb5
|
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'rake/extensiontask'
|
3
4
|
|
4
5
|
task default: :test
|
@@ -12,9 +13,9 @@ Rake::Task['compile'].prerequisites.unshift :patch_dep
|
|
12
13
|
Gem::PackageTask.new(spec) do |pkg|
|
13
14
|
end
|
14
15
|
|
15
|
-
DEP_DIR='ext/xlsxwriter/libxlsxwriter'
|
16
|
+
DEP_DIR = 'ext/xlsxwriter/libxlsxwriter'
|
16
17
|
|
17
|
-
desc
|
18
|
+
desc 'Checkout xlsxwriter C library'
|
18
19
|
task :patch_dep do
|
19
20
|
patches = Dir["#{pwd}/dep_patches/*.patch"]
|
20
21
|
chdir(DEP_DIR) do
|
@@ -30,5 +31,5 @@ end
|
|
30
31
|
|
31
32
|
desc 'Run specs'
|
32
33
|
task test: :compile do
|
33
|
-
ruby
|
34
|
+
ruby 'test/run_test.rb'
|
34
35
|
end
|
data/ext/xlsxwriter/chart.c
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
-
#include
|
1
|
+
#include <ruby.h>
|
2
2
|
#include <ruby/encoding.h>
|
3
|
+
|
4
|
+
#include "chart.h"
|
5
|
+
#include "common.h"
|
3
6
|
#include "workbook.h"
|
4
7
|
#include "worksheet.h"
|
5
8
|
|
@@ -7,10 +10,10 @@ VALUE cChart;
|
|
7
10
|
VALUE cChartSeries;
|
8
11
|
VALUE cChartAxis;
|
9
12
|
|
10
|
-
#define DEF_PROP_SETTER(type, field, value
|
13
|
+
#define DEF_PROP_SETTER(type, field, value) VALUE type ## _set_ ## field ## _ (VALUE self, VALUE val) { \
|
11
14
|
struct type *ptr; \
|
12
15
|
Data_Get_Struct(self, struct type, ptr); \
|
13
|
-
type ## _set_ ## field (ptr->
|
16
|
+
type ## _set_ ## field (ptr->type, value); \
|
14
17
|
return val; \
|
15
18
|
}
|
16
19
|
|
@@ -66,13 +69,13 @@ chart_axis_init(VALUE self, VALUE chart, VALUE type) {
|
|
66
69
|
if (c_ptr && c_ptr->chart) {
|
67
70
|
ID axis = rb_check_id_cstr("x", 1, NULL);
|
68
71
|
if (axis && axis == rb_check_id(&type)) {
|
69
|
-
ptr->
|
72
|
+
ptr->chart_axis = c_ptr->chart->x_axis;
|
70
73
|
return self;
|
71
74
|
}
|
72
75
|
|
73
76
|
axis = rb_check_id_cstr("y", 1, NULL);
|
74
77
|
if (axis && axis == rb_check_id(&type)) {
|
75
|
-
ptr->
|
78
|
+
ptr->chart_axis = c_ptr->chart->y_axis;
|
76
79
|
return self;
|
77
80
|
}
|
78
81
|
|
@@ -91,7 +94,7 @@ chart_series_alloc(VALUE klass) {
|
|
91
94
|
|
92
95
|
obj = Data_Make_Struct(klass, struct chart_series, NULL, NULL, ptr);
|
93
96
|
|
94
|
-
ptr->
|
97
|
+
ptr->chart_series = NULL;
|
95
98
|
|
96
99
|
return obj;
|
97
100
|
}
|
@@ -114,7 +117,7 @@ chart_series_init(int argc, VALUE *argv, VALUE self) {
|
|
114
117
|
vals = StringValueCStr(argv[1]);
|
115
118
|
}
|
116
119
|
if (c_ptr && c_ptr->chart) {
|
117
|
-
ptr->
|
120
|
+
ptr->chart_series = chart_add_series(c_ptr->chart, cats, vals);
|
118
121
|
}
|
119
122
|
|
120
123
|
return self;
|
@@ -181,9 +184,8 @@ chart_title_set_name_range_(int argc, VALUE *argv, VALUE self) {
|
|
181
184
|
lxw_row_t row;
|
182
185
|
lxw_col_t col;
|
183
186
|
extract_cell(argc - 1, argv + 1, &row, &col);
|
184
|
-
|
185
|
-
|
186
|
-
chart_title_set_name_range(ptr->chart, str, row, col);
|
187
|
+
|
188
|
+
LXW_NO_RESULT_CALL(chart, title_set_name_range, str, row, col);
|
187
189
|
return self;
|
188
190
|
}
|
189
191
|
|
@@ -195,10 +197,7 @@ chart_title_set_name_range_(int argc, VALUE *argv, VALUE self) {
|
|
195
197
|
*/
|
196
198
|
VALUE
|
197
199
|
chart_legend_set_position_(VALUE self, VALUE pos) {
|
198
|
-
|
199
|
-
Data_Get_Struct(self, struct chart, ptr);
|
200
|
-
|
201
|
-
chart_legend_set_position(ptr->chart, NUM2UINT(rb_check_to_int(pos)));
|
200
|
+
LXW_NO_RESULT_CALL(chart, legend_set_position, NUM2UINT(rb_check_to_int(pos)));
|
202
201
|
return pos;
|
203
202
|
}
|
204
203
|
|
@@ -209,11 +208,8 @@ chart_legend_set_position_(VALUE self, VALUE pos) {
|
|
209
208
|
*/
|
210
209
|
VALUE
|
211
210
|
chart_legend_set_font_(VALUE self, VALUE opts) {
|
212
|
-
struct chart *ptr;
|
213
211
|
lxw_chart_font font = val_to_lxw_chart_font(opts);
|
214
|
-
|
215
|
-
|
216
|
-
chart_legend_set_font(ptr->chart, &font);
|
212
|
+
LXW_NO_RESULT_CALL(chart, legend_set_font, &font);
|
217
213
|
return self;
|
218
214
|
}
|
219
215
|
|
@@ -234,9 +230,7 @@ chart_legend_delete_series_(VALUE self, VALUE series) {
|
|
234
230
|
}
|
235
231
|
series_arr[len] = -1;
|
236
232
|
|
237
|
-
|
238
|
-
Data_Get_Struct(self, struct chart, ptr);
|
239
|
-
chart_legend_delete_series(ptr->chart, series_arr);
|
233
|
+
LXW_ERR_RESULT_CALL(chart, legend_delete_series, series_arr);
|
240
234
|
return self;
|
241
235
|
}
|
242
236
|
|
@@ -246,18 +240,29 @@ chart_legend_delete_series_(VALUE self, VALUE series) {
|
|
246
240
|
*
|
247
241
|
* Sets the chart +style+ (integer from 1 to 48, default is 2).
|
248
242
|
*/
|
249
|
-
DEF_PROP_SETTER(chart, style, NUM2INT(rb_check_to_int(val))
|
243
|
+
DEF_PROP_SETTER(chart, style, NUM2INT(rb_check_to_int(val)))
|
250
244
|
|
251
245
|
|
252
246
|
/* Document-method: XlsxWriter::Workbook::Chart#rotation=
|
253
247
|
*
|
254
248
|
*/
|
255
|
-
DEF_PROP_SETTER(chart, rotation, NUM2UINT(rb_check_to_int(val))
|
249
|
+
DEF_PROP_SETTER(chart, rotation, NUM2UINT(rb_check_to_int(val)))
|
256
250
|
|
257
251
|
/* Document-method: XlsxWriter::Workbook::Chart#hole_size=
|
258
252
|
*
|
259
253
|
*/
|
260
|
-
DEF_PROP_SETTER(chart, hole_size, NUM2UINT(rb_check_to_int(val))
|
254
|
+
DEF_PROP_SETTER(chart, hole_size, NUM2UINT(rb_check_to_int(val)))
|
255
|
+
|
256
|
+
/* Document-method: XlsxWriter::Workbook::Chart#show_blanks_as=
|
257
|
+
*
|
258
|
+
*/
|
259
|
+
VALUE
|
260
|
+
chart_set_show_blank_as_(VALUE self, VALUE val) {
|
261
|
+
struct chart *ptr;
|
262
|
+
Data_Get_Struct(self, struct chart, ptr);
|
263
|
+
ptr->chart->show_blanks_as = NUM2INT(rb_check_to_int(val));
|
264
|
+
return val;
|
265
|
+
}
|
261
266
|
|
262
267
|
|
263
268
|
/* :nodoc: */
|
@@ -273,7 +278,7 @@ VALUE
|
|
273
278
|
chart_set_axis_id_1_(VALUE self, VALUE val) {
|
274
279
|
struct chart *ptr;
|
275
280
|
Data_Get_Struct(self, struct chart, ptr);
|
276
|
-
ptr->chart->axis_id_1 = NUM2UINT(val);
|
281
|
+
ptr->chart->axis_id_1 = NUM2UINT(rb_check_to_int(val));
|
277
282
|
return val;
|
278
283
|
}
|
279
284
|
|
@@ -290,7 +295,7 @@ VALUE
|
|
290
295
|
chart_set_axis_id_2_(VALUE self, VALUE val) {
|
291
296
|
struct chart *ptr;
|
292
297
|
Data_Get_Struct(self, struct chart, ptr);
|
293
|
-
ptr->chart->axis_id_2 = NUM2UINT(val);
|
298
|
+
ptr->chart->axis_id_2 = NUM2UINT(rb_check_to_int(val));
|
294
299
|
return val;
|
295
300
|
}
|
296
301
|
|
@@ -301,17 +306,17 @@ chart_set_axis_id_2_(VALUE self, VALUE val) {
|
|
301
306
|
*
|
302
307
|
* Sets the chart axis +name+.
|
303
308
|
*/
|
304
|
-
DEF_PROP_SETTER(chart_axis, name, StringValueCStr(val)
|
309
|
+
DEF_PROP_SETTER(chart_axis, name, StringValueCStr(val))
|
305
310
|
|
306
311
|
/* Document-method XlsxWriter::Workbook::Chart::Axis#interval_unit=
|
307
312
|
*
|
308
313
|
*/
|
309
|
-
DEF_PROP_SETTER(chart_axis, interval_unit, NUM2UINT(rb_check_to_int(val))
|
314
|
+
DEF_PROP_SETTER(chart_axis, interval_unit, NUM2UINT(rb_check_to_int(val)))
|
310
315
|
|
311
316
|
/* Document-method XlsxWriter::Workbook::Chart::Axis#interval_tick=
|
312
317
|
*
|
313
318
|
*/
|
314
|
-
DEF_PROP_SETTER(chart_axis, interval_tick, NUM2UINT(rb_check_to_int(val))
|
319
|
+
DEF_PROP_SETTER(chart_axis, interval_tick, NUM2UINT(rb_check_to_int(val)))
|
315
320
|
|
316
321
|
/* Document-method: XlsxWriter::Workbook::Chart::Axis#max=
|
317
322
|
*
|
@@ -319,7 +324,7 @@ DEF_PROP_SETTER(chart_axis, interval_tick, NUM2UINT(rb_check_to_int(val)), axis)
|
|
319
324
|
*
|
320
325
|
* Sets the chart axis +max+ value.
|
321
326
|
*/
|
322
|
-
DEF_PROP_SETTER(chart_axis, max, NUM2DBL(rb_check_to_float(val))
|
327
|
+
DEF_PROP_SETTER(chart_axis, max, NUM2DBL(rb_check_to_float(val)))
|
323
328
|
|
324
329
|
/* Document-method: XlsxWriter::Workbook::Chart::Axis#min=
|
325
330
|
*
|
@@ -327,47 +332,47 @@ DEF_PROP_SETTER(chart_axis, max, NUM2DBL(rb_check_to_float(val)), axis)
|
|
327
332
|
*
|
328
333
|
* Sets the chart axis +min+ value.
|
329
334
|
*/
|
330
|
-
DEF_PROP_SETTER(chart_axis, min, NUM2DBL(rb_check_to_float(val))
|
335
|
+
DEF_PROP_SETTER(chart_axis, min, NUM2DBL(rb_check_to_float(val)))
|
331
336
|
|
332
337
|
/* Document-method: XlsxWriter::Workbook::Chart::Axis#major_tick_mark=
|
333
338
|
*
|
334
339
|
*/
|
335
|
-
DEF_PROP_SETTER(chart_axis, major_tick_mark, NUM2UINT(rb_check_to_int(val))
|
340
|
+
DEF_PROP_SETTER(chart_axis, major_tick_mark, NUM2UINT(rb_check_to_int(val)))
|
336
341
|
|
337
342
|
/* Document-method: XlsxWriter::Workbook::Chart::Axis#minor_tick_mark=
|
338
343
|
*
|
339
344
|
*/
|
340
|
-
DEF_PROP_SETTER(chart_axis, minor_tick_mark, NUM2UINT(rb_check_to_int(val))
|
345
|
+
DEF_PROP_SETTER(chart_axis, minor_tick_mark, NUM2UINT(rb_check_to_int(val)))
|
341
346
|
|
342
347
|
/* Document-method: XlsxWriter::Workbook::Chart::Axis#major_unit=
|
343
348
|
*
|
344
349
|
*/
|
345
|
-
DEF_PROP_SETTER(chart_axis, major_unit, NUM2DBL(rb_check_to_float(val))
|
350
|
+
DEF_PROP_SETTER(chart_axis, major_unit, NUM2DBL(rb_check_to_float(val)))
|
346
351
|
|
347
352
|
/* Document-method: XlsxWriter::Workbook::Chart::Axis#minor_unit=
|
348
353
|
*
|
349
354
|
*/
|
350
|
-
DEF_PROP_SETTER(chart_axis, minor_unit, NUM2DBL(rb_check_to_float(val))
|
355
|
+
DEF_PROP_SETTER(chart_axis, minor_unit, NUM2DBL(rb_check_to_float(val)))
|
351
356
|
|
352
357
|
/* Document-method: XlsxWriter::Workbook::Chart::Axis#label_align=
|
353
358
|
*
|
354
359
|
*/
|
355
|
-
DEF_PROP_SETTER(chart_axis, label_align, NUM2UINT(rb_check_to_int(val))
|
360
|
+
DEF_PROP_SETTER(chart_axis, label_align, NUM2UINT(rb_check_to_int(val)))
|
356
361
|
|
357
362
|
/* Document-method: XlsxWriter::Workbook::Chart::Axis#label_position=
|
358
363
|
*
|
359
364
|
*/
|
360
|
-
DEF_PROP_SETTER(chart_axis, label_position, NUM2DBL(rb_check_to_float(val))
|
365
|
+
DEF_PROP_SETTER(chart_axis, label_position, NUM2DBL(rb_check_to_float(val)))
|
361
366
|
|
362
367
|
/* Document-method: XlsxWriter::Workbook::Chart::Axis#log_base=
|
363
368
|
*
|
364
369
|
*/
|
365
|
-
DEF_PROP_SETTER(chart_axis, log_base, NUM2DBL(rb_check_to_float(val))
|
370
|
+
DEF_PROP_SETTER(chart_axis, log_base, NUM2DBL(rb_check_to_float(val)))
|
366
371
|
|
367
372
|
/* Document-method: XlsxWriter::Workbook::Chart::Axis#num_format=
|
368
373
|
*
|
369
374
|
*/
|
370
|
-
DEF_PROP_SETTER(chart_axis, num_format, StringValueCStr(val)
|
375
|
+
DEF_PROP_SETTER(chart_axis, num_format, StringValueCStr(val))
|
371
376
|
|
372
377
|
/* call-seq:
|
373
378
|
* axis.set_name_range(name, cell) -> self
|
@@ -382,9 +387,7 @@ chart_axis_set_name_range_(int argc, VALUE *argv, VALUE self) {
|
|
382
387
|
lxw_row_t row;
|
383
388
|
lxw_col_t col;
|
384
389
|
extract_cell(argc - 1, argv + 1, &row, &col);
|
385
|
-
|
386
|
-
Data_Get_Struct(self, struct chart_axis, ptr);
|
387
|
-
chart_axis_set_name_range(ptr->axis, str, row, col);
|
390
|
+
LXW_NO_RESULT_CALL(chart_axis, set_name_range, str, row, col);
|
388
391
|
return self;
|
389
392
|
}
|
390
393
|
|
@@ -394,11 +397,8 @@ chart_axis_set_name_range_(int argc, VALUE *argv, VALUE self) {
|
|
394
397
|
*/
|
395
398
|
VALUE
|
396
399
|
chart_axis_set_name_font_(VALUE self, VALUE value) {
|
397
|
-
struct chart_axis *ptr;
|
398
400
|
lxw_chart_font font = val_to_lxw_chart_font(value);
|
399
|
-
|
400
|
-
|
401
|
-
chart_axis_set_name_font(ptr->axis, &font);
|
401
|
+
LXW_NO_RESULT_CALL(chart_axis, set_name_font, &font);
|
402
402
|
return self;
|
403
403
|
}
|
404
404
|
|
@@ -408,11 +408,8 @@ chart_axis_set_name_font_(VALUE self, VALUE value) {
|
|
408
408
|
*/
|
409
409
|
VALUE
|
410
410
|
chart_axis_set_num_font_(VALUE self, VALUE value) {
|
411
|
-
struct chart_axis *ptr;
|
412
411
|
lxw_chart_font font = val_to_lxw_chart_font(value);
|
413
|
-
|
414
|
-
|
415
|
-
chart_axis_set_num_font(ptr->axis, &font);
|
412
|
+
LXW_NO_RESULT_CALL(chart_axis, set_num_font, &font);
|
416
413
|
return self;
|
417
414
|
}
|
418
415
|
|
@@ -422,12 +419,8 @@ chart_axis_set_num_font_(VALUE self, VALUE value) {
|
|
422
419
|
*/
|
423
420
|
VALUE
|
424
421
|
chart_axis_set_line_(VALUE self, VALUE opts) {
|
425
|
-
struct chart_axis *ptr;
|
426
422
|
lxw_chart_line line = val_to_lxw_chart_line(opts);
|
427
|
-
|
428
|
-
Data_Get_Struct(self, struct chart_axis, ptr);
|
429
|
-
|
430
|
-
chart_axis_set_line(ptr->axis, &line);
|
423
|
+
LXW_NO_RESULT_CALL(chart_axis, set_line, &line);
|
431
424
|
return self;
|
432
425
|
}
|
433
426
|
|
@@ -437,19 +430,15 @@ chart_axis_set_line_(VALUE self, VALUE opts) {
|
|
437
430
|
*/
|
438
431
|
VALUE
|
439
432
|
chart_axis_set_fill_(VALUE self, VALUE opts) {
|
440
|
-
struct chart_axis *ptr;
|
441
433
|
lxw_chart_fill fill = val_to_lxw_chart_fill(opts);
|
442
|
-
|
443
|
-
Data_Get_Struct(self, struct chart_axis, ptr);
|
444
|
-
|
445
|
-
chart_axis_set_fill(ptr->axis, &fill);
|
434
|
+
LXW_NO_RESULT_CALL(chart_axis, set_fill, &fill);
|
446
435
|
return self;
|
447
436
|
}
|
448
437
|
|
449
438
|
/* Document-method XlsxWriter::Workbook::Chart::Axis#position=
|
450
439
|
*
|
451
440
|
*/
|
452
|
-
DEF_PROP_SETTER(chart_axis, position, NUM2UINT(rb_check_to_int(val))
|
441
|
+
DEF_PROP_SETTER(chart_axis, position, NUM2UINT(rb_check_to_int(val)))
|
453
442
|
|
454
443
|
/* call-seq: axis.reverse = true
|
455
444
|
*
|
@@ -457,11 +446,8 @@ DEF_PROP_SETTER(chart_axis, position, NUM2UINT(rb_check_to_int(val)), axis)
|
|
457
446
|
*/
|
458
447
|
VALUE
|
459
448
|
chart_axis_set_reverse_(VALUE self, VALUE p) {
|
460
|
-
struct chart_axis *ptr;
|
461
449
|
if (RTEST(p)) {
|
462
|
-
|
463
|
-
|
464
|
-
chart_axis_set_reverse(ptr->axis);
|
450
|
+
LXW_NO_RESULT_CALL(chart_axis, set_reverse);
|
465
451
|
}
|
466
452
|
return p;
|
467
453
|
}
|
@@ -472,7 +458,7 @@ chart_axis_set_source_linked_(VALUE self, VALUE val) {
|
|
472
458
|
|
473
459
|
Data_Get_Struct(self, struct chart_axis, ptr);
|
474
460
|
|
475
|
-
ptr->
|
461
|
+
ptr->chart_axis->source_linked = NUM2UINT(rb_check_to_int(val));
|
476
462
|
|
477
463
|
return val;
|
478
464
|
}
|
@@ -493,9 +479,29 @@ chart_series_set_categories_(int argc, VALUE *argv, VALUE self) {
|
|
493
479
|
lxw_row_t row_from, row_to;
|
494
480
|
lxw_col_t col_from, col_to;
|
495
481
|
extract_range(argc - 1, argv + 1, &row_from, &col_from, &row_to, &col_to);
|
496
|
-
|
497
|
-
|
498
|
-
|
482
|
+
LXW_NO_RESULT_CALL(chart_series, set_categories, str, row_from, col_from, row_to, col_to);
|
483
|
+
return self;
|
484
|
+
}
|
485
|
+
|
486
|
+
/* call-seq: series.set_fill(options)
|
487
|
+
*
|
488
|
+
* Sets chart series fill options. See {libxlsxwriter doc}[https://libxlsxwriter.github.io/structlxw__chart__fill.html] for details.
|
489
|
+
*/
|
490
|
+
VALUE
|
491
|
+
chart_series_set_fill_(VALUE self, VALUE opts) {
|
492
|
+
lxw_chart_fill fill = val_to_lxw_chart_fill(opts);
|
493
|
+
LXW_NO_RESULT_CALL(chart_series, set_fill, &fill);
|
494
|
+
return self;
|
495
|
+
}
|
496
|
+
|
497
|
+
/* call-seq: series.set_line(options)
|
498
|
+
*
|
499
|
+
* Sets chart series line options. See {libxlsxwriter doc}[https://libxlsxwriter.github.io/structlxw__chart__line.html] for details.
|
500
|
+
*/
|
501
|
+
VALUE
|
502
|
+
chart_series_set_line_(VALUE self, VALUE opts) {
|
503
|
+
lxw_chart_line line = val_to_lxw_chart_line(opts);
|
504
|
+
LXW_NO_RESULT_CALL(chart_series, set_line, &line);
|
499
505
|
return self;
|
500
506
|
}
|
501
507
|
|
@@ -513,9 +519,7 @@ chart_series_set_values_(int argc, VALUE *argv, VALUE self) {
|
|
513
519
|
lxw_row_t row_from, row_to;
|
514
520
|
lxw_col_t col_from, col_to;
|
515
521
|
extract_range(argc - 1, argv + 1, &row_from, &col_from, &row_to, &col_to);
|
516
|
-
|
517
|
-
Data_Get_Struct(self, struct chart_series, ptr);
|
518
|
-
chart_series_set_values(ptr->series, str, row_from, col_from, row_to, col_to);
|
522
|
+
LXW_NO_RESULT_CALL(chart_series, set_values, str, row_from, col_from, row_to, col_to);
|
519
523
|
return self;
|
520
524
|
}
|
521
525
|
|
@@ -525,7 +529,7 @@ chart_series_set_values_(int argc, VALUE *argv, VALUE self) {
|
|
525
529
|
*
|
526
530
|
* Set chart series name.
|
527
531
|
*/
|
528
|
-
DEF_PROP_SETTER(chart_series, name, StringValueCStr(val)
|
532
|
+
DEF_PROP_SETTER(chart_series, name, StringValueCStr(val))
|
529
533
|
|
530
534
|
/* call-seq:
|
531
535
|
* series.set_name_range(name, cell) -> self
|
@@ -540,19 +544,14 @@ chart_series_set_name_range_(int argc, VALUE *argv, VALUE self) {
|
|
540
544
|
lxw_row_t row;
|
541
545
|
lxw_col_t col;
|
542
546
|
extract_cell(argc - 1, argv + 1, &row, &col);
|
543
|
-
|
544
|
-
Data_Get_Struct(self, struct chart_series, ptr);
|
545
|
-
chart_series_set_name_range(ptr->series, str, row, col);
|
547
|
+
LXW_NO_RESULT_CALL(chart_series, set_name_range, str, row, col);
|
546
548
|
return self;
|
547
549
|
}
|
548
550
|
|
549
551
|
VALUE
|
550
552
|
chart_series_set_invert_if_negative_(VALUE self, VALUE p) {
|
551
|
-
struct chart_series *ptr;
|
552
553
|
if (RTEST(p)) {
|
553
|
-
|
554
|
-
|
555
|
-
chart_series_set_invert_if_negative(ptr->series);
|
554
|
+
LXW_NO_RESULT_CALL(chart_series, set_invert_if_negative);
|
556
555
|
}
|
557
556
|
return p;
|
558
557
|
}
|
@@ -623,17 +622,20 @@ void init_xlsxwriter_chart() {
|
|
623
622
|
|
624
623
|
|
625
624
|
rb_define_alloc_func(cChart, chart_alloc);
|
625
|
+
rb_define_attr(cChart, "workbook", 1, 0);
|
626
626
|
rb_define_method(cChart, "initialize", chart_init, 2);
|
627
627
|
rb_define_method(cChart, "add_series", chart_add_series_, -1);
|
628
628
|
rb_define_method(cChart, "x_axis", chart_x_axis_, 0);
|
629
629
|
rb_define_method(cChart, "y_axis", chart_y_axis_, 0);
|
630
630
|
rb_define_method(cChart, "title=", chart_title_set_name_, 1);
|
631
|
+
rb_define_method(cChart, "set_name_range", chart_title_set_name_range_, -1);
|
631
632
|
rb_define_method(cChart, "legend_position=", chart_legend_set_position_, 1);
|
632
633
|
rb_define_method(cChart, "legend_set_font", chart_legend_set_font_, 1);
|
633
634
|
rb_define_method(cChart, "legend_delete_series", chart_legend_delete_series_, 1);
|
634
635
|
rb_define_method(cChart, "style=", chart_set_style_, 1);
|
635
636
|
rb_define_method(cChart, "rotation=", chart_set_rotation_, 1);
|
636
637
|
rb_define_method(cChart, "hole_size=", chart_set_hole_size_, 1);
|
638
|
+
rb_define_method(cChart, "show_blank_as=", chart_set_show_blank_as_, 1);
|
637
639
|
|
638
640
|
rb_define_method(cChart, "axis_id_1", chart_get_axis_id_1_, 0);
|
639
641
|
rb_define_method(cChart, "axis_id_1=", chart_set_axis_id_1_, 1);
|
@@ -669,6 +671,8 @@ void init_xlsxwriter_chart() {
|
|
669
671
|
rb_define_method(cChartSeries, "initialize", chart_series_init, -1);
|
670
672
|
|
671
673
|
rb_define_method(cChartSeries, "set_categories", chart_series_set_categories_, -1);
|
674
|
+
rb_define_method(cChartSeries, "set_fill", chart_series_set_fill_, 1);
|
675
|
+
rb_define_method(cChartSeries, "set_line", chart_series_set_line_, 1);
|
672
676
|
rb_define_method(cChartSeries, "set_values", chart_series_set_values_, -1);
|
673
677
|
rb_define_method(cChartSeries, "name=", chart_series_set_name_, 1);
|
674
678
|
rb_define_method(cChartSeries, "set_name_range", chart_series_set_name_range_, -1);
|
@@ -710,6 +714,10 @@ void init_xlsxwriter_chart() {
|
|
710
714
|
MAP_CHART_CONST(AXIS_LABEL_ALIGN_CENTER);
|
711
715
|
MAP_CHART_CONST(AXIS_LABEL_ALIGN_LEFT);
|
712
716
|
MAP_CHART_CONST(AXIS_LABEL_ALIGN_RIGHT);
|
717
|
+
|
718
|
+
MAP_CHART_CONST(BLANKS_AS_GAP);
|
719
|
+
MAP_CHART_CONST(BLANKS_AS_ZERO);
|
720
|
+
MAP_CHART_CONST(BLANKS_AS_CONNECTED);
|
713
721
|
#undef MAP_CHART_CONST
|
714
722
|
|
715
723
|
#define MAP_CHART_AXIS_CONST(name) rb_define_const(cChartAxis, #name, INT2NUM(LXW_CHART_AXIS_##name))
|
data/ext/xlsxwriter/chart.h
CHANGED
@@ -9,11 +9,11 @@ struct chart {
|
|
9
9
|
};
|
10
10
|
|
11
11
|
struct chart_axis {
|
12
|
-
lxw_chart_axis *
|
12
|
+
lxw_chart_axis *chart_axis;
|
13
13
|
};
|
14
14
|
|
15
15
|
struct chart_series {
|
16
|
-
lxw_chart_series *
|
16
|
+
lxw_chart_series *chart_series;
|
17
17
|
};
|
18
18
|
|
19
19
|
lxw_chart_fill val_to_lxw_chart_fill(VALUE opts);
|