xlsxwriter 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d204426791a93175f4a17f4e81369067b14de83
4
- data.tar.gz: 4ce86fadb8ad88e46578dddda1e216e4fb9a5be5
3
+ metadata.gz: a6f5f03efc612b8ffe35f2ef05469e2866793dd4
4
+ data.tar.gz: 62d0c4d63bc61a782fd481ef906b13fb28e9ac74
5
5
  SHA512:
6
- metadata.gz: 68ea67e8de2d0b9ebced09bff5fde5e7eedb5a1e278190e826a106bf21e2ba0193a5edf37a5254703e6b63f339e11ea508feac4c90498ae4230ab57ca9a3c557
7
- data.tar.gz: 7a6f557d3683cc02f9e3a20b3426aba916a2700fd8508b2a64ab0b0e20210cebabbecb1c98d897f450905a1cd548ee17fd441f5ef0878712625a0aac1a48d629
6
+ metadata.gz: 7536f8487db5f37a3b1cce3f2b74eeba1f00f64db1c6ee55ad5ee58f4ca65c78a12fc3e5f4d939cbb4cd85f333b3a525a0ce2b36bb7a53ead4e7a22d0652d424
7
+ data.tar.gz: 0e718cd11773b8774cdc86dae2ecbe5c4a82bcabb43387b8ebd70db3bee983a7e7307398d9fa1e910c2898efab8dd067e4d88b17fc7873ffac887e0f4b67e2d7
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ spec = Gem::Specification.load('xlsxwriter.gemspec')
6
6
  Rake::ExtensionTask.new('xlsxwriter', spec) do |ext|
7
7
  ext.lib_dir = 'lib/xlsxwriter'
8
8
  end
9
- task compile: :fetch_dep
9
+ task compile: :patch_dep
10
10
 
11
11
  Gem::PackageTask.new(spec) do |pkg|
12
12
  end
@@ -14,23 +14,11 @@ end
14
14
  DEP_DIR='ext/xlsxwriter/libxlsxwriter'
15
15
 
16
16
  desc "Checkout xlsxwriter C library"
17
- task :fetch_dep do
18
- rev = File.read('.dep_revision').chomp if File.exist?('.dep_revision')
19
-
20
- unless File.exist?('./ext/xlsxwriter/libxlsxwriter')
21
- `git clone https://github.com/jmcnamara/libxlsxwriter.git #{DEP_DIR}`
22
- else
23
- `cd #{DEP_DIR} && git fetch`
24
- end
25
-
26
- if rev
27
- `cd #{DEP_DIR} && git reset --hard #{rev}`
28
- else
29
- `(cd #{DEP_DIR} && git rev-parse HEAD) > .dep_revision`
30
- end
17
+ task :patch_dep do
18
+ `cd #{DEP_DIR} && git reset --hard`
31
19
 
32
20
  Dir['./dep_patches/*.patch'].each do |patch|
33
- `(cd #{DEP_DIR} && patch -p1) <#{patch}`
21
+ `(cd #{DEP_DIR} && patch -N -p1) <#{patch}`
34
22
  end
35
23
  end
36
24
 
@@ -1,5 +1,12 @@
1
1
  #include "chart.h"
2
+ #include <ruby/encoding.h>
2
3
  #include "workbook.h"
4
+ #include "worksheet.h"
5
+
6
+ VALUE cChart;
7
+ VALUE cChartSeries;
8
+ VALUE cChartAxis;
9
+
3
10
 
4
11
  VALUE
5
12
  chart_alloc(VALUE klass) {
@@ -13,6 +20,7 @@ chart_alloc(VALUE klass) {
13
20
  return obj;
14
21
  }
15
22
 
23
+ /* :nodoc: */
16
24
  VALUE
17
25
  chart_init(VALUE self, VALUE workbook, VALUE type) {
18
26
  struct chart *ptr;
@@ -29,6 +37,46 @@ chart_init(VALUE self, VALUE workbook, VALUE type) {
29
37
  return self;
30
38
  }
31
39
 
40
+ VALUE
41
+ chart_axis_alloc(VALUE klass) {
42
+ VALUE obj;
43
+ struct chart_axis *ptr;
44
+
45
+ obj = Data_Make_Struct(klass, struct chart_axis, NULL, NULL, ptr);
46
+
47
+ return obj;
48
+ }
49
+
50
+ /* :nodoc: */
51
+ VALUE
52
+ chart_axis_init(VALUE self, VALUE chart, VALUE type) {
53
+ struct chart_axis *ptr;
54
+ struct chart *c_ptr;
55
+
56
+ Data_Get_Struct(chart, struct chart, c_ptr);
57
+ Data_Get_Struct(self, struct chart_axis, ptr);
58
+ rb_iv_set(self, "@chart", chart);
59
+ if (c_ptr && c_ptr->chart) {
60
+ ID axis = rb_check_id_cstr("x", 1, NULL);
61
+ if (axis && axis == rb_check_id(&type)) {
62
+ ptr->axis = c_ptr->chart->x_axis;
63
+ return self;
64
+ }
65
+
66
+ axis = rb_check_id_cstr("y", 1, NULL);
67
+ if (axis && axis == rb_check_id(&type)) {
68
+ ptr->axis = c_ptr->chart->y_axis;
69
+ return self;
70
+ }
71
+
72
+ rb_raise(rb_eArgError, "Unexpected axis type %"PRIsVALUE, rb_inspect(type));
73
+ } else {
74
+ rb_raise(rb_eRuntimeError, "Chart seems to be already closed.");
75
+ }
76
+
77
+ return self;
78
+ }
79
+
32
80
  VALUE
33
81
  chart_series_alloc(VALUE klass) {
34
82
  VALUE obj;
@@ -41,12 +89,13 @@ chart_series_alloc(VALUE klass) {
41
89
  return obj;
42
90
  }
43
91
 
92
+ /* :nodoc: */
44
93
  VALUE
45
94
  chart_series_init(int argc, VALUE *argv, VALUE self) {
46
95
  struct chart_series *ptr;
47
96
  struct chart *c_ptr;
48
97
  char *cats = NULL, *vals = NULL;
49
- rb_check_arity(argc, 2, 3);
98
+ rb_check_arity(argc, 1, 3);
50
99
 
51
100
  Data_Get_Struct(argv[0], struct chart, c_ptr);
52
101
  Data_Get_Struct(self, struct chart_series, ptr);
@@ -54,7 +103,7 @@ chart_series_init(int argc, VALUE *argv, VALUE self) {
54
103
  if (argc > 2) {
55
104
  cats = StringValueCStr(argv[1]);
56
105
  vals = StringValueCStr(argv[2]);
57
- } else {
106
+ } else if (argc > 1) {
58
107
  vals = StringValueCStr(argv[1]);
59
108
  }
60
109
  if (c_ptr && c_ptr->chart) {
@@ -64,16 +113,160 @@ chart_series_init(int argc, VALUE *argv, VALUE self) {
64
113
  return self;
65
114
  }
66
115
 
67
-
116
+ /* call-seq: chart.add_series([categories,] values) -> self
117
+ *
118
+ * Adds data series to the chart.
119
+ */
68
120
  VALUE
69
121
  chart_add_series_(int argc, VALUE *argv, VALUE self) {
70
- rb_check_arity(argc, 1, 2);
122
+ rb_check_arity(argc, 0, 2);
71
123
 
72
124
  VALUE series = rb_funcall(cChartSeries, rb_intern("new"), argc+1, self, argv[0], argv[1]);
73
125
  return series;
74
126
  }
75
127
 
128
+ /* call-seq: chart.x_axis -> Chart::Axis
129
+ *
130
+ * Returns x axis as Chart::Axis
131
+ */
132
+ VALUE
133
+ chart_x_axis_(VALUE self) {
134
+ return rb_funcall(cChartAxis, rb_intern("new"), 2, self, ID2SYM(rb_intern("x")));
135
+ }
136
+
137
+ /* call-seq: chart.y_axis -> Chart::Axis
138
+ *
139
+ * Returns y axis as Chart::Axis
140
+ */
141
+ VALUE
142
+ chart_y_axis_(VALUE self) {
143
+ return rb_funcall(cChartAxis, rb_intern("new"), 2, self, ID2SYM(rb_intern("y")));
144
+ }
145
+
146
+ /* call-seq: chart.title=(title) -> title
147
+ *
148
+ * Sets the chart title.
149
+ */
150
+ VALUE
151
+ chart_title_set_name_(VALUE self, VALUE name) {
152
+ struct chart *ptr;
153
+ Data_Get_Struct(self, struct chart, ptr);
154
+
155
+ if (RTEST(name)) {
156
+ chart_title_set_name(ptr->chart, StringValueCStr(name));
157
+ } else {
158
+ chart_title_off(ptr->chart);
159
+ }
160
+
161
+ return name;
162
+ }
163
+
164
+ /* call-seq:
165
+ * chart.set_name_range(name, cell) -> self
166
+ * chart.set_name_range(name, row, col) -> self
167
+ *
168
+ * Sets the chart title range (+cell+) and +name+.
169
+ */
170
+ VALUE
171
+ chart_title_set_name_range_(int argc, VALUE *argv, VALUE self) {
172
+ rb_check_arity(argc, 2, 3);
173
+ const char *str = StringValueCStr(argv[0]);
174
+ lxw_row_t row;
175
+ lxw_col_t col;
176
+ extract_cell(argc - 1, argv + 1, &row, &col);
177
+ struct chart *ptr;
178
+ Data_Get_Struct(self, struct chart, ptr);
179
+ chart_title_set_name_range(ptr->chart, str, row, col);
180
+ return self;
181
+ }
182
+
183
+ /* call-seq: chart.legend_position=(position) -> position
184
+ *
185
+ * Sets the chart legend position, one of <code>Chart::{LEGEND_NONE, LEGEND_RIGHT,
186
+ * LEGEND_LEFT, LEGEND_TOP, LEGEND_BOTTOM, LEGEND_OVERLAY_RIGHT,
187
+ * LEGEND_OVERLAY_LEFT}</code>.
188
+ */
189
+ VALUE
190
+ chart_legend_set_position_(VALUE self, VALUE pos) {
191
+ struct chart *ptr;
192
+ Data_Get_Struct(self, struct chart, ptr);
193
+
194
+ chart_legend_set_position(ptr->chart, NUM2UINT(rb_check_to_int(pos)));
195
+ return pos;
196
+ }
197
+
198
+ /* call-seq: chart.legend_set_font(options) -> self
199
+ *
200
+ * Sets legend font from options (name, size, bold, italic, underline, rotation,
201
+ * color, baseline).
202
+ */
203
+ VALUE
204
+ chart_legend_set_font_(VALUE self, VALUE opts) {
205
+ struct chart *ptr;
206
+ lxw_chart_font font = val_to_lxw_chart_font(opts);
207
+ Data_Get_Struct(self, struct chart, ptr);
208
+
209
+ chart_legend_set_font(ptr->chart, &font);
210
+ return self;
211
+ }
76
212
 
213
+ /* call-seq: chart.legend_delete_series(series) -> self
214
+ *
215
+ * Deletes series by 0-based indexes from the chart legend.
216
+ *
217
+ * chart.legend_delete_series([0, 2])
218
+ */
219
+ VALUE
220
+ chart_legend_delete_series_(VALUE self, VALUE series) {
221
+ series = rb_check_array_type(series);
222
+ const size_t len = RARRAY_LEN(series);
223
+ int16_t series_arr[len+1];
224
+ for (size_t i = 0; i < len; ++i) {
225
+ series_arr[i] = NUM2INT(rb_check_to_int(rb_ary_entry(series, i)));
226
+ }
227
+ series_arr[len] = -1;
228
+
229
+ struct chart *ptr;
230
+ Data_Get_Struct(self, struct chart, ptr);
231
+ chart_legend_delete_series(ptr->chart, series_arr);
232
+ return self;
233
+ }
234
+
235
+ /* call-seq: chart.style=(style) -> style
236
+ *
237
+ * Sets the chart +style+ (integer from 1 to 48, default is 2).
238
+ */
239
+ VALUE
240
+ chart_set_style_(VALUE self, VALUE style) {
241
+ struct chart *ptr;
242
+ Data_Get_Struct(self, struct chart, ptr);
243
+
244
+ chart_set_style(ptr->chart, NUM2INT(rb_check_to_int(style)));
245
+ return style;
246
+ }
247
+
248
+ /* :nodoc: */
249
+ VALUE
250
+ chart_set_rotation_(VALUE self, VALUE rotation) {
251
+ struct chart *ptr;
252
+ Data_Get_Struct(self, struct chart, ptr);
253
+
254
+ chart_set_rotation(ptr->chart, NUM2UINT(rb_check_to_int(rotation)));
255
+ return rotation;
256
+ }
257
+
258
+ /* :nodoc: */
259
+ VALUE
260
+ chart_set_hole_size_(VALUE self, VALUE size) {
261
+ struct chart *ptr;
262
+ Data_Get_Struct(self, struct chart, ptr);
263
+
264
+ chart_set_hole_size(ptr->chart, NUM2UINT(rb_check_to_int(size)));
265
+ return size;
266
+ }
267
+
268
+
269
+ /* :nodoc: */
77
270
  VALUE
78
271
  chart_get_axis_id_1_(VALUE self) {
79
272
  struct chart *ptr;
@@ -81,6 +274,7 @@ chart_get_axis_id_1_(VALUE self) {
81
274
  return UINT2NUM(ptr->chart->axis_id_1);
82
275
  }
83
276
 
277
+ /* :nodoc: */
84
278
  VALUE
85
279
  chart_set_axis_id_1_(VALUE self, VALUE val) {
86
280
  struct chart *ptr;
@@ -89,6 +283,7 @@ chart_set_axis_id_1_(VALUE self, VALUE val) {
89
283
  return val;
90
284
  }
91
285
 
286
+ /* :nodoc: */
92
287
  VALUE
93
288
  chart_get_axis_id_2_(VALUE self) {
94
289
  struct chart *ptr;
@@ -96,6 +291,7 @@ chart_get_axis_id_2_(VALUE self) {
96
291
  return UINT2NUM(ptr->chart->axis_id_2);
97
292
  }
98
293
 
294
+ /* :nodoc: */
99
295
  VALUE
100
296
  chart_set_axis_id_2_(VALUE self, VALUE val) {
101
297
  struct chart *ptr;
@@ -103,3 +299,302 @@ chart_set_axis_id_2_(VALUE self, VALUE val) {
103
299
  ptr->chart->axis_id_2 = NUM2UINT(val);
104
300
  return val;
105
301
  }
302
+
303
+
304
+ /* call-seq: axis.name=(name) -> name
305
+ *
306
+ * Sets the chart axis +name+.
307
+ */
308
+ VALUE
309
+ chart_axis_set_name_(VALUE self, VALUE val) {
310
+ struct chart_axis *ptr;
311
+ Data_Get_Struct(self, struct chart_axis, ptr);
312
+
313
+ chart_axis_set_name(ptr->axis, StringValueCStr(val));
314
+ return val;
315
+ }
316
+
317
+ /* call-seq:
318
+ * axis.set_name_range(name, cell) -> self
319
+ * axis.set_name_range(name, row, col) -> self
320
+ *
321
+ * Sets the chart axis name range from +cell+, with value +name+.
322
+ */
323
+ VALUE
324
+ chart_axis_set_name_range_(int argc, VALUE *argv, VALUE self) {
325
+ rb_check_arity(argc, 2, 3);
326
+ const char *str = StringValueCStr(argv[0]);
327
+ lxw_row_t row;
328
+ lxw_col_t col;
329
+ extract_cell(argc - 1, argv + 1, &row, &col);
330
+ struct chart_axis *ptr;
331
+ Data_Get_Struct(self, struct chart_axis, ptr);
332
+ chart_axis_set_name_range(ptr->axis, str, row, col);
333
+ return self;
334
+ }
335
+
336
+ /* call-seq: axis.set_name_font(options) -> self
337
+ *
338
+ * Same as Chart#set_font, but for axis name.
339
+ */
340
+ VALUE
341
+ chart_axis_set_name_font_(VALUE self, VALUE value) {
342
+ struct chart_axis *ptr;
343
+ lxw_chart_font font = val_to_lxw_chart_font(value);
344
+ Data_Get_Struct(self, struct chart_axis, ptr);
345
+
346
+ chart_axis_set_name_font(ptr->axis, &font);
347
+ return self;
348
+ }
349
+
350
+ /* call-seq: axis.set_num_font(options) -> self
351
+ *
352
+ * Same as Chart#set_font, but for axis numbers.
353
+ */
354
+ VALUE
355
+ chart_axis_set_num_font_(VALUE self, VALUE value) {
356
+ struct chart_axis *ptr;
357
+ lxw_chart_font font = val_to_lxw_chart_font(value);
358
+ Data_Get_Struct(self, struct chart_axis, ptr);
359
+
360
+ chart_axis_set_num_font(ptr->axis, &font);
361
+ return self;
362
+ }
363
+
364
+ /* call-seq: axis.set_line(options)
365
+ *
366
+ * Sets axis line options. See {libxlsxwriter doc}[https://libxlsxwriter.github.io/structlxw__chart__line.html] for details.
367
+ */
368
+ VALUE
369
+ chart_axis_set_line_(VALUE self, VALUE opts) {
370
+ struct chart_axis *ptr;
371
+ lxw_chart_line line = val_to_lxw_chart_line(opts);
372
+
373
+ Data_Get_Struct(self, struct chart_axis, ptr);
374
+
375
+ chart_axis_set_line(ptr->axis, &line);
376
+ return self;
377
+ }
378
+
379
+ /* call-seq: axis.set_fill(options)
380
+ *
381
+ * Sets axis fill options. See {libxlsxwriter doc}[https://libxlsxwriter.github.io/structlxw__chart__fill.html] for details.
382
+ */
383
+ VALUE
384
+ chart_axis_set_fill_(VALUE self, VALUE opts) {
385
+ struct chart_axis *ptr;
386
+ lxw_chart_fill fill = val_to_lxw_chart_fill(opts);
387
+
388
+ Data_Get_Struct(self, struct chart_axis, ptr);
389
+
390
+ chart_axis_set_fill(ptr->axis, &fill);
391
+ return self;
392
+ }
393
+
394
+ /* call-seq:
395
+ * series.set_categories(sheetname, range)
396
+ * series.set_categories(sheetname, cell_from, cell_to)
397
+ * series.set_categories(sheetname, row_from, col_from, row_to, col_to)
398
+ *
399
+ * Sets chart series categories (alternative to first argument of
400
+ * Chart#add_series).
401
+ */
402
+ VALUE
403
+ chart_series_set_categories_(int argc, VALUE *argv, VALUE self) {
404
+ rb_check_arity(argc, 2, 5);
405
+ const char *str = StringValueCStr(argv[0]);
406
+ lxw_row_t row_from, row_to;
407
+ lxw_col_t col_from, col_to;
408
+ extract_range(argc - 1, argv + 1, &row_from, &col_from, &row_to, &col_to);
409
+ struct chart_series *ptr;
410
+ Data_Get_Struct(self, struct chart_series, ptr);
411
+ chart_series_set_categories(ptr->series, str, row_from, col_from, row_to, col_to);
412
+ return self;
413
+ }
414
+
415
+ /* call-seq:
416
+ * series.set_values(sheetname, range)
417
+ * series.set_values(sheetname, cell_from, cell_to)
418
+ * series.set_values(sheetname, row_from, col_from, row_to, col_to)
419
+ *
420
+ * Sets chart series values (alternative to second argument of Chart#add_series).
421
+ */
422
+ VALUE
423
+ chart_series_set_values_(int argc, VALUE *argv, VALUE self) {
424
+ rb_check_arity(argc, 2, 5);
425
+ const char *str = StringValueCStr(argv[0]);
426
+ lxw_row_t row_from, row_to;
427
+ lxw_col_t col_from, col_to;
428
+ extract_range(argc - 1, argv + 1, &row_from, &col_from, &row_to, &col_to);
429
+ struct chart_series *ptr;
430
+ Data_Get_Struct(self, struct chart_series, ptr);
431
+ chart_series_set_values(ptr->series, str, row_from, col_from, row_to, col_to);
432
+ return self;
433
+ }
434
+
435
+ /* call-seq: series.name=(name) -> name
436
+ *
437
+ * Set chart series name.
438
+ */
439
+ VALUE
440
+ chart_series_set_name_(VALUE self, VALUE name) {
441
+ struct chart_series *ptr;
442
+ Data_Get_Struct(self, struct chart_series, ptr);
443
+
444
+ chart_series_set_name(ptr->series, StringValueCStr(name));
445
+ return name;
446
+ }
447
+
448
+ /* call-seq:
449
+ * series.set_name_range(name, cell) -> self
450
+ * series.set_name_range(name, row, col) -> self
451
+ *
452
+ * Sets the chart series name range from +cell+, with value +name+.
453
+ */
454
+ VALUE
455
+ chart_series_set_name_range_(int argc, VALUE *argv, VALUE self) {
456
+ rb_check_arity(argc, 2, 3);
457
+ const char *str = StringValueCStr(argv[0]);
458
+ lxw_row_t row;
459
+ lxw_col_t col;
460
+ extract_cell(argc - 1, argv + 1, &row, &col);
461
+ struct chart_series *ptr;
462
+ Data_Get_Struct(self, struct chart_series, ptr);
463
+ chart_series_set_name_range(ptr->series, str, row, col);
464
+ return self;
465
+ }
466
+
467
+
468
+ #define SET_PROP(prop, vres) { \
469
+ val = rb_hash_aref(opts, ID2SYM(rb_intern(#prop))); \
470
+ if (RTEST(val)) res.prop = vres; \
471
+ }
472
+
473
+ lxw_chart_fill
474
+ val_to_lxw_chart_fill(VALUE opts) {
475
+ lxw_chart_fill res = {}; // All zeros
476
+ VALUE val;
477
+
478
+ SET_PROP(color, NUM2UINT(val));
479
+ SET_PROP(none, 1);
480
+ SET_PROP(transparency, NUM2UINT(val));
481
+
482
+ return res;
483
+ }
484
+
485
+ lxw_chart_font
486
+ val_to_lxw_chart_font(VALUE opts) {
487
+ lxw_chart_font res = {}; // Zero-initialized
488
+ VALUE val;
489
+
490
+ SET_PROP(name, StringValueCStr(val));
491
+ SET_PROP(size, NUM2UINT(val));
492
+ SET_PROP(bold, 1);
493
+ SET_PROP(italic, 1);
494
+ SET_PROP(underline, 1);
495
+ SET_PROP(rotation, NUM2INT(val));
496
+ SET_PROP(color, NUM2ULONG(val));
497
+ SET_PROP(baseline, NUM2INT(val));
498
+
499
+ return res;
500
+ }
501
+
502
+ lxw_chart_line
503
+ val_to_lxw_chart_line(VALUE opts) {
504
+ lxw_chart_line res = {}; // All zeros
505
+ VALUE val;
506
+
507
+ SET_PROP(color, NUM2UINT(val));
508
+ SET_PROP(none, 1);
509
+ SET_PROP(width, NUM2DBL(val));
510
+ SET_PROP(dash_type, NUM2UINT(val));
511
+
512
+ return res;
513
+ }
514
+
515
+ #undef SET_PROP
516
+
517
+
518
+ void init_xlsxwriter_chart() {
519
+ #if 0
520
+ // Making RDoc happy.
521
+ mXlsxWriter = rb_define_module("XlsxWriter");
522
+ cWorkbook = rb_define_class_under(mXlsxWriter, "Workbook", rb_cObject);
523
+ #endif
524
+ /* Workbook chart */
525
+ cChart = rb_define_class_under(cWorkbook, "Chart", rb_cObject);
526
+ /* Chart data series */
527
+ cChartSeries = rb_define_class_under(cChart, "Series", rb_cObject);
528
+ /* Chart axis */
529
+ cChartAxis = rb_define_class_under(cChart, "Axis", rb_cObject);
530
+
531
+
532
+ rb_define_alloc_func(cChart, chart_alloc);
533
+ rb_define_method(cChart, "initialize", chart_init, 2);
534
+ rb_define_method(cChart, "add_series", chart_add_series_, -1);
535
+ rb_define_method(cChart, "x_axis", chart_x_axis_, 0);
536
+ rb_define_method(cChart, "y_axis", chart_y_axis_, 0);
537
+ rb_define_method(cChart, "title=", chart_title_set_name_, 1);
538
+ rb_define_method(cChart, "legend_position=", chart_legend_set_position_, 1);
539
+ rb_define_method(cChart, "legend_set_font", chart_legend_set_font_, 1);
540
+ rb_define_method(cChart, "legend_delete_series", chart_legend_delete_series_, 1);
541
+ rb_define_method(cChart, "style=", chart_set_style_, 1);
542
+ rb_define_method(cChart, "rotation=", chart_set_rotation_, 1);
543
+ rb_define_method(cChart, "hole_size=", chart_set_hole_size_, 1);
544
+
545
+ rb_define_method(cChart, "axis_id_1", chart_get_axis_id_1_, 0);
546
+ rb_define_method(cChart, "axis_id_1=", chart_set_axis_id_1_, 1);
547
+ rb_define_method(cChart, "axis_id_2", chart_get_axis_id_2_, 0);
548
+ rb_define_method(cChart, "axis_id_2=", chart_set_axis_id_2_, 1);
549
+
550
+ rb_define_alloc_func(cChartAxis, chart_axis_alloc);
551
+ rb_define_method(cChartAxis, "initialize", chart_axis_init, 2);
552
+
553
+ rb_define_method(cChartAxis, "name=", chart_axis_set_name_, 1);
554
+ rb_define_method(cChartAxis, "set_name_range", chart_axis_set_name_range_, -1);
555
+ rb_define_method(cChartAxis, "set_name_font", chart_axis_set_name_font_, 1);
556
+ rb_define_method(cChartAxis, "set_num_font", chart_axis_set_num_font_, 1);
557
+ rb_define_method(cChartAxis, "set_line", chart_axis_set_line_, 1);
558
+ rb_define_method(cChartAxis, "set_fill", chart_axis_set_fill_, 1);
559
+
560
+ rb_define_alloc_func(cChartSeries, chart_series_alloc);
561
+ rb_define_method(cChartSeries, "initialize", chart_series_init, -1);
562
+
563
+ rb_define_method(cChartSeries, "set_categories", chart_series_set_categories_, -1);
564
+ rb_define_method(cChartSeries, "set_values", chart_series_set_values_, -1);
565
+ rb_define_method(cChartSeries, "name=", chart_series_set_name_, 1);
566
+ rb_define_method(cChartSeries, "set_name_range", chart_series_set_name_range_, -1);
567
+
568
+ #define MAP_CHART_CONST(name) rb_define_const(cChart, #name, INT2NUM(LXW_CHART_##name))
569
+ MAP_CHART_CONST(NONE);
570
+ MAP_CHART_CONST(AREA);
571
+ MAP_CHART_CONST(AREA_STACKED);
572
+ MAP_CHART_CONST(AREA_STACKED_PERCENT);
573
+ MAP_CHART_CONST(BAR);
574
+ MAP_CHART_CONST(BAR_STACKED);
575
+ MAP_CHART_CONST(BAR_STACKED_PERCENT);
576
+ MAP_CHART_CONST(COLUMN);
577
+ MAP_CHART_CONST(COLUMN_STACKED);
578
+ MAP_CHART_CONST(COLUMN_STACKED_PERCENT);
579
+ MAP_CHART_CONST(DOUGHNUT);
580
+ MAP_CHART_CONST(LINE);
581
+ MAP_CHART_CONST(PIE);
582
+ MAP_CHART_CONST(SCATTER);
583
+ MAP_CHART_CONST(SCATTER_STRAIGHT);
584
+ MAP_CHART_CONST(SCATTER_STRAIGHT_WITH_MARKERS);
585
+ MAP_CHART_CONST(SCATTER_SMOOTH);
586
+ MAP_CHART_CONST(SCATTER_SMOOTH_WITH_MARKERS);
587
+ MAP_CHART_CONST(RADAR);
588
+ MAP_CHART_CONST(RADAR_WITH_MARKERS);
589
+ MAP_CHART_CONST(RADAR_FILLED);
590
+
591
+ MAP_CHART_CONST(LEGEND_NONE);
592
+ MAP_CHART_CONST(LEGEND_RIGHT);
593
+ MAP_CHART_CONST(LEGEND_LEFT);
594
+ MAP_CHART_CONST(LEGEND_TOP);
595
+ MAP_CHART_CONST(LEGEND_BOTTOM);
596
+ MAP_CHART_CONST(LEGEND_OVERLAY_RIGHT);
597
+ MAP_CHART_CONST(LEGEND_OVERLAY_LEFT);
598
+
599
+ #undef MAP_CHART_CONST
600
+ }