writeexcel 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitattributes +1 -1
- data/.gitignore +24 -24
- data/README.rdoc +34 -55
- data/VERSION +1 -1
- data/charts/chartex.rb +316 -316
- data/charts/demo1.rb +46 -46
- data/charts/demo2.rb +65 -65
- data/charts/demo3.rb +117 -117
- data/charts/demo4.rb +119 -119
- data/charts/demo5.rb +48 -48
- data/examples/a_simple.rb +43 -43
- data/examples/autofilter.rb +265 -265
- data/examples/bigfile.rb +30 -30
- data/examples/chart_area.rb +121 -121
- data/examples/chart_bar.rb +120 -120
- data/examples/chart_column.rb +120 -120
- data/examples/chart_line.rb +120 -120
- data/examples/chart_pie.rb +108 -108
- data/examples/chart_scatter.rb +121 -121
- data/examples/chart_stock.rb +148 -148
- data/examples/chess.rb +142 -142
- data/examples/colors.rb +129 -129
- data/examples/comments1.rb +27 -27
- data/examples/comments2.rb +352 -352
- data/examples/copyformat.rb +52 -52
- data/examples/data_validate.rb +279 -279
- data/examples/date_time.rb +87 -87
- data/examples/defined_name.rb +32 -32
- data/examples/demo.rb +124 -124
- data/examples/diag_border.rb +36 -36
- data/examples/formats.rb +490 -490
- data/examples/formula_result.rb +30 -30
- data/examples/header.rb +137 -137
- data/examples/hide_sheet.rb +29 -29
- data/examples/hyperlink.rb +43 -43
- data/examples/images.rb +63 -63
- data/examples/indent.rb +31 -31
- data/examples/merge1.rb +40 -40
- data/examples/merge2.rb +45 -45
- data/examples/merge3.rb +66 -66
- data/examples/merge4.rb +83 -83
- data/examples/merge5.rb +80 -80
- data/examples/merge6.rb +67 -67
- data/examples/outline.rb +255 -255
- data/examples/outline_collapsed.rb +209 -209
- data/examples/panes.rb +113 -113
- data/examples/properties.rb +34 -34
- data/examples/properties_jp.rb +33 -33
- data/examples/protection.rb +47 -47
- data/examples/regions.rb +53 -53
- data/examples/repeat.rb +43 -43
- data/examples/right_to_left.rb +27 -27
- data/examples/row_wrap.rb +53 -53
- data/examples/stats.rb +74 -74
- data/examples/stocks.rb +81 -81
- data/examples/tab_colors.rb +31 -31
- data/examples/utf8.rb +15 -15
- data/examples/write_arrays.rb +83 -83
- data/lib/writeexcel/biffwriter.rb +232 -232
- data/lib/writeexcel/caller_info.rb +12 -12
- data/lib/writeexcel/chart.rb +2190 -2177
- data/lib/writeexcel/charts/area.rb +154 -154
- data/lib/writeexcel/charts/bar.rb +177 -177
- data/lib/writeexcel/charts/column.rb +156 -156
- data/lib/writeexcel/charts/external.rb +66 -66
- data/lib/writeexcel/charts/line.rb +154 -154
- data/lib/writeexcel/charts/pie.rb +169 -169
- data/lib/writeexcel/charts/scatter.rb +192 -192
- data/lib/writeexcel/charts/stock.rb +213 -213
- data/lib/writeexcel/colors.rb +64 -64
- data/lib/writeexcel/compatibility.rb +0 -255
- data/lib/writeexcel/debug_info.rb +37 -33
- data/lib/writeexcel/excelformulaparser.rb +587 -587
- data/lib/writeexcel/format.rb +13 -4
- data/lib/writeexcel/formula.rb +26 -9
- data/lib/writeexcel/helper.rb +68 -64
- data/lib/writeexcel/olewriter.rb +311 -311
- data/lib/writeexcel/properties.rb +242 -240
- data/lib/writeexcel/storage_lite.rb +984 -978
- data/lib/writeexcel/workbook.rb +3210 -3192
- data/lib/writeexcel/worksheet.rb +143 -51
- data/lib/writeexcel/write_file.rb +44 -40
- data/lib/writeexcel.rb +1159 -1159
- data/test/helper.rb +31 -28
- data/test/perl_output/README +31 -31
- data/test/test_00_IEEE_double.rb +13 -13
- data/test/test_01_add_worksheet.rb +10 -10
- data/test/test_02_merge_formats.rb +53 -53
- data/test/test_04_dimensions.rb +392 -392
- data/test/test_05_rows.rb +179 -179
- data/test/test_06_extsst.rb +77 -77
- data/test/test_11_date_time.rb +479 -479
- data/test/test_12_date_only.rb +501 -501
- data/test/test_13_date_seconds.rb +481 -481
- data/test/test_21_escher.rb +637 -637
- data/test/test_22_mso_drawing_group.rb +745 -745
- data/test/test_23_note.rb +73 -73
- data/test/test_24_txo.rb +75 -75
- data/test/test_25_position_object.rb +84 -84
- data/test/test_26_autofilter.rb +314 -314
- data/test/test_27_autofilter.rb +131 -131
- data/test/test_28_autofilter.rb +161 -161
- data/test/test_29_process_jpg.rb +683 -683
- data/test/test_30_validation_dval.rb +77 -77
- data/test/test_31_validation_dv_strings.rb +126 -126
- data/test/test_32_validation_dv_formula.rb +206 -206
- data/test/test_40_property_types.rb +188 -188
- data/test/test_41_properties.rb +235 -235
- data/test/test_42_set_properties.rb +437 -437
- data/test/test_50_name_stored.rb +299 -299
- data/test/test_51_name_print_area.rb +357 -357
- data/test/test_52_name_print_titles.rb +454 -454
- data/test/test_53_autofilter.rb +203 -203
- data/test/test_60_chart_generic.rb +578 -578
- data/test/test_61_chart_subclasses.rb +95 -95
- data/test/test_62_chart_formats.rb +272 -272
- data/test/test_63_chart_area_formats.rb +649 -649
- data/test/test_biff.rb +75 -75
- data/test/test_compatibility.rb +12 -627
- data/test/test_example_match.rb +3144 -3144
- data/test/test_formula.rb +61 -61
- data/test/test_ole.rb +106 -106
- data/test/test_storage_lite.rb +125 -125
- data/test/test_workbook.rb +139 -139
- data/test/test_worksheet.rb +110 -110
- data/utils/add_magic_comment.rb +80 -80
- data/writeexcel.gemspec +4 -6
- data/writeexcel.rdoc +58 -15
- metadata +9 -6
- data/test/test_new_encoding.rb +0 -205
data/lib/writeexcel/chart.rb
CHANGED
@@ -1,2177 +1,2190 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
###############################################################################
|
3
|
-
#
|
4
|
-
# Chart - A writer class for Excel Charts.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# Used in conjunction with WriteExcel
|
8
|
-
#
|
9
|
-
# Copyright 2000-2010, John McNamara, jmcnamara@cpan.org
|
10
|
-
#
|
11
|
-
# original written in Perl by John McNamara
|
12
|
-
# converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
|
13
|
-
#
|
14
|
-
|
15
|
-
require 'writeexcel/worksheet'
|
16
|
-
require 'writeexcel/colors'
|
17
|
-
|
18
|
-
###############################################################################
|
19
|
-
#
|
20
|
-
# Formatting information.
|
21
|
-
#
|
22
|
-
# perltidy with options: -mbl=2 -pt=0 -nola
|
23
|
-
#
|
24
|
-
# Any camel case Hungarian notation style variable names in the BIFF record
|
25
|
-
# writing sub-routines below are for similarity with names used in the Excel
|
26
|
-
# documentation. Otherwise lowercase underscore style names are used.
|
27
|
-
#
|
28
|
-
|
29
|
-
|
30
|
-
###############################################################################
|
31
|
-
#
|
32
|
-
# The chart class hierarchy is as follows. Chart.pm acts as a factory for the
|
33
|
-
# sub-classes.
|
34
|
-
#
|
35
|
-
#
|
36
|
-
# BIFFwriter
|
37
|
-
# ^
|
38
|
-
# |
|
39
|
-
# Writeexcel::Worksheet
|
40
|
-
# ^
|
41
|
-
# |
|
42
|
-
# Writeexcel::Chart
|
43
|
-
# ^
|
44
|
-
# |
|
45
|
-
# Writeexcel::Chart::* (sub-types)
|
46
|
-
#
|
47
|
-
|
48
|
-
#
|
49
|
-
# = Chart
|
50
|
-
# Chart - A writer class for Excel Charts.
|
51
|
-
#
|
52
|
-
module Writeexcel
|
53
|
-
|
54
|
-
class Chart < Worksheet
|
55
|
-
require 'writeexcel/helper'
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
@
|
98
|
-
@
|
99
|
-
@
|
100
|
-
|
101
|
-
|
102
|
-
@
|
103
|
-
@
|
104
|
-
@
|
105
|
-
@
|
106
|
-
@
|
107
|
-
@
|
108
|
-
@
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
#
|
115
|
-
#
|
116
|
-
#
|
117
|
-
#
|
118
|
-
#
|
119
|
-
#
|
120
|
-
#
|
121
|
-
#
|
122
|
-
#
|
123
|
-
#
|
124
|
-
#
|
125
|
-
#
|
126
|
-
# :
|
127
|
-
# :
|
128
|
-
# :
|
129
|
-
#
|
130
|
-
#
|
131
|
-
#
|
132
|
-
#
|
133
|
-
#
|
134
|
-
# :
|
135
|
-
# :
|
136
|
-
# :
|
137
|
-
#
|
138
|
-
#
|
139
|
-
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
#
|
145
|
-
#
|
146
|
-
#
|
147
|
-
#
|
148
|
-
#
|
149
|
-
#
|
150
|
-
#
|
151
|
-
#
|
152
|
-
#
|
153
|
-
#
|
154
|
-
# the
|
155
|
-
#
|
156
|
-
#
|
157
|
-
#
|
158
|
-
#
|
159
|
-
#
|
160
|
-
# :
|
161
|
-
#
|
162
|
-
#
|
163
|
-
#
|
164
|
-
#
|
165
|
-
#
|
166
|
-
#
|
167
|
-
#
|
168
|
-
#
|
169
|
-
#
|
170
|
-
#
|
171
|
-
#
|
172
|
-
#
|
173
|
-
#
|
174
|
-
#
|
175
|
-
#
|
176
|
-
#
|
177
|
-
#
|
178
|
-
#
|
179
|
-
#
|
180
|
-
#
|
181
|
-
#
|
182
|
-
# :
|
183
|
-
#
|
184
|
-
#
|
185
|
-
#
|
186
|
-
#
|
187
|
-
#
|
188
|
-
#
|
189
|
-
#
|
190
|
-
#
|
191
|
-
# :
|
192
|
-
# :
|
193
|
-
#
|
194
|
-
#
|
195
|
-
#
|
196
|
-
#
|
197
|
-
#
|
198
|
-
# :
|
199
|
-
# :
|
200
|
-
#
|
201
|
-
#
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
params[:
|
216
|
-
params[:
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
params[:
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
#
|
229
|
-
#
|
230
|
-
#
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
235
|
-
#
|
236
|
-
#
|
237
|
-
# :
|
238
|
-
#
|
239
|
-
#
|
240
|
-
#
|
241
|
-
#
|
242
|
-
#
|
243
|
-
#
|
244
|
-
#
|
245
|
-
#
|
246
|
-
#
|
247
|
-
#
|
248
|
-
#
|
249
|
-
#
|
250
|
-
#
|
251
|
-
#
|
252
|
-
#
|
253
|
-
#
|
254
|
-
# :
|
255
|
-
#
|
256
|
-
#
|
257
|
-
#
|
258
|
-
#
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
@
|
265
|
-
@
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
#
|
270
|
-
#
|
271
|
-
#
|
272
|
-
#
|
273
|
-
#
|
274
|
-
#
|
275
|
-
#
|
276
|
-
#
|
277
|
-
#
|
278
|
-
# :
|
279
|
-
#
|
280
|
-
#
|
281
|
-
#
|
282
|
-
#
|
283
|
-
#
|
284
|
-
#
|
285
|
-
#
|
286
|
-
#
|
287
|
-
#
|
288
|
-
#
|
289
|
-
#
|
290
|
-
#
|
291
|
-
#
|
292
|
-
#
|
293
|
-
#
|
294
|
-
#
|
295
|
-
# :
|
296
|
-
#
|
297
|
-
#
|
298
|
-
#
|
299
|
-
#
|
300
|
-
#
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
@
|
307
|
-
@
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
#
|
312
|
-
#
|
313
|
-
#
|
314
|
-
#
|
315
|
-
#
|
316
|
-
#
|
317
|
-
#
|
318
|
-
# :
|
319
|
-
#
|
320
|
-
#
|
321
|
-
#
|
322
|
-
#
|
323
|
-
#
|
324
|
-
#
|
325
|
-
#
|
326
|
-
#
|
327
|
-
#
|
328
|
-
#
|
329
|
-
#
|
330
|
-
#
|
331
|
-
#
|
332
|
-
#
|
333
|
-
#
|
334
|
-
#
|
335
|
-
# :
|
336
|
-
#
|
337
|
-
#
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
@
|
345
|
-
@
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
#
|
351
|
-
#
|
352
|
-
#
|
353
|
-
#
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
#
|
365
|
-
#
|
366
|
-
#
|
367
|
-
#
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
area[:
|
388
|
-
area[:
|
389
|
-
area[:
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
area[:
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
#
|
418
|
-
#
|
419
|
-
#
|
420
|
-
#
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
area[:
|
435
|
-
area[:
|
436
|
-
area[:
|
437
|
-
area[:
|
438
|
-
area[:
|
439
|
-
area[:
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
area[:
|
449
|
-
area[:
|
450
|
-
area[:
|
451
|
-
area[:
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
area[:
|
460
|
-
area[:
|
461
|
-
area[:
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
area[:
|
469
|
-
area[:
|
470
|
-
area[:
|
471
|
-
area[:
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
#
|
496
|
-
#
|
497
|
-
#
|
498
|
-
#
|
499
|
-
#
|
500
|
-
#
|
501
|
-
#
|
502
|
-
#
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
#
|
511
|
-
#
|
512
|
-
#
|
513
|
-
#
|
514
|
-
|
515
|
-
|
516
|
-
#
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
store_fbi(*@config[:
|
559
|
-
store_fbi(*@config[:
|
560
|
-
store_fbi(*@config[:
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
#
|
580
|
-
#
|
581
|
-
#
|
582
|
-
# record
|
583
|
-
#
|
584
|
-
#
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
grbit
|
610
|
-
grbit |=
|
611
|
-
grbit |=
|
612
|
-
grbit |=
|
613
|
-
grbit |=
|
614
|
-
grbit |=
|
615
|
-
grbit |=
|
616
|
-
grbit |=
|
617
|
-
grbit |=
|
618
|
-
grbit |=
|
619
|
-
grbit |=
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
#
|
631
|
-
#
|
632
|
-
#
|
633
|
-
#
|
634
|
-
#
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
parser
|
648
|
-
|
649
|
-
|
650
|
-
#
|
651
|
-
#
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
tokens.collect! { |t| t.gsub(/
|
657
|
-
tokens.collect! { |t| t.gsub(/
|
658
|
-
|
659
|
-
|
660
|
-
formula
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
#
|
679
|
-
#
|
680
|
-
#
|
681
|
-
#
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
#
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
#
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
end
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
#
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
#
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
end
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
#
|
1100
|
-
#
|
1101
|
-
#
|
1102
|
-
#
|
1103
|
-
#
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
area
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
#
|
1174
|
-
#
|
1175
|
-
#
|
1176
|
-
#
|
1177
|
-
#
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
#
|
1185
|
-
#
|
1186
|
-
#
|
1187
|
-
#
|
1188
|
-
#
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
#
|
1209
|
-
#
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
#
|
1327
|
-
#
|
1328
|
-
#
|
1329
|
-
#
|
1330
|
-
#
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
#
|
1366
|
-
#
|
1367
|
-
#
|
1368
|
-
#
|
1369
|
-
#
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
end
|
1401
|
-
|
1402
|
-
###############################################################################
|
1403
|
-
#
|
1404
|
-
#
|
1405
|
-
#
|
1406
|
-
# Write the
|
1407
|
-
#
|
1408
|
-
def
|
1409
|
-
record
|
1410
|
-
length
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
#
|
1421
|
-
#
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
#
|
1427
|
-
|
1428
|
-
|
1429
|
-
length
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
#
|
1488
|
-
#
|
1489
|
-
#
|
1490
|
-
#
|
1491
|
-
#
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
#
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
#
|
1560
|
-
#
|
1561
|
-
#
|
1562
|
-
#
|
1563
|
-
#
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
#
|
1574
|
-
#
|
1575
|
-
#
|
1576
|
-
#
|
1577
|
-
#
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
store_simple(record, length)
|
1583
|
-
end
|
1584
|
-
|
1585
|
-
###############################################################################
|
1586
|
-
#
|
1587
|
-
#
|
1588
|
-
#
|
1589
|
-
#
|
1590
|
-
#
|
1591
|
-
def
|
1592
|
-
record
|
1593
|
-
length
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
#
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
#
|
1620
|
-
#
|
1621
|
-
#
|
1622
|
-
#
|
1623
|
-
#
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
#
|
1635
|
-
#
|
1636
|
-
#
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
#
|
1734
|
-
#
|
1735
|
-
#
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
#
|
1748
|
-
#
|
1749
|
-
#
|
1750
|
-
#
|
1751
|
-
#
|
1752
|
-
#
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
#
|
1762
|
-
#
|
1763
|
-
#
|
1764
|
-
#
|
1765
|
-
#
|
1766
|
-
def
|
1767
|
-
record
|
1768
|
-
length
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
#
|
1781
|
-
#
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
#
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
record
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
#
|
1912
|
-
#
|
1913
|
-
#
|
1914
|
-
#
|
1915
|
-
#
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
#
|
1926
|
-
#
|
1927
|
-
#
|
1928
|
-
#
|
1929
|
-
#
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
#
|
1943
|
-
#
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
|
1985
|
-
|
1986
|
-
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
|
2011
|
-
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
2043
|
-
|
2044
|
-
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
2072
|
-
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2076
|
-
:
|
2077
|
-
:
|
2078
|
-
:
|
2079
|
-
|
2080
|
-
|
2081
|
-
|
2082
|
-
|
2083
|
-
|
2084
|
-
:
|
2085
|
-
:
|
2086
|
-
:
|
2087
|
-
:
|
2088
|
-
:
|
2089
|
-
:
|
2090
|
-
:
|
2091
|
-
:
|
2092
|
-
:
|
2093
|
-
:
|
2094
|
-
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2098
|
-
|
2099
|
-
|
2100
|
-
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2106
|
-
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
|
2116
|
-
|
2117
|
-
|
2118
|
-
|
2119
|
-
|
2120
|
-
|
2121
|
-
|
2122
|
-
|
2123
|
-
|
2124
|
-
:
|
2125
|
-
:
|
2126
|
-
:
|
2127
|
-
:
|
2128
|
-
:
|
2129
|
-
:
|
2130
|
-
|
2131
|
-
|
2132
|
-
|
2133
|
-
|
2134
|
-
|
2135
|
-
|
2136
|
-
|
2137
|
-
|
2138
|
-
|
2139
|
-
|
2140
|
-
|
2141
|
-
|
2142
|
-
|
2143
|
-
|
2144
|
-
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2162
|
-
|
2163
|
-
|
2164
|
-
|
2165
|
-
|
2166
|
-
|
2167
|
-
|
2168
|
-
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
:
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
###############################################################################
|
3
|
+
#
|
4
|
+
# Chart - A writer class for Excel Charts.
|
5
|
+
#
|
6
|
+
#
|
7
|
+
# Used in conjunction with WriteExcel
|
8
|
+
#
|
9
|
+
# Copyright 2000-2010, John McNamara, jmcnamara@cpan.org
|
10
|
+
#
|
11
|
+
# original written in Perl by John McNamara
|
12
|
+
# converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
|
13
|
+
#
|
14
|
+
|
15
|
+
require 'writeexcel/worksheet'
|
16
|
+
require 'writeexcel/colors'
|
17
|
+
|
18
|
+
###############################################################################
|
19
|
+
#
|
20
|
+
# Formatting information.
|
21
|
+
#
|
22
|
+
# perltidy with options: -mbl=2 -pt=0 -nola
|
23
|
+
#
|
24
|
+
# Any camel case Hungarian notation style variable names in the BIFF record
|
25
|
+
# writing sub-routines below are for similarity with names used in the Excel
|
26
|
+
# documentation. Otherwise lowercase underscore style names are used.
|
27
|
+
#
|
28
|
+
|
29
|
+
|
30
|
+
###############################################################################
|
31
|
+
#
|
32
|
+
# The chart class hierarchy is as follows. Chart.pm acts as a factory for the
|
33
|
+
# sub-classes.
|
34
|
+
#
|
35
|
+
#
|
36
|
+
# BIFFwriter
|
37
|
+
# ^
|
38
|
+
# |
|
39
|
+
# Writeexcel::Worksheet
|
40
|
+
# ^
|
41
|
+
# |
|
42
|
+
# Writeexcel::Chart
|
43
|
+
# ^
|
44
|
+
# |
|
45
|
+
# Writeexcel::Chart::* (sub-types)
|
46
|
+
#
|
47
|
+
|
48
|
+
#
|
49
|
+
# = Chart
|
50
|
+
# Chart - A writer class for Excel Charts.
|
51
|
+
#
|
52
|
+
module Writeexcel
|
53
|
+
|
54
|
+
class Chart < Worksheet
|
55
|
+
require 'writeexcel/helper'
|
56
|
+
|
57
|
+
NonAscii = /[^!"#\$%&'\(\)\*\+,\-\.\/\:\;<=>\?@0-9A-Za-z_\[\\\]\{\}^` ~\0\n]/
|
58
|
+
|
59
|
+
###############################################################################
|
60
|
+
#
|
61
|
+
# factory()
|
62
|
+
#
|
63
|
+
# Factory method for returning chart objects based on their class type.
|
64
|
+
#
|
65
|
+
def self.factory(type, *args) #:nodoc:
|
66
|
+
klass =
|
67
|
+
case type
|
68
|
+
when 'Chart::Column'
|
69
|
+
Chart::Column
|
70
|
+
when 'Chart::Bar'
|
71
|
+
Chart::Bar
|
72
|
+
when 'Chart::Line'
|
73
|
+
Chart::Line
|
74
|
+
when 'Chart::Area'
|
75
|
+
Chart::Area
|
76
|
+
when 'Chart::Pie'
|
77
|
+
Chart::Pie
|
78
|
+
when 'Chart::Scatter'
|
79
|
+
Chart::Scatter
|
80
|
+
when 'Chart::Stock'
|
81
|
+
Chart::Stock
|
82
|
+
end
|
83
|
+
|
84
|
+
klass.new(*args)
|
85
|
+
end
|
86
|
+
|
87
|
+
###############################################################################
|
88
|
+
#
|
89
|
+
# :call-seq:
|
90
|
+
# new(filename, name, index, encoding, activesheet, firstsheet, external_bin = nil)
|
91
|
+
#
|
92
|
+
# Default constructor for sub-classes.
|
93
|
+
#
|
94
|
+
def initialize(*args) #:nodoc:
|
95
|
+
super
|
96
|
+
|
97
|
+
@sheet_type = 0x0200
|
98
|
+
@orientation = 0x0
|
99
|
+
@series = []
|
100
|
+
@embedded = false
|
101
|
+
|
102
|
+
@external_bin = false
|
103
|
+
@x_axis_formula = nil
|
104
|
+
@x_axis_name = nil
|
105
|
+
@y_axis_formula = nil
|
106
|
+
@y_axis_name = nil
|
107
|
+
@title_name = nil
|
108
|
+
@title_formula = nil
|
109
|
+
@vary_data_color = 0
|
110
|
+
set_default_properties
|
111
|
+
set_default_config_data
|
112
|
+
end
|
113
|
+
|
114
|
+
#
|
115
|
+
# Add a series and it's properties to a chart.
|
116
|
+
#
|
117
|
+
# In an Excel chart a "series" is a collection of information such as values,
|
118
|
+
# x-axis labels and the name that define which data is plotted. These
|
119
|
+
# settings are displayed when you select the Chart -> Source Data... menu
|
120
|
+
# option.
|
121
|
+
#
|
122
|
+
# With a WriteExcel chart object the add_series() method is used to set the
|
123
|
+
# properties for a series:
|
124
|
+
#
|
125
|
+
# chart.add_series(
|
126
|
+
# :categories => '=Sheet1!$A$2:$A$10',
|
127
|
+
# :values => '=Sheet1!$B$2:$B$10',
|
128
|
+
# :name => 'Series name',
|
129
|
+
# :name_formula => '=Sheet1!$B$1'
|
130
|
+
# )
|
131
|
+
#
|
132
|
+
# The properties that can be set are:
|
133
|
+
#
|
134
|
+
# :values (required)
|
135
|
+
# :categories (optional for most chart types)
|
136
|
+
# :name (optional)
|
137
|
+
# :name_formula (optional)
|
138
|
+
#
|
139
|
+
# * :values
|
140
|
+
#
|
141
|
+
# This is the most important property of a series and must be set for
|
142
|
+
# every chart object. It links the chart with the worksheet data that
|
143
|
+
# it displays.
|
144
|
+
#
|
145
|
+
# chart.add_series(:values => '=Sheet1!$B$2:$B$10')
|
146
|
+
#
|
147
|
+
# Note the format that should be used for the formula. It is the same
|
148
|
+
# as is used in Excel. You must also add the worksheet that you are
|
149
|
+
# referring to before you link to it, via the workbook
|
150
|
+
# add_worksheet() method.
|
151
|
+
#
|
152
|
+
# * :categories
|
153
|
+
#
|
154
|
+
# This sets the chart category labels. The category is more or less
|
155
|
+
# the same as the X-axis. In most chart types the categories property
|
156
|
+
# is optional and the chart will just assume a sequential series
|
157
|
+
# from 1 .. n.
|
158
|
+
#
|
159
|
+
# chart.add_series(
|
160
|
+
# :categories => '=Sheet1!$A$2:$A$10',
|
161
|
+
# :values => '=Sheet1!$B$2:$B$10'
|
162
|
+
# )
|
163
|
+
#
|
164
|
+
# * :name
|
165
|
+
#
|
166
|
+
# Set the name for the series. The name is displayed in the chart
|
167
|
+
# legend and in the formula bar. The name property is optional and
|
168
|
+
# if it isn't supplied will default to Series 1 .. n.
|
169
|
+
#
|
170
|
+
# chart.add_series(
|
171
|
+
# ...
|
172
|
+
# :name => 'Series name'
|
173
|
+
# )
|
174
|
+
#
|
175
|
+
# * :name_formula
|
176
|
+
#
|
177
|
+
# Optional, can be used to link the name to a worksheet cell.
|
178
|
+
# See "Chart names and links".
|
179
|
+
#
|
180
|
+
# chart.add_series(
|
181
|
+
# ...
|
182
|
+
# :name => 'Series name',
|
183
|
+
# :name_formula => '=Sheet1!$B$1'
|
184
|
+
# )
|
185
|
+
#
|
186
|
+
# You can add more than one series to a chart. The series numbering and
|
187
|
+
# order in the final chart is the same as the order in which that are added.
|
188
|
+
#
|
189
|
+
# # Add the first series.
|
190
|
+
# chart.add_series(
|
191
|
+
# :categories => '=Sheet1!$A$2:$A$7',
|
192
|
+
# :values => '=Sheet1!$B$2:$B$7',
|
193
|
+
# :name => 'Test data series 1'
|
194
|
+
# )
|
195
|
+
#
|
196
|
+
# # Add another series. Category is the same but values are different.
|
197
|
+
# chart.add_series(
|
198
|
+
# :categories => '=Sheet1!$A$2:$A$7',
|
199
|
+
# :values => '=Sheet1!$C$2:$C$7',
|
200
|
+
# :name => 'Test data series 2'
|
201
|
+
# )
|
202
|
+
#
|
203
|
+
def add_series(params)
|
204
|
+
raise "Must specify 'values' in add_series()" if params[:values].nil?
|
205
|
+
|
206
|
+
# Parse the ranges to validate them and extract salient information.
|
207
|
+
value_data = parse_series_formula(params[:values])
|
208
|
+
category_data = parse_series_formula(params[:categories])
|
209
|
+
name_formula = parse_series_formula(params[:name_formula])
|
210
|
+
|
211
|
+
# Default category count to the same as the value count if not defined.
|
212
|
+
category_data[1] = value_data[1] if category_data.size < 2
|
213
|
+
|
214
|
+
# Add the parsed data to the user supplied data.
|
215
|
+
params[:values] = value_data
|
216
|
+
params[:categories] = category_data
|
217
|
+
params[:name_formula] = name_formula
|
218
|
+
|
219
|
+
# Encode the Series name.
|
220
|
+
name, encoding = encode_utf16(params[:name], params[:name_encoding])
|
221
|
+
|
222
|
+
params[:name] = name
|
223
|
+
params[:name_encoding] = encoding
|
224
|
+
|
225
|
+
@series << params
|
226
|
+
end
|
227
|
+
|
228
|
+
#
|
229
|
+
# Set the properties of the X-axis.
|
230
|
+
#
|
231
|
+
# The set_x_axis() method is used to set properties of the X axis.
|
232
|
+
#
|
233
|
+
# chart.set_x_axis(:name => 'Sample length (m)' )
|
234
|
+
#
|
235
|
+
# The properties that can be set are:
|
236
|
+
#
|
237
|
+
# :name (optional)
|
238
|
+
# :name_formula (optional)
|
239
|
+
#
|
240
|
+
# * :name
|
241
|
+
#
|
242
|
+
# Set the name (title or caption) for the axis. The name is displayed
|
243
|
+
# below the X axis. This property is optional. The default is to have
|
244
|
+
# no axis name.
|
245
|
+
#
|
246
|
+
# chart.set_x_axis( :name => 'Sample length (m)' )
|
247
|
+
#
|
248
|
+
# * :name_formula
|
249
|
+
#
|
250
|
+
# Optional, can be used to link the name to a worksheet cell.
|
251
|
+
# See "Chart names and links".
|
252
|
+
#
|
253
|
+
# chart.set_x_axis(
|
254
|
+
# :name => 'Sample length (m)',
|
255
|
+
# :name_formula => '=Sheet1!$A$1'
|
256
|
+
# )
|
257
|
+
#
|
258
|
+
# Additional axis properties such as range, divisions and ticks will be made
|
259
|
+
# available in later releases.
|
260
|
+
def set_x_axis(params)
|
261
|
+
name, encoding = encode_utf16(params[:name], params[:name_encoding])
|
262
|
+
formula = parse_series_formula(params[:name_formula])
|
263
|
+
|
264
|
+
@x_axis_name = name
|
265
|
+
@x_axis_encoding = encoding
|
266
|
+
@x_axis_formula = formula
|
267
|
+
end
|
268
|
+
|
269
|
+
#
|
270
|
+
# Set the properties of the Y-axis.
|
271
|
+
#
|
272
|
+
# The set_y_axis() method is used to set properties of the Y axis.
|
273
|
+
#
|
274
|
+
# chart.set_y_axis(:name => 'Sample weight (kg)' )
|
275
|
+
#
|
276
|
+
# The properties that can be set are:
|
277
|
+
#
|
278
|
+
# :name (optional)
|
279
|
+
# :name_formula (optional)
|
280
|
+
#
|
281
|
+
# * :name
|
282
|
+
#
|
283
|
+
# Set the name (title or caption) for the axis. The name is displayed
|
284
|
+
# to the left of the Y axis. This property is optional. The default
|
285
|
+
# is to have no axis name.
|
286
|
+
#
|
287
|
+
# chart.set_y_axis(:name => 'Sample weight (kg)' )
|
288
|
+
#
|
289
|
+
# * :name_formula
|
290
|
+
#
|
291
|
+
# Optional, can be used to link the name to a worksheet cell.
|
292
|
+
# See "Chart names and links".
|
293
|
+
#
|
294
|
+
# chart.set_y_axis(
|
295
|
+
# :name => 'Sample weight (kg)',
|
296
|
+
# :name_formula => '=Sheet1!$B$1'
|
297
|
+
# )
|
298
|
+
#
|
299
|
+
# Additional axis properties such as range, divisions and ticks will be made
|
300
|
+
# available in later releases.
|
301
|
+
#
|
302
|
+
def set_y_axis(params)
|
303
|
+
name, encoding = encode_utf16(params[:name], params[:name_encoding])
|
304
|
+
formula = parse_series_formula(params[:name_formula])
|
305
|
+
|
306
|
+
@y_axis_name = name
|
307
|
+
@y_axis_encoding = encoding
|
308
|
+
@y_axis_formula = formula
|
309
|
+
end
|
310
|
+
|
311
|
+
#
|
312
|
+
# The set_title() method is used to set properties of the chart title.
|
313
|
+
#
|
314
|
+
# chart.set_title(:name => 'Year End Results')
|
315
|
+
#
|
316
|
+
# The properties that can be set are:
|
317
|
+
#
|
318
|
+
# :name (optional)
|
319
|
+
# :name_formula (optional)
|
320
|
+
#
|
321
|
+
# * :name
|
322
|
+
#
|
323
|
+
# Set the name (title) for the chart. The name is displayed above the
|
324
|
+
# chart. This property is optional. The default is to have no chart
|
325
|
+
# title.
|
326
|
+
#
|
327
|
+
# chart.set_title(:name => 'Year End Results')
|
328
|
+
#
|
329
|
+
# * :name_formula
|
330
|
+
#
|
331
|
+
# Optional, can be used to link the name to a worksheet cell.
|
332
|
+
# See "Chart names and links".
|
333
|
+
#
|
334
|
+
# chart.set_title(
|
335
|
+
# :name => 'Year End Results',
|
336
|
+
# :name_formula => '=Sheet1!$C$1'
|
337
|
+
# )
|
338
|
+
#
|
339
|
+
def set_title(params)
|
340
|
+
name, encoding = encode_utf16( params[:name], params[:name_encoding])
|
341
|
+
|
342
|
+
formula = parse_series_formula(params[:name_formula])
|
343
|
+
|
344
|
+
@title_name = name
|
345
|
+
@title_encoding = encoding
|
346
|
+
@title_formula = formula
|
347
|
+
end
|
348
|
+
|
349
|
+
###############################################################################
|
350
|
+
#
|
351
|
+
# set_legend()
|
352
|
+
#
|
353
|
+
# Set the properties of the chart legend.
|
354
|
+
#
|
355
|
+
def set_legend(params = {})
|
356
|
+
if params.has_key?(:position)
|
357
|
+
if params[:position].downcase == 'none'
|
358
|
+
legend[:visible] = 0
|
359
|
+
end
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
###############################################################################
|
364
|
+
#
|
365
|
+
# set_plotarea()
|
366
|
+
#
|
367
|
+
# Set the properties of the chart plotarea.
|
368
|
+
#
|
369
|
+
def set_plotarea(params = {})
|
370
|
+
return if params.empty?
|
371
|
+
|
372
|
+
area = @plotarea
|
373
|
+
|
374
|
+
# Set the plotarea visibility.
|
375
|
+
if params.has_key?(:visible)
|
376
|
+
area[:visible] = params[:visible]
|
377
|
+
return if area[:visible] == 0
|
378
|
+
end
|
379
|
+
|
380
|
+
# TODO. could move this out of if statement.
|
381
|
+
area[:bg_color_index] = 0x08
|
382
|
+
|
383
|
+
# Set the chart background colour.
|
384
|
+
if params.has_key?(:color)
|
385
|
+
index, rgb = get_color_indices(params[:color])
|
386
|
+
if !index.nil?
|
387
|
+
area[:fg_color_index] = index
|
388
|
+
area[:fg_color_rgb] = rgb
|
389
|
+
area[:bg_color_index] = 0x08
|
390
|
+
area[:bg_color_rgb] = 0x000000
|
391
|
+
end
|
392
|
+
end
|
393
|
+
|
394
|
+
# Set the border line colour.
|
395
|
+
if params.has_key?(:line_color)
|
396
|
+
index, rgb = get_color_indices(params[:line_color])
|
397
|
+
if !index.nil?
|
398
|
+
area[:line_color_index] = index
|
399
|
+
area[:line_color_rgb] = rgb
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
# Set the border line pattern.
|
404
|
+
if params.has_key?(:line_pattern)
|
405
|
+
pattern = get_line_pattern(params[:line_pattern])
|
406
|
+
area[:line_pattern] = pattern
|
407
|
+
end
|
408
|
+
|
409
|
+
# Set the border line weight.
|
410
|
+
if params.has_key?(:line_weight)
|
411
|
+
weight = get_line_weight(params[:line_weight])
|
412
|
+
area[:line_weight] = weight
|
413
|
+
end
|
414
|
+
end
|
415
|
+
|
416
|
+
###############################################################################
|
417
|
+
#
|
418
|
+
# set_chartarea()
|
419
|
+
#
|
420
|
+
# Set the properties of the chart chartarea.
|
421
|
+
#
|
422
|
+
def set_chartarea(params = {})
|
423
|
+
return if params.empty?
|
424
|
+
|
425
|
+
area = @chartarea
|
426
|
+
|
427
|
+
# Embedded automatic line weight has a different default value.
|
428
|
+
area[:line_weight] = 0xFFFF if @embedded
|
429
|
+
|
430
|
+
# Set the chart background colour.
|
431
|
+
if params.has_key?(:color)
|
432
|
+
index, rgb = get_color_indices(params[:color])
|
433
|
+
if !index.nil?
|
434
|
+
area[:fg_color_index] = index
|
435
|
+
area[:fg_color_rgb] = rgb
|
436
|
+
area[:bg_color_index] = 0x08
|
437
|
+
area[:bg_color_rgb] = 0x000000
|
438
|
+
area[:area_pattern] = 1
|
439
|
+
area[:area_options] = 0x0000 if @embedded
|
440
|
+
area[:visible] = 1
|
441
|
+
end
|
442
|
+
end
|
443
|
+
|
444
|
+
# Set the border line colour.
|
445
|
+
if params.has_key?(:line_color)
|
446
|
+
index, rgb = get_color_indices(params[:line_color])
|
447
|
+
if !index.nil?
|
448
|
+
area[:line_color_index] = index
|
449
|
+
area[:line_color_rgb] = rgb
|
450
|
+
area[:line_pattern] = 0x00
|
451
|
+
area[:line_options] = 0x0000
|
452
|
+
area[:visible] = 1
|
453
|
+
end
|
454
|
+
end
|
455
|
+
|
456
|
+
# Set the border line pattern.
|
457
|
+
if params.has_key?(:line_pattern)
|
458
|
+
pattern = get_line_pattern(params[:line_pattern])
|
459
|
+
area[:line_pattern] = pattern
|
460
|
+
area[:line_options] = 0x0000
|
461
|
+
area[:line_color_index] = 0x4F unless params.has_key?(:line_color)
|
462
|
+
area[:visible] = 1
|
463
|
+
end
|
464
|
+
|
465
|
+
# Set the border line weight.
|
466
|
+
if params.has_key?(:line_weight)
|
467
|
+
weight = get_line_weight(params[:line_weight])
|
468
|
+
area[:line_weight] = weight
|
469
|
+
area[:line_options] = 0x0000
|
470
|
+
area[:line_pattern] = 0x00 unless params.has_key?(:line_pattern)
|
471
|
+
area[:line_color_index] = 0x4F unless params.has_key?(:line_color)
|
472
|
+
area[:visible] = 1
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
476
|
+
|
477
|
+
|
478
|
+
def using_tmpfile=(val) # :nodoc:
|
479
|
+
@using_tmpfile = val
|
480
|
+
end
|
481
|
+
|
482
|
+
def data=(val) # :nodoc:
|
483
|
+
@data = val
|
484
|
+
end
|
485
|
+
|
486
|
+
def embedded # :nodoc:
|
487
|
+
@embedded
|
488
|
+
end
|
489
|
+
|
490
|
+
def embedded=(val) # :nodoc:
|
491
|
+
@embedded = val
|
492
|
+
end
|
493
|
+
|
494
|
+
###############################################################################
|
495
|
+
#
|
496
|
+
# _prepend(), overridden.
|
497
|
+
#
|
498
|
+
# The parent Worksheet class needs to store some data in memory and some in
|
499
|
+
# temporary files for efficiency. The Chart* classes don't need to do this
|
500
|
+
# since they are dealing with smaller amounts of data so we override
|
501
|
+
# _prepend() to turn it into an _append() method. This allows for a more
|
502
|
+
# natural method calling order.
|
503
|
+
#
|
504
|
+
def prepend(*args) # :nodoc:
|
505
|
+
@using_tmpfile = false
|
506
|
+
append(*args)
|
507
|
+
end
|
508
|
+
|
509
|
+
###############################################################################
|
510
|
+
#
|
511
|
+
# _close(), overridden.
|
512
|
+
#
|
513
|
+
# Create and store the Chart data structures.
|
514
|
+
#
|
515
|
+
def close # :nodoc:
|
516
|
+
# Ignore any data that has been written so far since it is probably
|
517
|
+
# from unwanted Worksheet method calls.
|
518
|
+
@data = ''
|
519
|
+
|
520
|
+
# TODO. Check for charts without a series?
|
521
|
+
|
522
|
+
# Store the chart BOF.
|
523
|
+
store_bof(0x0020)
|
524
|
+
|
525
|
+
# Store the page header
|
526
|
+
store_header
|
527
|
+
|
528
|
+
# Store the page footer
|
529
|
+
store_footer
|
530
|
+
|
531
|
+
# Store the page horizontal centering
|
532
|
+
store_hcenter
|
533
|
+
|
534
|
+
# Store the page vertical centering
|
535
|
+
store_vcenter
|
536
|
+
|
537
|
+
# Store the left margin
|
538
|
+
store_margin_left
|
539
|
+
|
540
|
+
# Store the right margin
|
541
|
+
store_margin_right
|
542
|
+
|
543
|
+
# Store the top margin
|
544
|
+
store_margin_top
|
545
|
+
|
546
|
+
# Store the bottom margin
|
547
|
+
store_margin_bottom
|
548
|
+
|
549
|
+
# Store the page setup
|
550
|
+
store_setup
|
551
|
+
|
552
|
+
# Store the sheet password
|
553
|
+
store_password
|
554
|
+
|
555
|
+
# Start of Chart specific records.
|
556
|
+
|
557
|
+
# Store the FBI font records.
|
558
|
+
store_fbi(*@config[:font_numbers])
|
559
|
+
store_fbi(*@config[:font_series])
|
560
|
+
store_fbi(*@config[:font_title])
|
561
|
+
store_fbi(*@config[:font_axes])
|
562
|
+
|
563
|
+
# Ignore UNITS record.
|
564
|
+
|
565
|
+
# Store the Chart sub-stream.
|
566
|
+
store_chart_stream
|
567
|
+
|
568
|
+
# Append the sheet dimensions
|
569
|
+
store_dimensions
|
570
|
+
|
571
|
+
# TODO add SINDEX and NUMBER records.
|
572
|
+
|
573
|
+
store_window2 unless @embedded
|
574
|
+
|
575
|
+
store_eof
|
576
|
+
end
|
577
|
+
|
578
|
+
###############################################################################
|
579
|
+
#
|
580
|
+
# _store_window2(), overridden.
|
581
|
+
#
|
582
|
+
# Write BIFF record Window2. Note, this overrides the parent Worksheet
|
583
|
+
# record because the Chart version of the record is smaller and is used
|
584
|
+
# mainly to indicate if the chart tab is selected or not.
|
585
|
+
#
|
586
|
+
def store_window2 # :nodoc:
|
587
|
+
record = 0x023E # Record identifier
|
588
|
+
length = 0x000A # Number of bytes to follow
|
589
|
+
grbit = 0x0000 # Option flags
|
590
|
+
rwTop = 0x0000 # Top visible row
|
591
|
+
colLeft = 0x0000 # Leftmost visible column
|
592
|
+
rgbHdr = 0x0000 # Row/col heading, grid color
|
593
|
+
|
594
|
+
# The options flags that comprise grbit
|
595
|
+
fDspFmla = 0 # 0 - bit
|
596
|
+
fDspGrid = 0 # 1
|
597
|
+
fDspRwCol = 0 # 2
|
598
|
+
fFrozen = 0 # 3
|
599
|
+
fDspZeros = 0 # 4
|
600
|
+
fDefaultHdr = 0 # 5
|
601
|
+
fArabic = 0 # 6
|
602
|
+
fDspGuts = 0 # 7
|
603
|
+
fFrozenNoSplit = 0 # 0 - bit
|
604
|
+
fSelected = @selected # 1
|
605
|
+
fPaged = 0 # 2
|
606
|
+
fBreakPreview = 0 # 3
|
607
|
+
|
608
|
+
#<<< Perltidy ignore this.
|
609
|
+
grbit = fDspFmla
|
610
|
+
grbit |= fDspGrid << 1
|
611
|
+
grbit |= fDspRwCol << 2
|
612
|
+
grbit |= fFrozen << 3
|
613
|
+
grbit |= fDspZeros << 4
|
614
|
+
grbit |= fDefaultHdr << 5
|
615
|
+
grbit |= fArabic << 6
|
616
|
+
grbit |= fDspGuts << 7
|
617
|
+
grbit |= fFrozenNoSplit << 8
|
618
|
+
grbit |= fSelected << 9
|
619
|
+
grbit |= fPaged << 10
|
620
|
+
grbit |= fBreakPreview << 11
|
621
|
+
#>>>
|
622
|
+
|
623
|
+
header = [record, length].pack("vv")
|
624
|
+
data = [grbit, rwTop, colLeft, rgbHdr].pack("vvvV")
|
625
|
+
|
626
|
+
append(header, data)
|
627
|
+
end
|
628
|
+
|
629
|
+
###############################################################################
|
630
|
+
#
|
631
|
+
# _parse_series_formula()
|
632
|
+
#
|
633
|
+
# Parse the formula used to define a series. We also extract some range
|
634
|
+
# information required for _store_series() and the SERIES record.
|
635
|
+
#
|
636
|
+
def parse_series_formula(formula) # :nodoc:
|
637
|
+
encoding = 0
|
638
|
+
length = 0
|
639
|
+
count = 0
|
640
|
+
tokens = []
|
641
|
+
|
642
|
+
return [''] if formula.nil?
|
643
|
+
|
644
|
+
# Strip the = sign at the beginning of the formula string
|
645
|
+
formula = formula.sub(/^=/, '')
|
646
|
+
|
647
|
+
# Parse the formula using the parser in Formula.pm
|
648
|
+
parser = @parser
|
649
|
+
|
650
|
+
# In order to raise formula errors from the point of view of the calling
|
651
|
+
# program we use an eval block and re-raise the error from here.
|
652
|
+
#
|
653
|
+
tokens = parser.parse_formula(formula)
|
654
|
+
|
655
|
+
# Force ranges to be a reference class.
|
656
|
+
tokens.collect! { |t| t.gsub(/_ref3d/, '_ref3dR') }
|
657
|
+
tokens.collect! { |t| t.gsub(/_range3d/, '_range3dR') }
|
658
|
+
tokens.collect! { |t| t.gsub(/_name/, '_nameR') }
|
659
|
+
|
660
|
+
# Parse the tokens into a formula string.
|
661
|
+
formula = parser.parse_tokens(tokens)
|
662
|
+
|
663
|
+
# Return formula for a single cell as used by title and series name.
|
664
|
+
return formula if formula.ord == 0x3A
|
665
|
+
|
666
|
+
# Extract the range from the parse formula.
|
667
|
+
if formula.ord == 0x3B
|
668
|
+
ptg, ext_ref, row_1, row_2, col_1, col_2 = formula.unpack('Cv5')
|
669
|
+
|
670
|
+
# TODO. Remove high bit on relative references.
|
671
|
+
count = row_2 - row_1 + 1
|
672
|
+
end
|
673
|
+
|
674
|
+
[formula, count]
|
675
|
+
end
|
676
|
+
|
677
|
+
###############################################################################
|
678
|
+
#
|
679
|
+
# _encode_utf16()
|
680
|
+
#
|
681
|
+
# Convert UTF8 strings used in the chart to UTF16.
|
682
|
+
#
|
683
|
+
def encode_utf16(str, encoding = 0) # :nodoc:
|
684
|
+
# Exit if the $string isn't defined, i.e., hasn't been set by user.
|
685
|
+
return [nil, nil] if str.nil?
|
686
|
+
|
687
|
+
string = str.dup
|
688
|
+
# Return if encoding is set, i.e., string has been manually encoded.
|
689
|
+
#return ( undef, undef ) if $string == 1;
|
690
|
+
|
691
|
+
ruby_19 { string = convert_to_ascii_if_ascii(string) }
|
692
|
+
|
693
|
+
# Handle utf8 strings.
|
694
|
+
ruby_18 do
|
695
|
+
if string =~ NonAscii
|
696
|
+
string = utf8_to_16be(string)
|
697
|
+
encoding = 1
|
698
|
+
end
|
699
|
+
end
|
700
|
+
ruby_19 do
|
701
|
+
if string.encoding == Encoding::UTF_8
|
702
|
+
string = utf8_to_16be(string)
|
703
|
+
encoding = 1
|
704
|
+
end
|
705
|
+
end
|
706
|
+
|
707
|
+
# Chart strings are limited to 255 characters.
|
708
|
+
limit = encoding != 0 ? 255 * 2 : 255
|
709
|
+
|
710
|
+
if string.bytesize >= limit
|
711
|
+
# truncate the string and raise a warning.
|
712
|
+
string = string[0, limit]
|
713
|
+
end
|
714
|
+
|
715
|
+
[string, encoding]
|
716
|
+
end
|
717
|
+
|
718
|
+
###############################################################################
|
719
|
+
#
|
720
|
+
# _get_color_indices()
|
721
|
+
#
|
722
|
+
# Convert the user specified colour index or string to an colour index and
|
723
|
+
# RGB colour number.
|
724
|
+
#
|
725
|
+
def get_color_indices(color) # :nodoc:
|
726
|
+
invalid = 0x7FFF # return from Colors#get_color when color is invalid
|
727
|
+
|
728
|
+
index = Colors.new.get_color(color)
|
729
|
+
index = invalid if color.respond_to?(:coerce) && (color < 8 || color > 63)
|
730
|
+
if index == invalid
|
731
|
+
[nil, nil]
|
732
|
+
else
|
733
|
+
[index, get_color_rbg(index)]
|
734
|
+
end
|
735
|
+
end
|
736
|
+
|
737
|
+
###############################################################################
|
738
|
+
#
|
739
|
+
# _get_color_rbg()
|
740
|
+
#
|
741
|
+
# Get the RedGreenBlue number for the colour index from the Workbook palette.
|
742
|
+
#
|
743
|
+
def get_color_rbg(index) # :nodoc:
|
744
|
+
# Adjust colour index from 8-63 (user range) to 0-55 (Excel range).
|
745
|
+
index -= 8
|
746
|
+
|
747
|
+
red_green_blue = @palette[index]
|
748
|
+
red_green_blue.pack('C*').unpack('V')[0]
|
749
|
+
end
|
750
|
+
|
751
|
+
###############################################################################
|
752
|
+
#
|
753
|
+
# _get_line_pattern()
|
754
|
+
#
|
755
|
+
# Get the Excel chart index for line pattern that corresponds to the user
|
756
|
+
# defined value.
|
757
|
+
#
|
758
|
+
def get_line_pattern(value) # :nodoc:
|
759
|
+
value = value.downcase if value.respond_to?(:to_str)
|
760
|
+
default = 0
|
761
|
+
|
762
|
+
patterns = {
|
763
|
+
0 => 5,
|
764
|
+
1 => 0,
|
765
|
+
2 => 1,
|
766
|
+
3 => 2,
|
767
|
+
4 => 3,
|
768
|
+
5 => 4,
|
769
|
+
6 => 7,
|
770
|
+
7 => 6,
|
771
|
+
8 => 8,
|
772
|
+
'solid' => 0,
|
773
|
+
'dash' => 1,
|
774
|
+
'dot' => 2,
|
775
|
+
'dash-dot' => 3,
|
776
|
+
'dash-dot-dot' => 4,
|
777
|
+
'none' => 5,
|
778
|
+
'dark-gray' => 6,
|
779
|
+
'medium-gray' => 7,
|
780
|
+
'light-gray' => 8,
|
781
|
+
}
|
782
|
+
|
783
|
+
if patterns.has_key?(value)
|
784
|
+
patterns[value]
|
785
|
+
else
|
786
|
+
default
|
787
|
+
end
|
788
|
+
end
|
789
|
+
|
790
|
+
###############################################################################
|
791
|
+
#
|
792
|
+
# _get_line_weight()
|
793
|
+
#
|
794
|
+
# Get the Excel chart index for line weight that corresponds to the user
|
795
|
+
# defined value.
|
796
|
+
#
|
797
|
+
def get_line_weight(value) # :nodoc:
|
798
|
+
value = value.downcase if value.respond_to?(:to_str)
|
799
|
+
default = 0
|
800
|
+
|
801
|
+
weights = {
|
802
|
+
1 => -1,
|
803
|
+
2 => 0,
|
804
|
+
3 => 1,
|
805
|
+
4 => 2,
|
806
|
+
'hairline' => -1,
|
807
|
+
'narrow' => 0,
|
808
|
+
'medium' => 1,
|
809
|
+
'wide' => 2,
|
810
|
+
}
|
811
|
+
|
812
|
+
if weights.has_key?(value)
|
813
|
+
weights[value]
|
814
|
+
else
|
815
|
+
default
|
816
|
+
end
|
817
|
+
end
|
818
|
+
|
819
|
+
###############################################################################
|
820
|
+
#
|
821
|
+
# _store_chart_stream()
|
822
|
+
#
|
823
|
+
# Store the CHART record and it's substreams.
|
824
|
+
#
|
825
|
+
def store_chart_stream # :nodoc:
|
826
|
+
store_chart(*@config[:chart])
|
827
|
+
store_begin
|
828
|
+
|
829
|
+
# Store the chart SCL record.
|
830
|
+
store_plotgrowth
|
831
|
+
|
832
|
+
if @chartarea[:visible] != 0
|
833
|
+
store_chartarea_frame_stream
|
834
|
+
end
|
835
|
+
|
836
|
+
# Store SERIES stream for each series.
|
837
|
+
index = 0
|
838
|
+
@series.each do |series|
|
839
|
+
store_series_stream(
|
840
|
+
:index => index,
|
841
|
+
:value_formula => series[:values][0],
|
842
|
+
:value_count => series[:values][1],
|
843
|
+
:category_count => series[:categories][1],
|
844
|
+
:category_formula => series[:categories][0],
|
845
|
+
:name => series[:name],
|
846
|
+
:name_encoding => series[:name_encoding],
|
847
|
+
:name_formula => series[:name_formula]
|
848
|
+
)
|
849
|
+
index += 1
|
850
|
+
end
|
851
|
+
|
852
|
+
store_shtprops
|
853
|
+
|
854
|
+
# Write the TEXT streams.
|
855
|
+
(5..6).each do |font_index|
|
856
|
+
store_defaulttext
|
857
|
+
store_series_text_stream(font_index)
|
858
|
+
end
|
859
|
+
|
860
|
+
store_axesused(1)
|
861
|
+
store_axisparent_stream
|
862
|
+
|
863
|
+
if !@title_name.nil? || !@title_formula.nil?
|
864
|
+
store_title_text_stream
|
865
|
+
end
|
866
|
+
|
867
|
+
store_end
|
868
|
+
end
|
869
|
+
|
870
|
+
def _formula_type_from_param(t, f, params, key) # :nodoc:
|
871
|
+
if params.has_key?(key)
|
872
|
+
v = params[key]
|
873
|
+
(v.nil? || v == [""] || v == '' || v == 0) ? f : t
|
874
|
+
end
|
875
|
+
end
|
876
|
+
private :_formula_type_from_param
|
877
|
+
|
878
|
+
###############################################################################
|
879
|
+
#
|
880
|
+
# _store_series_stream()
|
881
|
+
#
|
882
|
+
# Write the SERIES chart substream.
|
883
|
+
#
|
884
|
+
def store_series_stream(params) # :nodoc:
|
885
|
+
name_type = _formula_type_from_param(2, 1, params, :name_formula)
|
886
|
+
value_type = _formula_type_from_param(2, 0, params, :value_formula)
|
887
|
+
category_type = _formula_type_from_param(2, 0, params, :category_formula)
|
888
|
+
|
889
|
+
store_series(params[:value_count], params[:category_count])
|
890
|
+
|
891
|
+
store_begin
|
892
|
+
|
893
|
+
# Store the Series name AI record.
|
894
|
+
store_ai(0, name_type, params[:name_formula])
|
895
|
+
unless params[:name].nil?
|
896
|
+
store_seriestext(params[:name], params[:name_encoding])
|
897
|
+
end
|
898
|
+
|
899
|
+
store_ai(1, value_type, params[:value_formula])
|
900
|
+
store_ai(2, category_type, params[:category_formula])
|
901
|
+
store_ai(3, 1, '' )
|
902
|
+
|
903
|
+
store_dataformat_stream(params[:index])
|
904
|
+
store_sertocrt
|
905
|
+
store_end
|
906
|
+
end
|
907
|
+
|
908
|
+
###############################################################################
|
909
|
+
#
|
910
|
+
# _store_dataformat_stream()
|
911
|
+
#
|
912
|
+
# Write the DATAFORMAT chart substream.
|
913
|
+
#
|
914
|
+
def store_dataformat_stream(series_index) # :nodoc:
|
915
|
+
store_dataformat(series_index, series_index, 0xFFFF)
|
916
|
+
|
917
|
+
store_begin
|
918
|
+
store_3dbarshape
|
919
|
+
store_end
|
920
|
+
end
|
921
|
+
|
922
|
+
###############################################################################
|
923
|
+
#
|
924
|
+
# _store_series_text_stream()
|
925
|
+
#
|
926
|
+
# Write the series TEXT substream.
|
927
|
+
#
|
928
|
+
def store_series_text_stream(font_index) # :nodoc:
|
929
|
+
store_text(*@config[:series_text])
|
930
|
+
|
931
|
+
store_begin
|
932
|
+
store_pos(*@config[:series_text_pos])
|
933
|
+
store_fontx( font_index )
|
934
|
+
store_ai( 0, 1, '' )
|
935
|
+
store_end
|
936
|
+
end
|
937
|
+
|
938
|
+
def _formula_type(t, f, formula) # :nodoc:
|
939
|
+
(formula.nil? || formula == [""] || formula == '' || formula == 0) ? f : t
|
940
|
+
end
|
941
|
+
private :_formula_type
|
942
|
+
|
943
|
+
###############################################################################
|
944
|
+
#
|
945
|
+
# _store_x_axis_text_stream()
|
946
|
+
#
|
947
|
+
# Write the X-axis TEXT substream.
|
948
|
+
#
|
949
|
+
def store_x_axis_text_stream # :nodoc:
|
950
|
+
formula = @x_axis_formula.nil? ? '' : @x_axis_formula
|
951
|
+
ai_type = _formula_type(2, 1, formula)
|
952
|
+
|
953
|
+
store_text(*@config[:x_axis_text])
|
954
|
+
|
955
|
+
store_begin
|
956
|
+
store_pos(*@config[:x_axis_text_pos])
|
957
|
+
store_fontx(8)
|
958
|
+
store_ai(0, ai_type, formula)
|
959
|
+
|
960
|
+
unless @x_axis_name.nil?
|
961
|
+
store_seriestext(@x_axis_name, @x_axis_encoding)
|
962
|
+
end
|
963
|
+
|
964
|
+
store_objectlink(3)
|
965
|
+
store_end
|
966
|
+
end
|
967
|
+
|
968
|
+
###############################################################################
|
969
|
+
#
|
970
|
+
# _store_y_axis_text_stream()
|
971
|
+
#
|
972
|
+
# Write the Y-axis TEXT substream.
|
973
|
+
#
|
974
|
+
def store_y_axis_text_stream # :nodoc:
|
975
|
+
formula = @y_axis_formula
|
976
|
+
ai_type = _formula_type(2, 1, formula)
|
977
|
+
|
978
|
+
store_text(*@config[:y_axis_text])
|
979
|
+
|
980
|
+
store_begin
|
981
|
+
store_pos(*@config[:y_axis_text_pos])
|
982
|
+
store_fontx(8)
|
983
|
+
store_ai(0, ai_type, formula)
|
984
|
+
|
985
|
+
unless @y_axis_name.nil?
|
986
|
+
store_seriestext(@y_axis_name, @y_axis_encoding)
|
987
|
+
end
|
988
|
+
|
989
|
+
store_objectlink(2)
|
990
|
+
store_end
|
991
|
+
end
|
992
|
+
|
993
|
+
###############################################################################
|
994
|
+
#
|
995
|
+
# _store_legend_text_stream()
|
996
|
+
#
|
997
|
+
# Write the legend TEXT substream.
|
998
|
+
#
|
999
|
+
def store_legend_text_stream # :nodoc:
|
1000
|
+
store_text(*@config[:legend_text])
|
1001
|
+
|
1002
|
+
store_begin
|
1003
|
+
store_pos(*@config[:legend_text_pos])
|
1004
|
+
store_ai(0, 1, '')
|
1005
|
+
|
1006
|
+
store_end
|
1007
|
+
end
|
1008
|
+
|
1009
|
+
###############################################################################
|
1010
|
+
#
|
1011
|
+
# _store_title_text_stream()
|
1012
|
+
#
|
1013
|
+
# Write the title TEXT substream.
|
1014
|
+
#
|
1015
|
+
def store_title_text_stream # :nodoc:
|
1016
|
+
formula = @title_formula
|
1017
|
+
ai_type = _formula_type(2, 1, formula)
|
1018
|
+
|
1019
|
+
store_text(*@config[:title_text])
|
1020
|
+
|
1021
|
+
store_begin
|
1022
|
+
store_pos(*@config[:title_text_pos])
|
1023
|
+
store_fontx(7)
|
1024
|
+
store_ai(0, ai_type, formula)
|
1025
|
+
|
1026
|
+
unless @title_name.nil?
|
1027
|
+
store_seriestext(@title_name, @title_encoding)
|
1028
|
+
end
|
1029
|
+
|
1030
|
+
store_objectlink(1)
|
1031
|
+
store_end
|
1032
|
+
end
|
1033
|
+
|
1034
|
+
###############################################################################
|
1035
|
+
#
|
1036
|
+
# _store_axisparent_stream()
|
1037
|
+
#
|
1038
|
+
# Write the AXISPARENT chart substream.
|
1039
|
+
#
|
1040
|
+
def store_axisparent_stream # :nodoc:
|
1041
|
+
store_axisparent(*@config[:axisparent])
|
1042
|
+
|
1043
|
+
store_begin
|
1044
|
+
store_pos(*@config[:axisparent_pos])
|
1045
|
+
store_axis_category_stream
|
1046
|
+
store_axis_values_stream
|
1047
|
+
|
1048
|
+
if !@x_axis_name.nil? || !@x_axis_formula.nil?
|
1049
|
+
store_x_axis_text_stream
|
1050
|
+
end
|
1051
|
+
|
1052
|
+
if !@y_axis_name.nil? || !@y_axis_formula.nil?
|
1053
|
+
store_y_axis_text_stream();
|
1054
|
+
end
|
1055
|
+
|
1056
|
+
if @plotarea[:visible] != 0
|
1057
|
+
store_plotarea
|
1058
|
+
store_plotarea_frame_stream
|
1059
|
+
end
|
1060
|
+
store_chartformat_stream
|
1061
|
+
store_end
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
###############################################################################
|
1065
|
+
#
|
1066
|
+
# _store_axis_category_stream()
|
1067
|
+
#
|
1068
|
+
# Write the AXIS chart substream for the chart category.
|
1069
|
+
#
|
1070
|
+
def store_axis_category_stream # :nodoc:
|
1071
|
+
store_axis(0)
|
1072
|
+
|
1073
|
+
store_begin
|
1074
|
+
store_catserrange
|
1075
|
+
store_axcext
|
1076
|
+
store_tick
|
1077
|
+
store_end
|
1078
|
+
end
|
1079
|
+
|
1080
|
+
###############################################################################
|
1081
|
+
#
|
1082
|
+
# _store_axis_values_stream()
|
1083
|
+
#
|
1084
|
+
# Write the AXIS chart substream for the chart values.
|
1085
|
+
#
|
1086
|
+
def store_axis_values_stream # :nodoc:
|
1087
|
+
store_axis(1)
|
1088
|
+
|
1089
|
+
store_begin
|
1090
|
+
store_valuerange
|
1091
|
+
store_tick
|
1092
|
+
store_axislineformat
|
1093
|
+
store_lineformat(0x00000000, 0x0000, 0xFFFF, 0x0009, 0x004D)
|
1094
|
+
store_end
|
1095
|
+
end
|
1096
|
+
|
1097
|
+
###############################################################################
|
1098
|
+
#
|
1099
|
+
# _store_plotarea_frame_stream()
|
1100
|
+
#
|
1101
|
+
# Write the FRAME chart substream.
|
1102
|
+
#
|
1103
|
+
def store_plotarea_frame_stream # :nodoc:
|
1104
|
+
store_area_frame_stream_common(:plot)
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
###############################################################################
|
1108
|
+
#
|
1109
|
+
# _store_chartarea_frame_stream()
|
1110
|
+
#
|
1111
|
+
# Write the FRAME chart substream for and embedded chart.
|
1112
|
+
#
|
1113
|
+
def store_chartarea_frame_stream # :nodoc:
|
1114
|
+
store_area_frame_stream_common(:chart)
|
1115
|
+
end
|
1116
|
+
|
1117
|
+
def store_area_frame_stream_common(type)
|
1118
|
+
if type == :plot
|
1119
|
+
area = @plotarea
|
1120
|
+
grbit = 0x03
|
1121
|
+
else
|
1122
|
+
area = @chartarea
|
1123
|
+
grbit = 0x02
|
1124
|
+
end
|
1125
|
+
|
1126
|
+
store_frame(0x00, grbit)
|
1127
|
+
store_begin
|
1128
|
+
|
1129
|
+
store_lineformat(
|
1130
|
+
area[:line_color_rgb], area[:line_pattern],
|
1131
|
+
area[:line_weight], area[:line_options],
|
1132
|
+
area[:line_color_index]
|
1133
|
+
)
|
1134
|
+
|
1135
|
+
store_areaformat(
|
1136
|
+
area[:fg_color_rgb], area[:bg_color_rgb],
|
1137
|
+
area[:area_pattern], area[:area_options],
|
1138
|
+
area[:fg_color_index], area[:bg_color_index]
|
1139
|
+
)
|
1140
|
+
|
1141
|
+
store_end
|
1142
|
+
end
|
1143
|
+
private :store_area_frame_stream_common
|
1144
|
+
|
1145
|
+
###############################################################################
|
1146
|
+
#
|
1147
|
+
# _store_chartformat_stream()
|
1148
|
+
#
|
1149
|
+
# Write the CHARTFORMAT chart substream.
|
1150
|
+
#
|
1151
|
+
def store_chartformat_stream # :nodoc:
|
1152
|
+
# The _vary_data_color is set by classes that need it, like Pie.
|
1153
|
+
store_chartformat(@vary_data_color)
|
1154
|
+
|
1155
|
+
store_begin
|
1156
|
+
|
1157
|
+
# Store the BIFF record that will define the chart type.
|
1158
|
+
store_chart_type
|
1159
|
+
|
1160
|
+
# Note, the CHARTFORMATLINK record is only written by Excel.
|
1161
|
+
|
1162
|
+
if @legend[:visible]
|
1163
|
+
store_legend_stream
|
1164
|
+
end
|
1165
|
+
|
1166
|
+
store_marker_dataformat_stream
|
1167
|
+
store_end
|
1168
|
+
end
|
1169
|
+
|
1170
|
+
###############################################################################
|
1171
|
+
#
|
1172
|
+
# _store_chart_type()
|
1173
|
+
#
|
1174
|
+
# This is an abstract method that is overridden by the sub-classes to define
|
1175
|
+
# the chart types such as Column, Line, Pie, etc.
|
1176
|
+
#
|
1177
|
+
def store_chart_type # :nodoc:
|
1178
|
+
|
1179
|
+
end
|
1180
|
+
|
1181
|
+
###############################################################################
|
1182
|
+
#
|
1183
|
+
# _store_marker_dataformat_stream()
|
1184
|
+
#
|
1185
|
+
# This is an abstract method that is overridden by the sub-classes to define
|
1186
|
+
# properties of markers, linetypes, pie formats and other.
|
1187
|
+
#
|
1188
|
+
def store_marker_dataformat_stream # :nodoc:
|
1189
|
+
|
1190
|
+
end
|
1191
|
+
|
1192
|
+
###############################################################################
|
1193
|
+
#
|
1194
|
+
# _store_legend_stream()
|
1195
|
+
#
|
1196
|
+
# Write the LEGEND chart substream.
|
1197
|
+
#
|
1198
|
+
def store_legend_stream # :nodoc:
|
1199
|
+
store_legend(*@config[:legend])
|
1200
|
+
|
1201
|
+
store_begin
|
1202
|
+
store_pos(*@config[:legend_pos])
|
1203
|
+
store_legend_text_stream
|
1204
|
+
store_end
|
1205
|
+
end
|
1206
|
+
|
1207
|
+
###############################################################################
|
1208
|
+
#
|
1209
|
+
# BIFF Records.
|
1210
|
+
#
|
1211
|
+
###############################################################################
|
1212
|
+
|
1213
|
+
###############################################################################
|
1214
|
+
#
|
1215
|
+
# _store_3dbarshape()
|
1216
|
+
#
|
1217
|
+
# Write the 3DBARSHAPE chart BIFF record.
|
1218
|
+
#
|
1219
|
+
def store_3dbarshape # :nodoc:
|
1220
|
+
record = 0x105F # Record identifier.
|
1221
|
+
length = 0x0002 # Number of bytes to follow.
|
1222
|
+
riser = 0x00 # Shape of base.
|
1223
|
+
taper = 0x00 # Column taper type.
|
1224
|
+
|
1225
|
+
header = [record, length].pack('vv')
|
1226
|
+
data = [riser].pack('C')
|
1227
|
+
data += [taper].pack('C')
|
1228
|
+
|
1229
|
+
append(header, data)
|
1230
|
+
end
|
1231
|
+
|
1232
|
+
###############################################################################
|
1233
|
+
#
|
1234
|
+
# _store_ai()
|
1235
|
+
#
|
1236
|
+
# Write the AI chart BIFF record.
|
1237
|
+
#
|
1238
|
+
def store_ai(id, type, formula, format_index = 0) # :nodoc:
|
1239
|
+
formula = '' if formula == [""]
|
1240
|
+
|
1241
|
+
record = 0x1051 # Record identifier.
|
1242
|
+
length = 0x0008 # Number of bytes to follow.
|
1243
|
+
# id # Link index.
|
1244
|
+
# type # Reference type.
|
1245
|
+
# formula # Pre-parsed formula.
|
1246
|
+
# format_index # Num format index.
|
1247
|
+
grbit = 0x0000 # Option flags.
|
1248
|
+
|
1249
|
+
ruby_19 { formula = convert_to_ascii_if_ascii(formula) }
|
1250
|
+
|
1251
|
+
formula_length = formula.bytesize
|
1252
|
+
length += formula_length
|
1253
|
+
|
1254
|
+
header = [record, length].pack('vv')
|
1255
|
+
data = [id].pack('C')
|
1256
|
+
data += [type].pack('C')
|
1257
|
+
data += [grbit].pack('v')
|
1258
|
+
data += [format_index].pack('v')
|
1259
|
+
data += [formula_length].pack('v')
|
1260
|
+
if formula.respond_to?(:to_array)
|
1261
|
+
data +=
|
1262
|
+
ruby_18 { formula[0] } ||
|
1263
|
+
ruby_19 { formula[0].encode('BINARY') }
|
1264
|
+
else
|
1265
|
+
data +=
|
1266
|
+
ruby_18 { formula unless formula.nil? } ||
|
1267
|
+
ruby_19 { formula.encode('BINARY') unless formula.nil? }
|
1268
|
+
end
|
1269
|
+
|
1270
|
+
append(header, data)
|
1271
|
+
end
|
1272
|
+
|
1273
|
+
###############################################################################
|
1274
|
+
#
|
1275
|
+
# _store_areaformat()
|
1276
|
+
#
|
1277
|
+
# Write the AREAFORMAT chart BIFF record. Contains the patterns and colours
|
1278
|
+
# of a chart area.
|
1279
|
+
#
|
1280
|
+
def store_areaformat(rgbFore, rgbBack, pattern, grbit, indexFore, indexBack) # :nodoc:
|
1281
|
+
record = 0x100A # Record identifier.
|
1282
|
+
length = 0x0010 # Number of bytes to follow.
|
1283
|
+
# rgbFore # Foreground RGB colour.
|
1284
|
+
# rgbBack # Background RGB colour.
|
1285
|
+
# pattern # Pattern.
|
1286
|
+
# grbit # Option flags.
|
1287
|
+
# indexFore # Index to Foreground colour.
|
1288
|
+
# indexBack # Index to Background colour.
|
1289
|
+
|
1290
|
+
header = [record, length].pack('vv')
|
1291
|
+
data = [rgbFore].pack('V')
|
1292
|
+
data += [rgbBack].pack('V')
|
1293
|
+
data += [pattern].pack('v')
|
1294
|
+
data += [grbit].pack('v')
|
1295
|
+
data += [indexFore].pack('v')
|
1296
|
+
data += [indexBack].pack('v')
|
1297
|
+
|
1298
|
+
append(header, data)
|
1299
|
+
end
|
1300
|
+
|
1301
|
+
###############################################################################
|
1302
|
+
#
|
1303
|
+
# _store_axcext()
|
1304
|
+
#
|
1305
|
+
# Write the AXCEXT chart BIFF record.
|
1306
|
+
#
|
1307
|
+
def store_axcext # :nodoc:
|
1308
|
+
record = 0x1062 # Record identifier.
|
1309
|
+
length = 0x0012 # Number of bytes to follow.
|
1310
|
+
catMin = 0x0000 # Minimum category on axis.
|
1311
|
+
catMax = 0x0000 # Maximum category on axis.
|
1312
|
+
catMajor = 0x0001 # Value of major unit.
|
1313
|
+
unitMajor = 0x0000 # Units of major unit.
|
1314
|
+
catMinor = 0x0001 # Value of minor unit.
|
1315
|
+
unitMinor = 0x0000 # Units of minor unit.
|
1316
|
+
unitBase = 0x0000 # Base unit of axis.
|
1317
|
+
catCrossDate = 0x0000 # Crossing point.
|
1318
|
+
grbit = 0x00EF # Option flags.
|
1319
|
+
|
1320
|
+
store_simple(record, length, catMin, catMax, catMajor, unitMajor,
|
1321
|
+
catMinor, unitMinor, unitBase, catCrossDate, grbit)
|
1322
|
+
end
|
1323
|
+
|
1324
|
+
###############################################################################
|
1325
|
+
#
|
1326
|
+
# _store_axesused()
|
1327
|
+
#
|
1328
|
+
# Write the AXESUSED chart BIFF record.
|
1329
|
+
#
|
1330
|
+
def store_axesused(num_axes) # :nodoc:
|
1331
|
+
record = 0x1046 # Record identifier.
|
1332
|
+
length = 0x0002 # Number of bytes to follow.
|
1333
|
+
# num_axes # Number of axes used.
|
1334
|
+
|
1335
|
+
store_simple(record, length, num_axes)
|
1336
|
+
end
|
1337
|
+
|
1338
|
+
###############################################################################
|
1339
|
+
#
|
1340
|
+
# _store_axis()
|
1341
|
+
#
|
1342
|
+
# Write the AXIS chart BIFF record to define the axis type.
|
1343
|
+
#
|
1344
|
+
def store_axis(type) # :nodoc:
|
1345
|
+
record = 0x101D # Record identifier.
|
1346
|
+
length = 0x0012 # Number of bytes to follow.
|
1347
|
+
# type # Axis type.
|
1348
|
+
reserved1 = 0x00000000 # Reserved.
|
1349
|
+
reserved2 = 0x00000000 # Reserved.
|
1350
|
+
reserved3 = 0x00000000 # Reserved.
|
1351
|
+
reserved4 = 0x00000000 # Reserved.
|
1352
|
+
|
1353
|
+
header = [record, length].pack('vv')
|
1354
|
+
data = [type].pack('v')
|
1355
|
+
data += [reserved1].pack('V')
|
1356
|
+
data += [reserved2].pack('V')
|
1357
|
+
data += [reserved3].pack('V')
|
1358
|
+
data += [reserved4].pack('V')
|
1359
|
+
|
1360
|
+
append(header, data)
|
1361
|
+
end
|
1362
|
+
|
1363
|
+
###############################################################################
|
1364
|
+
#
|
1365
|
+
# _store_axislineformat()
|
1366
|
+
#
|
1367
|
+
# Write the AXISLINEFORMAT chart BIFF record.
|
1368
|
+
#
|
1369
|
+
def store_axislineformat # :nodoc:
|
1370
|
+
record = 0x1021 # Record identifier.
|
1371
|
+
length = 0x0002 # Number of bytes to follow.
|
1372
|
+
line_format = 0x0001 # Axis line format.
|
1373
|
+
|
1374
|
+
store_simple(record, length, line_format)
|
1375
|
+
end
|
1376
|
+
|
1377
|
+
###############################################################################
|
1378
|
+
#
|
1379
|
+
# _store_axisparent()
|
1380
|
+
#
|
1381
|
+
# Write the AXISPARENT chart BIFF record.
|
1382
|
+
#
|
1383
|
+
def store_axisparent(iax, x, y, dx, dy) # :nodoc:
|
1384
|
+
record = 0x1041 # Record identifier.
|
1385
|
+
length = 0x0012 # Number of bytes to follow.
|
1386
|
+
# iax # Axis index.
|
1387
|
+
# x # X-coord.
|
1388
|
+
# y # Y-coord.
|
1389
|
+
# dx # Length of x axis.
|
1390
|
+
# dy # Length of y axis.
|
1391
|
+
|
1392
|
+
header = [record, length].pack('vv')
|
1393
|
+
data = [iax].pack('v')
|
1394
|
+
data += [x].pack('V')
|
1395
|
+
data += [y].pack('V')
|
1396
|
+
data += [dx].pack('V')
|
1397
|
+
data += [dy].pack('V')
|
1398
|
+
|
1399
|
+
append(header, data)
|
1400
|
+
end
|
1401
|
+
|
1402
|
+
###############################################################################
|
1403
|
+
#
|
1404
|
+
# _store_begin()
|
1405
|
+
#
|
1406
|
+
# Write the BEGIN chart BIFF record to indicate the start of a sub stream.
|
1407
|
+
#
|
1408
|
+
def store_begin # :nodoc:
|
1409
|
+
record = 0x1033 # Record identifier.
|
1410
|
+
length = 0x0000 # Number of bytes to follow.
|
1411
|
+
|
1412
|
+
store_simple(record, length)
|
1413
|
+
end
|
1414
|
+
|
1415
|
+
###############################################################################
|
1416
|
+
#
|
1417
|
+
# _store_catserrange()
|
1418
|
+
#
|
1419
|
+
# Write the CATSERRANGE chart BIFF record.
|
1420
|
+
#
|
1421
|
+
def store_catserrange # :nodoc:
|
1422
|
+
record = 0x1020 # Record identifier.
|
1423
|
+
length = 0x0008 # Number of bytes to follow.
|
1424
|
+
catCross = 0x0001 # Value/category crossing.
|
1425
|
+
catLabel = 0x0001 # Frequency of labels.
|
1426
|
+
catMark = 0x0001 # Frequency of ticks.
|
1427
|
+
grbit = 0x0001 # Option flags.
|
1428
|
+
|
1429
|
+
store_simple(record, length, catCross, catLabel, catMark, grbit)
|
1430
|
+
end
|
1431
|
+
|
1432
|
+
###############################################################################
|
1433
|
+
#
|
1434
|
+
# _store_chart()
|
1435
|
+
#
|
1436
|
+
# Write the CHART BIFF record. This indicates the start of the chart sub-stream
|
1437
|
+
# and contains dimensions of the chart on the display. Units are in 1/72 inch
|
1438
|
+
# and are 2 byte integer with 2 byte fraction.
|
1439
|
+
#
|
1440
|
+
def store_chart(x_pos, y_pos, dx, dy) # :nodoc:
|
1441
|
+
record = 0x1002 # Record identifier.
|
1442
|
+
length = 0x0010 # Number of bytes to follow.
|
1443
|
+
# x_pos # X pos of top left corner.
|
1444
|
+
# y_pos # Y pos of top left corner.
|
1445
|
+
# dx # X size.
|
1446
|
+
# dy # Y size.
|
1447
|
+
|
1448
|
+
header = [record, length].pack('vv')
|
1449
|
+
data = [x_pos].pack('V')
|
1450
|
+
data += [y_pos].pack('V')
|
1451
|
+
data += [dx].pack('V')
|
1452
|
+
data += [dy].pack('V')
|
1453
|
+
|
1454
|
+
append(header, data)
|
1455
|
+
end
|
1456
|
+
|
1457
|
+
###############################################################################
|
1458
|
+
#
|
1459
|
+
# _store_chartformat()
|
1460
|
+
#
|
1461
|
+
# Write the CHARTFORMAT chart BIFF record. The parent record for formatting
|
1462
|
+
# of a chart group.
|
1463
|
+
#
|
1464
|
+
def store_chartformat(grbit = 0) # :nodoc:
|
1465
|
+
record = 0x1014 # Record identifier.
|
1466
|
+
length = 0x0014 # Number of bytes to follow.
|
1467
|
+
reserved1 = 0x00000000 # Reserved.
|
1468
|
+
reserved2 = 0x00000000 # Reserved.
|
1469
|
+
reserved3 = 0x00000000 # Reserved.
|
1470
|
+
reserved4 = 0x00000000 # Reserved.
|
1471
|
+
# grbit # Option flags.
|
1472
|
+
icrt = 0x0000 # Drawing order.
|
1473
|
+
|
1474
|
+
header = [record, length].pack('vv')
|
1475
|
+
data = [reserved1].pack('V')
|
1476
|
+
data += [reserved2].pack('V')
|
1477
|
+
data += [reserved3].pack('V')
|
1478
|
+
data += [reserved4].pack('V')
|
1479
|
+
data += [grbit].pack('v')
|
1480
|
+
data += [icrt].pack('v')
|
1481
|
+
|
1482
|
+
append(header, data)
|
1483
|
+
end
|
1484
|
+
|
1485
|
+
###############################################################################
|
1486
|
+
#
|
1487
|
+
# _store_chartline()
|
1488
|
+
#
|
1489
|
+
# Write the CHARTLINE chart BIFF record.
|
1490
|
+
#
|
1491
|
+
def store_chartline # :nodoc:
|
1492
|
+
record = 0x101C # Record identifier.
|
1493
|
+
length = 0x0002 # Number of bytes to follow.
|
1494
|
+
type = 0x0001 # Drop/hi-lo line type.
|
1495
|
+
|
1496
|
+
store_simple(record, length, type)
|
1497
|
+
end
|
1498
|
+
|
1499
|
+
###############################################################################
|
1500
|
+
#
|
1501
|
+
# _store_charttext()
|
1502
|
+
#
|
1503
|
+
# Write the TEXT chart BIFF record.
|
1504
|
+
#
|
1505
|
+
def store_charttext # :nodoc:
|
1506
|
+
record = 0x1025 # Record identifier.
|
1507
|
+
length = 0x0020 # Number of bytes to follow.
|
1508
|
+
horz_align = 0x02 # Horizontal alignment.
|
1509
|
+
vert_align = 0x02 # Vertical alignment.
|
1510
|
+
bg_mode = 0x0001 # Background display.
|
1511
|
+
text_color_rgb = 0x00000000 # Text RGB colour.
|
1512
|
+
text_x = 0xFFFFFF46 # Text x-pos.
|
1513
|
+
text_y = 0xFFFFFF06 # Text y-pos.
|
1514
|
+
text_dx = 0x00000000 # Width.
|
1515
|
+
text_dy = 0x00000000 # Height.
|
1516
|
+
grbit1 = 0x00B1 # Options
|
1517
|
+
text_color_index = 0x004D # Auto Colour.
|
1518
|
+
grbit2 = 0x0000 # Data label placement.
|
1519
|
+
rotation = 0x0000 # Text rotation.
|
1520
|
+
|
1521
|
+
header = [record, length].pack('vv')
|
1522
|
+
data = [horz_align].pack('C')
|
1523
|
+
data += [vert_align].pack('C')
|
1524
|
+
data += [bg_mode].pack('v')
|
1525
|
+
data += [text_color_rgb].pack('V')
|
1526
|
+
data += [text_x].pack('V')
|
1527
|
+
data += [text_y].pack('V')
|
1528
|
+
data += [text_dx].pack('V')
|
1529
|
+
data += [text_dy].pack('V')
|
1530
|
+
data += [grbit1].pack('v')
|
1531
|
+
data += [text_color_index].pack('v')
|
1532
|
+
data += [grbit2].pack('v')
|
1533
|
+
data += [rotation].pack('v')
|
1534
|
+
|
1535
|
+
append(header, data)
|
1536
|
+
end
|
1537
|
+
|
1538
|
+
###############################################################################
|
1539
|
+
#
|
1540
|
+
# _store_dataformat()
|
1541
|
+
#
|
1542
|
+
# Write the DATAFORMAT chart BIFF record. This record specifies the series
|
1543
|
+
# that the subsequent sub stream refers to.
|
1544
|
+
#
|
1545
|
+
def store_dataformat(series_index, series_number, point_number) # :nodoc:
|
1546
|
+
record = 0x1006 # Record identifier.
|
1547
|
+
length = 0x0008 # Number of bytes to follow.
|
1548
|
+
# series_index # Series index.
|
1549
|
+
# series_number # Series number. (Same as index).
|
1550
|
+
# point_number # Point number.
|
1551
|
+
grbit = 0x0000 # Format flags.
|
1552
|
+
|
1553
|
+
store_simple(record, length, point_number, series_index, series_number, grbit)
|
1554
|
+
end
|
1555
|
+
|
1556
|
+
###############################################################################
|
1557
|
+
#
|
1558
|
+
# _store_defaulttext()
|
1559
|
+
#
|
1560
|
+
# Write the DEFAULTTEXT chart BIFF record. Identifier for subsequent TEXT
|
1561
|
+
# record.
|
1562
|
+
#
|
1563
|
+
def store_defaulttext # :nodoc:
|
1564
|
+
record = 0x1024 # Record identifier.
|
1565
|
+
length = 0x0002 # Number of bytes to follow.
|
1566
|
+
type = 0x0002 # Type.
|
1567
|
+
|
1568
|
+
store_simple(record, length, type)
|
1569
|
+
end
|
1570
|
+
|
1571
|
+
###############################################################################
|
1572
|
+
#
|
1573
|
+
# _store_dropbar()
|
1574
|
+
#
|
1575
|
+
# Write the DROPBAR chart BIFF record.
|
1576
|
+
#
|
1577
|
+
def store_dropbar # :nodoc:
|
1578
|
+
record = 0x103D # Record identifier.
|
1579
|
+
length = 0x0002 # Number of bytes to follow.
|
1580
|
+
percent_gap = 0x0096 # Drop bar width gap (%).
|
1581
|
+
|
1582
|
+
store_simple(record, length, percent_gap)
|
1583
|
+
end
|
1584
|
+
|
1585
|
+
###############################################################################
|
1586
|
+
#
|
1587
|
+
# _store_end()
|
1588
|
+
#
|
1589
|
+
# Write the END chart BIFF record to indicate the end of a sub stream.
|
1590
|
+
#
|
1591
|
+
def store_end # :nodoc:
|
1592
|
+
record = 0x1034 # Record identifier.
|
1593
|
+
length = 0x0000 # Number of bytes to follow.
|
1594
|
+
|
1595
|
+
store_simple(record, length)
|
1596
|
+
end
|
1597
|
+
|
1598
|
+
###############################################################################
|
1599
|
+
# _store_fbi()
|
1600
|
+
#
|
1601
|
+
# Write the FBI chart BIFF record. Specifies the font information at the time
|
1602
|
+
# it was applied to the chart.
|
1603
|
+
#
|
1604
|
+
def store_fbi(index, height, width_basis, height_basis, scale_basis) # :nodoc:
|
1605
|
+
record = 0x1060 # Record identifier.
|
1606
|
+
length = 0x000A # Number of bytes to follow.
|
1607
|
+
# index # Font index.
|
1608
|
+
height = height * 20 # Default font height in twips.
|
1609
|
+
# width_basis # Width basis, in twips.
|
1610
|
+
# height_basis # Height basis, in twips.
|
1611
|
+
# scale_basis # Scale by chart area or plot area.
|
1612
|
+
|
1613
|
+
store_simple(record, length, width_basis, height_basis, height, scale_basis, index)
|
1614
|
+
end
|
1615
|
+
|
1616
|
+
###############################################################################
|
1617
|
+
#
|
1618
|
+
# _store_fontx()
|
1619
|
+
#
|
1620
|
+
# Write the FONTX chart BIFF record which contains the index of the FONT
|
1621
|
+
# record in the Workbook.
|
1622
|
+
#
|
1623
|
+
def store_fontx(index) # :nodoc:
|
1624
|
+
record = 0x1026 # Record identifier.
|
1625
|
+
length = 0x0002 # Number of bytes to follow.
|
1626
|
+
# index # Font index.
|
1627
|
+
|
1628
|
+
store_simple(record, length, index)
|
1629
|
+
end
|
1630
|
+
|
1631
|
+
###############################################################################
|
1632
|
+
#
|
1633
|
+
# _store_frame()
|
1634
|
+
#
|
1635
|
+
# Write the FRAME chart BIFF record.
|
1636
|
+
#
|
1637
|
+
def store_frame(frame_type, grbit) # :nodoc:
|
1638
|
+
record = 0x1032 # Record identifier.
|
1639
|
+
length = 0x0004 # Number of bytes to follow.
|
1640
|
+
# frame_type # Frame type.
|
1641
|
+
# grbit # Option flags.
|
1642
|
+
|
1643
|
+
store_simple(record, length, frame_type, grbit)
|
1644
|
+
end
|
1645
|
+
|
1646
|
+
###############################################################################
|
1647
|
+
#
|
1648
|
+
# _store_legend()
|
1649
|
+
#
|
1650
|
+
# Write the LEGEND chart BIFF record. The Marcus Horan method.
|
1651
|
+
#
|
1652
|
+
def store_legend(x, y, width, height, wType, wSpacing, grbit) # :nodoc:
|
1653
|
+
record = 0x1015 # Record identifier.
|
1654
|
+
length = 0x0014 # Number of bytes to follow.
|
1655
|
+
# x # X-position.
|
1656
|
+
# y # Y-position.
|
1657
|
+
# width # Width.
|
1658
|
+
# height # Height.
|
1659
|
+
# wType # Type.
|
1660
|
+
# wSpacing # Spacing.
|
1661
|
+
# grbit # Option flags.
|
1662
|
+
|
1663
|
+
header = [record, length].pack('vv')
|
1664
|
+
data = [x].pack('V')
|
1665
|
+
data += [y].pack('V')
|
1666
|
+
data += [width].pack('V')
|
1667
|
+
data += [height].pack('V')
|
1668
|
+
data += [wType].pack('C')
|
1669
|
+
data += [wSpacing].pack('C')
|
1670
|
+
data += [grbit].pack('v')
|
1671
|
+
|
1672
|
+
append(header, data)
|
1673
|
+
end
|
1674
|
+
|
1675
|
+
###############################################################################
|
1676
|
+
#
|
1677
|
+
# _store_lineformat()
|
1678
|
+
#
|
1679
|
+
# Write the LINEFORMAT chart BIFF record.
|
1680
|
+
#
|
1681
|
+
def store_lineformat(rgb, lns, we, grbit, index) # :nodoc:
|
1682
|
+
record = 0x1007 # Record identifier.
|
1683
|
+
length = 0x000C # Number of bytes to follow.
|
1684
|
+
# rgb # Line RGB colour.
|
1685
|
+
# lns # Line pattern.
|
1686
|
+
# we # Line weight.
|
1687
|
+
# grbit # Option flags.
|
1688
|
+
# index # Index to colour of line.
|
1689
|
+
|
1690
|
+
header = [record, length].pack('vv')
|
1691
|
+
data = [rgb].pack('V')
|
1692
|
+
data += [lns].pack('v')
|
1693
|
+
data += [we].pack('v')
|
1694
|
+
data += [grbit].pack('v')
|
1695
|
+
data += [index].pack('v')
|
1696
|
+
|
1697
|
+
append(header, data)
|
1698
|
+
end
|
1699
|
+
|
1700
|
+
###############################################################################
|
1701
|
+
#
|
1702
|
+
# _store_markerformat()
|
1703
|
+
#
|
1704
|
+
# Write the MARKERFORMAT chart BIFF record.
|
1705
|
+
#
|
1706
|
+
def store_markerformat(rgbFore, rgbBack, marker, grbit, icvFore, icvBack, miSize)# :nodoc:
|
1707
|
+
record = 0x1009 # Record identifier.
|
1708
|
+
length = 0x0014 # Number of bytes to follow.
|
1709
|
+
# rgbFore # Foreground RGB color.
|
1710
|
+
# rgbBack # Background RGB color.
|
1711
|
+
# marker # Type of marker.
|
1712
|
+
# grbit # Format flags.
|
1713
|
+
# icvFore # Color index marker border.
|
1714
|
+
# icvBack # Color index marker fill.
|
1715
|
+
# miSize # Size of line markers.
|
1716
|
+
|
1717
|
+
header = [record, length].pack('vv')
|
1718
|
+
data = [rgbFore].pack('V')
|
1719
|
+
data += [rgbBack].pack('V')
|
1720
|
+
data += [marker].pack('v')
|
1721
|
+
data += [grbit].pack('v')
|
1722
|
+
data += [icvFore].pack('v')
|
1723
|
+
data += [icvBack].pack('v')
|
1724
|
+
data += [miSize].pack('V')
|
1725
|
+
|
1726
|
+
append(header, data)
|
1727
|
+
end
|
1728
|
+
|
1729
|
+
###############################################################################
|
1730
|
+
#
|
1731
|
+
# _store_objectlink()
|
1732
|
+
#
|
1733
|
+
# Write the OBJECTLINK chart BIFF record.
|
1734
|
+
#
|
1735
|
+
def store_objectlink(link_type) # :nodoc:
|
1736
|
+
record = 0x1027 # Record identifier.
|
1737
|
+
length = 0x0006 # Number of bytes to follow.
|
1738
|
+
# link_type # Object text link type.
|
1739
|
+
link_index1 = 0x0000 # Link index 1.
|
1740
|
+
link_index2 = 0x0000 # Link index 2.
|
1741
|
+
|
1742
|
+
store_simple(record, length, link_type, link_index1, link_index2)
|
1743
|
+
end
|
1744
|
+
|
1745
|
+
###############################################################################
|
1746
|
+
#
|
1747
|
+
# _store_pieformat()
|
1748
|
+
#
|
1749
|
+
# Write the PIEFORMAT chart BIFF record.
|
1750
|
+
#
|
1751
|
+
def store_pieformat # :nodoc:
|
1752
|
+
record = 0x100B # Record identifier.
|
1753
|
+
length = 0x0002 # Number of bytes to follow.
|
1754
|
+
percent = 0x0000 # Distance % from center.
|
1755
|
+
|
1756
|
+
store_simple(record, length, percent)
|
1757
|
+
end
|
1758
|
+
|
1759
|
+
###############################################################################
|
1760
|
+
#
|
1761
|
+
# _store_plotarea()
|
1762
|
+
#
|
1763
|
+
# Write the PLOTAREA chart BIFF record. This indicates that the subsequent
|
1764
|
+
# FRAME record belongs to a plot area.
|
1765
|
+
#
|
1766
|
+
def store_plotarea # :nodoc:
|
1767
|
+
record = 0x1035 # Record identifier.
|
1768
|
+
length = 0x0000 # Number of bytes to follow.
|
1769
|
+
|
1770
|
+
store_simple(record, length)
|
1771
|
+
end
|
1772
|
+
|
1773
|
+
###############################################################################
|
1774
|
+
#
|
1775
|
+
# _store_plotgrowth()
|
1776
|
+
#
|
1777
|
+
# Write the PLOTGROWTH chart BIFF record.
|
1778
|
+
#
|
1779
|
+
def store_plotgrowth # :nodoc:
|
1780
|
+
record = 0x1064 # Record identifier.
|
1781
|
+
length = 0x0008 # Number of bytes to follow.
|
1782
|
+
dx_plot = 0x00010000 # Horz growth for font scale.
|
1783
|
+
dy_plot = 0x00010000 # Vert growth for font scale.
|
1784
|
+
|
1785
|
+
header = [record, length].pack('vv')
|
1786
|
+
data = [dx_plot].pack('V')
|
1787
|
+
data += [dy_plot].pack('V')
|
1788
|
+
|
1789
|
+
append(header, data)
|
1790
|
+
end
|
1791
|
+
|
1792
|
+
###############################################################################
|
1793
|
+
#
|
1794
|
+
# _store_pos()
|
1795
|
+
#
|
1796
|
+
# Write the POS chart BIFF record. Generally not required when using
|
1797
|
+
# automatic positioning.
|
1798
|
+
#
|
1799
|
+
def store_pos(mdTopLt, mdBotRt, x1, y1, x2, y2) # :nodoc:
|
1800
|
+
record = 0x104F # Record identifier.
|
1801
|
+
length = 0x0014 # Number of bytes to follow.
|
1802
|
+
# mdTopLt # Top left.
|
1803
|
+
# mdBotRt # Bottom right.
|
1804
|
+
# x1 # X coordinate.
|
1805
|
+
# y1 # Y coordinate.
|
1806
|
+
# x2 # Width.
|
1807
|
+
# y2 # Height.
|
1808
|
+
|
1809
|
+
header = [record, length].pack('vv')
|
1810
|
+
data = [mdTopLt].pack('v')
|
1811
|
+
data += [mdBotRt].pack('v')
|
1812
|
+
data += [x1].pack('V')
|
1813
|
+
data += [y1].pack('V')
|
1814
|
+
data += [x2].pack('V')
|
1815
|
+
data += [y2].pack('V')
|
1816
|
+
|
1817
|
+
append(header, data)
|
1818
|
+
end
|
1819
|
+
|
1820
|
+
###############################################################################
|
1821
|
+
#
|
1822
|
+
# _store_serauxtrend()
|
1823
|
+
#
|
1824
|
+
# Write the SERAUXTREND chart BIFF record.
|
1825
|
+
#
|
1826
|
+
def store_serauxtrend(reg_type, poly_order, equation, r_squared) # :nodoc:
|
1827
|
+
record = 0x104B # Record identifier.
|
1828
|
+
length = 0x001C # Number of bytes to follow.
|
1829
|
+
# reg_type # Regression type.
|
1830
|
+
# poly_order # Polynomial order.
|
1831
|
+
# equation # Display equation.
|
1832
|
+
# r_squared # Display R-squared.
|
1833
|
+
# intercept # Forced intercept.
|
1834
|
+
# forecast # Forecast forward.
|
1835
|
+
# backcast # Forecast backward.
|
1836
|
+
|
1837
|
+
# TODO. When supported, intercept needs to be NAN if not used.
|
1838
|
+
# Also need to reverse doubles.
|
1839
|
+
intercept = ['FFFFFFFF0001FFFF'].pack('H*')
|
1840
|
+
forecast = ['0000000000000000'].pack('H*')
|
1841
|
+
backcast = ['0000000000000000'].pack('H*')
|
1842
|
+
|
1843
|
+
header = [record, length].pack('vv')
|
1844
|
+
data = [reg_type].pack('C')
|
1845
|
+
data += [poly_order].pack('C')
|
1846
|
+
data += intercept
|
1847
|
+
data += [equation].pack('C')
|
1848
|
+
data += [r_squared].pack('C')
|
1849
|
+
data += forecast
|
1850
|
+
data += backcast
|
1851
|
+
|
1852
|
+
append(header, data)
|
1853
|
+
end
|
1854
|
+
|
1855
|
+
###############################################################################
|
1856
|
+
#
|
1857
|
+
# _store_series()
|
1858
|
+
#
|
1859
|
+
# Write the SERIES chart BIFF record.
|
1860
|
+
#
|
1861
|
+
def store_series(category_count, value_count) # :nodoc:
|
1862
|
+
record = 0x1003 # Record identifier.
|
1863
|
+
length = 0x000C # Number of bytes to follow.
|
1864
|
+
category_type = 0x0001 # Type: category.
|
1865
|
+
value_type = 0x0001 # Type: value.
|
1866
|
+
# category_count # Num of categories.
|
1867
|
+
# value_count # Num of values.
|
1868
|
+
bubble_type = 0x0001 # Type: bubble.
|
1869
|
+
bubble_count = 0x0000 # Num of bubble values.
|
1870
|
+
|
1871
|
+
store_simple(record, length, category_type, value_type,
|
1872
|
+
category_count, value_count, bubble_type, bubble_count)
|
1873
|
+
end
|
1874
|
+
|
1875
|
+
###############################################################################
|
1876
|
+
#
|
1877
|
+
# _store_seriestext()
|
1878
|
+
#
|
1879
|
+
# Write the SERIESTEXT chart BIFF record.
|
1880
|
+
#
|
1881
|
+
def store_seriestext(str, encoding) # :nodoc:
|
1882
|
+
ruby_19 { str = convert_to_ascii_if_ascii(str) }
|
1883
|
+
|
1884
|
+
record = 0x100D # Record identifier.
|
1885
|
+
length = 0x0000 # Number of bytes to follow.
|
1886
|
+
id = 0x0000 # Text id.
|
1887
|
+
# str # Text.
|
1888
|
+
# encoding # String encoding.
|
1889
|
+
cch = str.bytesize # String length.
|
1890
|
+
|
1891
|
+
encoding ||= 0
|
1892
|
+
|
1893
|
+
# Character length is num of chars not num of bytes
|
1894
|
+
cch /= 2 if encoding != 0
|
1895
|
+
|
1896
|
+
# Change the UTF-16 name from BE to LE
|
1897
|
+
str = str.unpack('v*').pack('n*') if encoding != 0
|
1898
|
+
|
1899
|
+
length = 4 + str.bytesize
|
1900
|
+
|
1901
|
+
header = [record, length].pack('vv')
|
1902
|
+
data = [id].pack('v')
|
1903
|
+
data += [cch].pack('C')
|
1904
|
+
data += [encoding].pack('C')
|
1905
|
+
|
1906
|
+
append(header, data, str)
|
1907
|
+
end
|
1908
|
+
|
1909
|
+
###############################################################################
|
1910
|
+
#
|
1911
|
+
# _store_serparent()
|
1912
|
+
#
|
1913
|
+
# Write the SERPARENT chart BIFF record.
|
1914
|
+
#
|
1915
|
+
def store_serparent(series) # :nodoc:
|
1916
|
+
record = 0x104A # Record identifier.
|
1917
|
+
length = 0x0002 # Number of bytes to follow.
|
1918
|
+
# series # Series parent.
|
1919
|
+
|
1920
|
+
store_simple(record, length, series)
|
1921
|
+
end
|
1922
|
+
|
1923
|
+
###############################################################################
|
1924
|
+
#
|
1925
|
+
# _store_sertocrt()
|
1926
|
+
#
|
1927
|
+
# Write the SERTOCRT chart BIFF record to indicate the chart group index.
|
1928
|
+
#
|
1929
|
+
def store_sertocrt # :nodoc:
|
1930
|
+
record = 0x1045 # Record identifier.
|
1931
|
+
length = 0x0002 # Number of bytes to follow.
|
1932
|
+
chartgroup = 0x0000 # Chart group index.
|
1933
|
+
|
1934
|
+
store_simple(record, length, chartgroup)
|
1935
|
+
end
|
1936
|
+
|
1937
|
+
###############################################################################
|
1938
|
+
#
|
1939
|
+
# _store_shtprops()
|
1940
|
+
#
|
1941
|
+
# Write the SHTPROPS chart BIFF record.
|
1942
|
+
#
|
1943
|
+
def store_shtprops # :nodoc:
|
1944
|
+
record = 0x1044 # Record identifier.
|
1945
|
+
length = 0x0004 # Number of bytes to follow.
|
1946
|
+
grbit = 0x000E # Option flags.
|
1947
|
+
empty_cells = 0x0000 # Empty cell handling.
|
1948
|
+
|
1949
|
+
grbit = 0x000A if @embedded
|
1950
|
+
|
1951
|
+
store_simple(record, length, grbit, empty_cells)
|
1952
|
+
end
|
1953
|
+
|
1954
|
+
###############################################################################
|
1955
|
+
#
|
1956
|
+
# _store_text()
|
1957
|
+
#
|
1958
|
+
# Write the TEXT chart BIFF record.
|
1959
|
+
#
|
1960
|
+
def store_text(x, y, dx, dy, grbit1, grbit2, rotation = 0x00)# :nodoc:
|
1961
|
+
record = 0x1025 # Record identifier.
|
1962
|
+
length = 0x0020 # Number of bytes to follow.
|
1963
|
+
at = 0x02 # Horizontal alignment.
|
1964
|
+
vat = 0x02 # Vertical alignment.
|
1965
|
+
wBkgMode = 0x0001 # Background display.
|
1966
|
+
rgbText = 0x0000 # Text RGB colour.
|
1967
|
+
# x # Text x-pos.
|
1968
|
+
# y # Text y-pos.
|
1969
|
+
# dx # Width.
|
1970
|
+
# dy # Height.
|
1971
|
+
# grbit1 # Option flags.
|
1972
|
+
icvText = 0x004D # Auto Colour.
|
1973
|
+
# grbit2 # Show legend.
|
1974
|
+
# rotation # Show value.
|
1975
|
+
|
1976
|
+
header = [record, length].pack('vv')
|
1977
|
+
data = [at].pack('C')
|
1978
|
+
data += [vat].pack('C')
|
1979
|
+
data += [wBkgMode].pack('v')
|
1980
|
+
data += [rgbText].pack('V')
|
1981
|
+
data += [x].pack('V')
|
1982
|
+
data += [y].pack('V')
|
1983
|
+
data += [dx].pack('V')
|
1984
|
+
data += [dy].pack('V')
|
1985
|
+
data += [grbit1].pack('v')
|
1986
|
+
data += [icvText].pack('v')
|
1987
|
+
data += [grbit2].pack('v')
|
1988
|
+
data += [rotation].pack('v')
|
1989
|
+
|
1990
|
+
append(header, data)
|
1991
|
+
end
|
1992
|
+
|
1993
|
+
###############################################################################
|
1994
|
+
#
|
1995
|
+
# _store_tick()
|
1996
|
+
#
|
1997
|
+
# Write the TICK chart BIFF record.
|
1998
|
+
#
|
1999
|
+
def store_tick # :nodoc:
|
2000
|
+
record = 0x101E # Record identifier.
|
2001
|
+
length = 0x001E # Number of bytes to follow.
|
2002
|
+
tktMajor = 0x02 # Type of major tick mark.
|
2003
|
+
tktMinor = 0x00 # Type of minor tick mark.
|
2004
|
+
tlt = 0x03 # Tick label position.
|
2005
|
+
wBkgMode = 0x01 # Background mode.
|
2006
|
+
rgb = 0x00000000 # Tick-label RGB colour.
|
2007
|
+
reserved1 = 0x00000000 # Reserved.
|
2008
|
+
reserved2 = 0x00000000 # Reserved.
|
2009
|
+
reserved3 = 0x00000000 # Reserved.
|
2010
|
+
reserved4 = 0x00000000 # Reserved.
|
2011
|
+
grbit = 0x0023 # Option flags.
|
2012
|
+
index = 0x004D # Colour index.
|
2013
|
+
reserved5 = 0x0000 # Reserved.
|
2014
|
+
|
2015
|
+
header = [record, length].pack('vv')
|
2016
|
+
data = [tktMajor].pack('C')
|
2017
|
+
data += [tktMinor].pack('C')
|
2018
|
+
data += [tlt].pack('C')
|
2019
|
+
data += [wBkgMode].pack('C')
|
2020
|
+
data += [rgb].pack('V')
|
2021
|
+
data += [reserved1].pack('V')
|
2022
|
+
data += [reserved2].pack('V')
|
2023
|
+
data += [reserved3].pack('V')
|
2024
|
+
data += [reserved4].pack('V')
|
2025
|
+
data += [grbit].pack('v')
|
2026
|
+
data += [index].pack('v')
|
2027
|
+
data += [reserved5].pack('v')
|
2028
|
+
|
2029
|
+
append(header, data)
|
2030
|
+
end
|
2031
|
+
|
2032
|
+
###############################################################################
|
2033
|
+
#
|
2034
|
+
# _store_valuerange()
|
2035
|
+
#
|
2036
|
+
# Write the VALUERANGE chart BIFF record.
|
2037
|
+
#
|
2038
|
+
def store_valuerange # :nodoc:
|
2039
|
+
record = 0x101F # Record identifier.
|
2040
|
+
length = 0x002A # Number of bytes to follow.
|
2041
|
+
numMin = 0x00000000 # Minimum value on axis.
|
2042
|
+
numMax = 0x00000000 # Maximum value on axis.
|
2043
|
+
numMajor = 0x00000000 # Value of major increment.
|
2044
|
+
numMinor = 0x00000000 # Value of minor increment.
|
2045
|
+
numCross = 0x00000000 # Value where category axis crosses.
|
2046
|
+
grbit = 0x011F # Format flags.
|
2047
|
+
|
2048
|
+
# TODO. Reverse doubles when they are handled.
|
2049
|
+
|
2050
|
+
header = [record, length].pack('vv')
|
2051
|
+
data = [numMin].pack('d')
|
2052
|
+
data += [numMax].pack('d')
|
2053
|
+
data += [numMajor].pack('d')
|
2054
|
+
data += [numMinor].pack('d')
|
2055
|
+
data += [numCross].pack('d')
|
2056
|
+
data += [grbit].pack('v')
|
2057
|
+
|
2058
|
+
append(header, data)
|
2059
|
+
end
|
2060
|
+
|
2061
|
+
|
2062
|
+
###############################################################################
|
2063
|
+
#
|
2064
|
+
# Config data.
|
2065
|
+
#
|
2066
|
+
###############################################################################
|
2067
|
+
|
2068
|
+
###############################################################################
|
2069
|
+
#
|
2070
|
+
# _set_default_properties()
|
2071
|
+
#
|
2072
|
+
# Setup the default properties for a chart.
|
2073
|
+
#
|
2074
|
+
def set_default_properties # :nodoc:
|
2075
|
+
@legend = {
|
2076
|
+
:visible => 1,
|
2077
|
+
:position => 0,
|
2078
|
+
:vertical => 0,
|
2079
|
+
}
|
2080
|
+
|
2081
|
+
@chartarea = {
|
2082
|
+
:visible => 0,
|
2083
|
+
:fg_color_index => 0x4E,
|
2084
|
+
:fg_color_rgb => 0xFFFFFF,
|
2085
|
+
:bg_color_index => 0x4D,
|
2086
|
+
:bg_color_rgb => 0x000000,
|
2087
|
+
:area_pattern => 0x0000,
|
2088
|
+
:area_options => 0x0000,
|
2089
|
+
:line_pattern => 0x0005,
|
2090
|
+
:line_weight => 0xFFFF,
|
2091
|
+
:line_color_index => 0x4D,
|
2092
|
+
:line_color_rgb => 0x000000,
|
2093
|
+
:line_options => 0x0008,
|
2094
|
+
}
|
2095
|
+
|
2096
|
+
@plotarea = {
|
2097
|
+
:visible => 1,
|
2098
|
+
:fg_color_index => 0x16,
|
2099
|
+
:fg_color_rgb => 0xC0C0C0,
|
2100
|
+
:bg_color_index => 0x4F,
|
2101
|
+
:bg_color_rgb => 0x000000,
|
2102
|
+
:area_pattern => 0x0001,
|
2103
|
+
:area_options => 0x0000,
|
2104
|
+
:line_pattern => 0x0000,
|
2105
|
+
:line_weight => 0x0000,
|
2106
|
+
:line_color_index => 0x17,
|
2107
|
+
:line_color_rgb => 0x808080,
|
2108
|
+
:line_options => 0x0000,
|
2109
|
+
}
|
2110
|
+
end
|
2111
|
+
|
2112
|
+
###############################################################################
|
2113
|
+
#
|
2114
|
+
# _set_default_config_data()
|
2115
|
+
#
|
2116
|
+
# Setup the default configuration data for a chart.
|
2117
|
+
#
|
2118
|
+
def set_default_config_data # :nodoc:
|
2119
|
+
@config = default_config_data
|
2120
|
+
end
|
2121
|
+
|
2122
|
+
def default_config_data # :nodoc:
|
2123
|
+
{
|
2124
|
+
:axisparent => [ 0, 0x00F8, 0x01F5, 0x0E7F, 0x0B36 ],
|
2125
|
+
:axisparent_pos => [ 2, 2, 0x008C, 0x01AA, 0x0EEA, 0x0C52 ],
|
2126
|
+
:chart => [ 0x0000, 0x0000, 0x02DD51E0, 0x01C2B838 ],
|
2127
|
+
:font_numbers => [ 5, 10, 0x38B8, 0x22A1, 0x0000 ],
|
2128
|
+
:font_series => [ 6, 10, 0x38B8, 0x22A1, 0x0001 ],
|
2129
|
+
:font_title => [ 7, 12, 0x38B8, 0x22A1, 0x0000 ],
|
2130
|
+
:font_axes => [ 8, 10, 0x38B8, 0x22A1, 0x0001 ],
|
2131
|
+
:legend => [ 0x05F9, 0x0EE9, 0x047D, 0x9C, 0x00, 0x01, 0x0F ],
|
2132
|
+
:legend_pos => [ 5, 2, 0x05F9, 0x0EE9, 0, 0 ],
|
2133
|
+
:legend_text => [ 0xFFFFFF46, 0xFFFFFF06, 0, 0, 0x00B1, 0x0000 ],
|
2134
|
+
:legend_text_pos => [ 2, 2, 0, 0, 0, 0 ],
|
2135
|
+
:series_text => [ 0xFFFFFF46, 0xFFFFFF06, 0, 0, 0x00B1, 0x1020 ],
|
2136
|
+
:series_text_pos => [ 2, 2, 0, 0, 0, 0 ],
|
2137
|
+
:title_text => [ 0x06E4, 0x0051, 0x01DB, 0x00C4, 0x0081, 0x1030 ],
|
2138
|
+
:title_text_pos => [ 2, 2, 0, 0, 0x73, 0x1D ],
|
2139
|
+
:x_axis_text => [ 0x07E1, 0x0DFC, 0xB2, 0x9C, 0x0081, 0x0000 ],
|
2140
|
+
:x_axis_text_pos => [ 2, 2, 0, 0, 0x2B, 0x17 ],
|
2141
|
+
:y_axis_text => [ 0x002D, 0x06AA, 0x5F, 0x1CC, 0x0281, 0x00, 90 ],
|
2142
|
+
:y_axis_text_pos => [ 2, 2, 0, 0, 0x17, 0x44 ],
|
2143
|
+
}
|
2144
|
+
end
|
2145
|
+
private :default_config_data
|
2146
|
+
|
2147
|
+
###############################################################################
|
2148
|
+
#
|
2149
|
+
# _set_embedded_config_data()
|
2150
|
+
#
|
2151
|
+
# Setup the default configuration data for an embedded chart.
|
2152
|
+
#
|
2153
|
+
def set_embedded_config_data # :nodoc:
|
2154
|
+
@embedded = true
|
2155
|
+
|
2156
|
+
@chartarea = {
|
2157
|
+
:visible => 1,
|
2158
|
+
:fg_color_index => 0x4E,
|
2159
|
+
:fg_color_rgb => 0xFFFFFF,
|
2160
|
+
:bg_color_index => 0x4D,
|
2161
|
+
:bg_color_rgb => 0x000000,
|
2162
|
+
:area_pattern => 0x0001,
|
2163
|
+
:area_options => 0x0001,
|
2164
|
+
:line_pattern => 0x0000,
|
2165
|
+
:line_weight => 0x0000,
|
2166
|
+
:line_color_index => 0x4D,
|
2167
|
+
:line_color_rgb => 0x000000,
|
2168
|
+
:line_options => 0x0009,
|
2169
|
+
}
|
2170
|
+
|
2171
|
+
@config = default_config_data.merge({
|
2172
|
+
:axisparent => [ 0, 0x01D8, 0x031D, 0x0D79, 0x07E9 ],
|
2173
|
+
:axisparent_pos => [ 2, 2, 0x010C, 0x0292, 0x0E46, 0x09FD ],
|
2174
|
+
:chart => [ 0x0000, 0x0000, 0x01847FE8, 0x00F47FE8 ],
|
2175
|
+
:font_numbers => [ 5, 10, 0x1DC4, 0x1284, 0x0000 ],
|
2176
|
+
:font_series => [ 6, 10, 0x1DC4, 0x1284, 0x0001 ],
|
2177
|
+
:font_title => [ 7, 12, 0x1DC4, 0x1284, 0x0000 ],
|
2178
|
+
:font_axes => [ 8, 10, 0x1DC4, 0x1284, 0x0001 ],
|
2179
|
+
:legend => [ 0x044E, 0x0E4A, 0x088D, 0x0123, 0x0, 0x1, 0xF ],
|
2180
|
+
:legend_pos => [ 5, 2, 0x044E, 0x0E4A, 0, 0 ],
|
2181
|
+
:legend_text => [ 0xFFFFFFD9, 0xFFFFFFC1, 0, 0, 0x00B1, 0x0000 ],
|
2182
|
+
:series_text => [ 0xFFFFFFD9, 0xFFFFFFC1, 0, 0, 0x00B1, 0x1020 ],
|
2183
|
+
:title_text => [ 0x060F, 0x004C, 0x038A, 0x016F, 0x0081, 0x1030 ],
|
2184
|
+
:x_axis_text => [ 0x07EF, 0x0C8F, 0x153, 0x123, 0x81, 0x00 ],
|
2185
|
+
:y_axis_text => [ 0x0057, 0x0564, 0xB5, 0x035D, 0x0281, 0x00, 90 ],
|
2186
|
+
})
|
2187
|
+
end
|
2188
|
+
end # class Chart
|
2189
|
+
|
2190
|
+
end # module Writeexcel
|