writeexcel 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitattributes +1 -0
- data/README.rdoc +12 -6
- data/VERSION +1 -1
- data/charts/chartex.rb +316 -315
- data/charts/demo1.rb +1 -0
- data/charts/demo2.rb +1 -0
- data/charts/demo3.rb +117 -116
- data/charts/demo4.rb +119 -118
- data/charts/demo5.rb +48 -47
- data/examples/a_simple.rb +1 -0
- data/examples/autofilter.rb +1 -0
- data/examples/bigfile.rb +30 -29
- data/examples/chart_area.rb +121 -120
- data/examples/chart_bar.rb +120 -119
- data/examples/chart_column.rb +120 -119
- data/examples/chart_line.rb +120 -119
- data/examples/chart_pie.rb +108 -107
- data/examples/chart_scatter.rb +121 -120
- data/examples/chart_stock.rb +148 -147
- data/examples/chess.rb +1 -0
- data/examples/colors.rb +1 -0
- data/examples/comments1.rb +1 -0
- data/examples/comments2.rb +3 -2
- data/examples/copyformat.rb +1 -0
- data/examples/data_validate.rb +1 -0
- data/examples/date_time.rb +1 -0
- data/examples/defined_name.rb +1 -0
- data/examples/demo.rb +1 -0
- data/examples/diag_border.rb +1 -0
- data/examples/formats.rb +1 -0
- data/examples/formula_result.rb +1 -0
- data/examples/header.rb +1 -0
- data/examples/hide_sheet.rb +1 -0
- data/examples/hyperlink.rb +1 -0
- data/examples/images.rb +1 -0
- data/examples/indent.rb +1 -0
- data/examples/merge1.rb +1 -0
- data/examples/merge2.rb +1 -0
- data/examples/merge3.rb +1 -0
- data/examples/merge4.rb +1 -0
- data/examples/merge5.rb +1 -0
- data/examples/merge6.rb +67 -66
- data/examples/outline.rb +1 -0
- data/examples/outline_collapsed.rb +1 -0
- data/examples/panes.rb +1 -0
- data/examples/properties.rb +1 -0
- data/examples/properties_jp.rb +1 -0
- data/examples/protection.rb +1 -0
- data/examples/regions.rb +1 -0
- data/examples/repeat.rb +1 -0
- data/examples/right_to_left.rb +1 -0
- data/examples/row_wrap.rb +1 -0
- data/examples/stats.rb +1 -0
- data/examples/stocks.rb +1 -0
- data/examples/tab_colors.rb +1 -0
- data/examples/write_arrays.rb +1 -0
- data/lib/writeexcel.rb +6 -1
- data/lib/writeexcel/biffwriter.rb +21 -20
- data/lib/writeexcel/chart.rb +25 -12
- data/lib/writeexcel/charts/area.rb +153 -152
- data/lib/writeexcel/charts/bar.rb +178 -177
- data/lib/writeexcel/charts/column.rb +157 -156
- data/lib/writeexcel/charts/external.rb +62 -61
- data/lib/writeexcel/charts/line.rb +153 -152
- data/lib/writeexcel/charts/pie.rb +170 -169
- data/lib/writeexcel/charts/scatter.rb +4 -3
- data/lib/writeexcel/charts/stock.rb +212 -211
- data/lib/writeexcel/compatibility.rb +320 -0
- data/lib/writeexcel/excelformulaparser.rb +587 -586
- data/lib/writeexcel/format.rb +12 -13
- data/lib/writeexcel/formula.rb +30 -28
- data/lib/writeexcel/helper.rb +23 -0
- data/lib/writeexcel/olewriter.rb +5 -16
- data/lib/writeexcel/properties.rb +43 -54
- data/lib/writeexcel/storage_lite.rb +981 -968
- data/lib/writeexcel/workbook.rb +94 -73
- data/lib/writeexcel/worksheet.rb +230 -210
- data/test/helper.rb +19 -0
- data/test/test_00_IEEE_double.rb +1 -0
- data/test/test_01_add_worksheet.rb +1 -0
- data/test/test_02_merge_formats.rb +3 -5
- data/test/test_04_dimensions.rb +3 -5
- data/test/test_05_rows.rb +6 -6
- data/test/test_06_extsst.rb +8 -8
- data/test/test_11_date_time.rb +3 -5
- data/test/test_12_date_only.rb +3 -5
- data/test/test_13_date_seconds.rb +4 -6
- data/test/test_21_escher.rb +3 -5
- data/test/test_22_mso_drawing_group.rb +20 -22
- data/test/test_23_note.rb +5 -7
- data/test/test_24_txo.rb +3 -5
- data/test/test_25_position_object.rb +84 -79
- data/test/test_26_autofilter.rb +3 -13
- data/test/test_27_autofilter.rb +3 -13
- data/test/test_28_autofilter.rb +3 -13
- data/test/test_29_process_jpg.rb +5 -0
- data/test/test_30_validation_dval.rb +3 -5
- data/test/test_31_validation_dv_strings.rb +3 -5
- data/test/test_32_validation_dv_formula.rb +3 -5
- data/test/test_40_property_types.rb +10 -9
- data/test/test_41_properties.rb +1 -0
- data/test/test_42_set_properties.rb +14 -15
- data/test/test_50_name_stored.rb +299 -302
- data/test/test_51_name_print_area.rb +357 -360
- data/test/test_52_name_print_titles.rb +454 -457
- data/test/test_53_autofilter.rb +203 -206
- data/test/test_60_chart_generic.rb +5 -0
- data/test/test_61_chart_subclasses.rb +95 -94
- data/test/test_62_chart_formats.rb +272 -267
- data/test/test_63_chart_area_formats.rb +649 -644
- data/test/test_biff.rb +12 -38
- data/test/test_compatibility.rb +627 -0
- data/test/test_example_match.rb +3 -18
- data/test/test_format.rb +46 -105
- data/test/test_formula.rb +1 -0
- data/test/test_ole.rb +3 -4
- data/test/test_storage_lite.rb +125 -146
- data/test/test_workbook.rb +2 -23
- data/test/test_worksheet.rb +4 -5
- data/utils/add_magic_comment.rb +80 -0
- data/writeexcel.gemspec +8 -2
- metadata +10 -4
@@ -1,644 +1,649 @@
|
|
1
|
-
|
2
|
-
require '
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
@
|
19
|
-
@
|
20
|
-
@chart
|
21
|
-
@
|
22
|
-
@
|
23
|
-
@
|
24
|
-
@
|
25
|
-
@
|
26
|
-
@
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
).join(' ')
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
@
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
).join(' ')
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
@
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
).join(' ')
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
@
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
).join(' ')
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
@
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
).join(' ')
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
@
|
145
|
-
|
146
|
-
|
147
|
-
)
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
).join(' ')
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
@
|
167
|
-
|
168
|
-
|
169
|
-
)
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
).join(' ')
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
@
|
189
|
-
|
190
|
-
|
191
|
-
)
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
).join(' ')
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
).join(' ')
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
@
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
).join(' ')
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
@
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
).join(' ')
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
@
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
).join(' ')
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
@
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
).join(' ')
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
@
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
).join(' ')
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
@
|
341
|
-
|
342
|
-
|
343
|
-
)
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
).join(' ')
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
@
|
363
|
-
|
364
|
-
|
365
|
-
)
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
).join(' ')
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
@
|
385
|
-
|
386
|
-
|
387
|
-
)
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
).join(' ')
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
).join(' ')
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
@
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
).join(' ')
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
@
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
).join(' ')
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
@
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
).join(' ')
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
@
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
).join(' ')
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
@
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
).join(' ')
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
@
|
537
|
-
|
538
|
-
|
539
|
-
)
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
).join(' ')
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
@
|
559
|
-
|
560
|
-
|
561
|
-
)
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
).join(' ')
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
@
|
581
|
-
|
582
|
-
|
583
|
-
)
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
).join(' ')
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
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
|
-
end
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
###############################################################################
|
6
|
+
#
|
7
|
+
# A test for Spreadsheet::WriteExcel::Chart.
|
8
|
+
#
|
9
|
+
# Tests for the Excel Chart.pm format conversion methods.
|
10
|
+
#
|
11
|
+
# reverse('ゥ'), January 2010, John McNamara, jmcnamara@cpan.org
|
12
|
+
#
|
13
|
+
# original written in Perl by John McNamara
|
14
|
+
# converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
|
15
|
+
#
|
16
|
+
class TC_ChartAreaFormats < Test::Unit::TestCase
|
17
|
+
def setup
|
18
|
+
@io = StringIO.new
|
19
|
+
@workbook = WriteExcel.new(@io)
|
20
|
+
@chart = @workbook.add_chart(:type => Chart::Column)
|
21
|
+
@chart.using_tmpfile = false
|
22
|
+
@caption1 = " \tChart: chartarea format - line";
|
23
|
+
@caption2 = " \tChart: chartarea format - area";
|
24
|
+
@embed_caption1 = " \tChart: embedded chartarea format - line";
|
25
|
+
@embed_caption2 = " \tChart: embedded chartarea format - area";
|
26
|
+
@plotarea_caption1 = " \tChart: plotarea format - line";
|
27
|
+
@plotarea_caption2 = " \tChart: plotarea format - area";
|
28
|
+
end
|
29
|
+
|
30
|
+
def teardown
|
31
|
+
@workbook.close
|
32
|
+
end
|
33
|
+
|
34
|
+
###############################################################################
|
35
|
+
#
|
36
|
+
# 1. Test the chartarea format methods. See the set_*area() properties below.
|
37
|
+
#
|
38
|
+
def test_the_chartarea_format_methods
|
39
|
+
reset_chart(@chart)
|
40
|
+
|
41
|
+
@chart.set_chartarea(
|
42
|
+
:color => 'red',
|
43
|
+
:line_color => 'black',
|
44
|
+
:line_pattern => 2,
|
45
|
+
:line_weight => 3
|
46
|
+
)
|
47
|
+
|
48
|
+
expected_line = %w(
|
49
|
+
07 10 0C 00 00 00 00 00 01 00 01 00 00 00 08 00
|
50
|
+
).join(' ')
|
51
|
+
|
52
|
+
expected_area = %w(
|
53
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
54
|
+
0A 00 08 00
|
55
|
+
).join(' ')
|
56
|
+
|
57
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
58
|
+
|
59
|
+
assert_equal(expected_line, got_line, @caption1)
|
60
|
+
assert_equal(expected_area, got_area, @caption2)
|
61
|
+
|
62
|
+
|
63
|
+
reset_chart(@chart)
|
64
|
+
|
65
|
+
@chart.set_chartarea(
|
66
|
+
:color => 'red'
|
67
|
+
)
|
68
|
+
|
69
|
+
expected_line = %w(
|
70
|
+
07 10 0C 00 00 00 00 00 05 00 FF FF 08 00 4D 00
|
71
|
+
).join(' ')
|
72
|
+
|
73
|
+
expected_area = %w(
|
74
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
75
|
+
0A 00 08 00
|
76
|
+
).join(' ')
|
77
|
+
|
78
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
79
|
+
|
80
|
+
assert_equal(expected_line, got_line, @caption1)
|
81
|
+
assert_equal(expected_area, got_area, @caption2)
|
82
|
+
|
83
|
+
|
84
|
+
reset_chart(@chart)
|
85
|
+
|
86
|
+
@chart.set_chartarea(
|
87
|
+
:line_color => 'red'
|
88
|
+
)
|
89
|
+
|
90
|
+
expected_line = %w(
|
91
|
+
07 10 0C 00 FF 00 00 00 00 00 FF FF 00 00 0A 00
|
92
|
+
).join(' ')
|
93
|
+
|
94
|
+
expected_area = %w(
|
95
|
+
0A 10 10 00 FF FF FF 00 00 00 00 00 00 00 00 00
|
96
|
+
4E 00 4D 00
|
97
|
+
).join(' ')
|
98
|
+
|
99
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
100
|
+
|
101
|
+
assert_equal(expected_line, got_line, @caption1)
|
102
|
+
assert_equal(expected_area, got_area, @caption2)
|
103
|
+
|
104
|
+
|
105
|
+
reset_chart(@chart)
|
106
|
+
|
107
|
+
@chart.set_chartarea(
|
108
|
+
:line_pattern => 2
|
109
|
+
)
|
110
|
+
|
111
|
+
expected_line = %w(
|
112
|
+
07 10 0C 00 00 00 00 00 01 00 FF FF 00 00 4F 00
|
113
|
+
).join(' ')
|
114
|
+
|
115
|
+
expected_area = %w(
|
116
|
+
0A 10 10 00 FF FF FF 00 00 00 00 00 00 00 00 00
|
117
|
+
4E 00 4D 00
|
118
|
+
).join(' ')
|
119
|
+
|
120
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
121
|
+
|
122
|
+
assert_equal(expected_line, got_line, @caption1)
|
123
|
+
assert_equal(expected_area, got_area, @caption2)
|
124
|
+
|
125
|
+
|
126
|
+
reset_chart(@chart)
|
127
|
+
|
128
|
+
@chart.set_chartarea(
|
129
|
+
:line_weight => 3
|
130
|
+
)
|
131
|
+
|
132
|
+
expected_line = %w(
|
133
|
+
07 10 0C 00 00 00 00 00 00 00 01 00 00 00 4F 00
|
134
|
+
).join(' ')
|
135
|
+
|
136
|
+
expected_area = %w(
|
137
|
+
0A 10 10 00 FF FF FF 00 00 00 00 00 00 00 00 00
|
138
|
+
4E 00 4D 00
|
139
|
+
).join(' ')
|
140
|
+
|
141
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
142
|
+
|
143
|
+
assert_equal(expected_line, got_line, @caption1)
|
144
|
+
assert_equal(expected_area, got_area, @caption2)
|
145
|
+
|
146
|
+
|
147
|
+
reset_chart(@chart)
|
148
|
+
|
149
|
+
@chart.set_chartarea(
|
150
|
+
:color => 'red',
|
151
|
+
:line_color => 'black'
|
152
|
+
)
|
153
|
+
|
154
|
+
expected_line = %w(
|
155
|
+
07 10 0C 00 00 00 00 00 00 00 FF FF 00 00 08 00
|
156
|
+
).join(' ')
|
157
|
+
|
158
|
+
expected_area = %w(
|
159
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
160
|
+
0A 00 08 00
|
161
|
+
).join(' ')
|
162
|
+
|
163
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
164
|
+
|
165
|
+
assert_equal(expected_line, got_line, @caption1)
|
166
|
+
assert_equal(expected_area, got_area, @caption2)
|
167
|
+
|
168
|
+
|
169
|
+
reset_chart(@chart)
|
170
|
+
|
171
|
+
@chart.set_chartarea(
|
172
|
+
:color => 'red',
|
173
|
+
:line_pattern => 2
|
174
|
+
)
|
175
|
+
|
176
|
+
expected_line = %w(
|
177
|
+
07 10 0C 00 00 00 00 00 01 00 FF FF 00 00 4F 00
|
178
|
+
).join(' ')
|
179
|
+
|
180
|
+
expected_area = %w(
|
181
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
182
|
+
0A 00 08 00
|
183
|
+
).join(' ')
|
184
|
+
|
185
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
186
|
+
|
187
|
+
assert_equal(expected_line, got_line, @caption1)
|
188
|
+
assert_equal(expected_area, got_area, @caption2)
|
189
|
+
|
190
|
+
|
191
|
+
reset_chart(@chart)
|
192
|
+
|
193
|
+
@chart.set_chartarea(
|
194
|
+
:color => 'red',
|
195
|
+
:line_weight => 3
|
196
|
+
)
|
197
|
+
|
198
|
+
expected_line = %w(
|
199
|
+
07 10 0C 00 00 00 00 00 00 00 01 00 00 00 4F 00
|
200
|
+
).join(' ')
|
201
|
+
|
202
|
+
expected_area = %w(
|
203
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
204
|
+
0A 00 08 00
|
205
|
+
).join(' ')
|
206
|
+
|
207
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
208
|
+
|
209
|
+
assert_equal(expected_line, got_line, @caption1)
|
210
|
+
assert_equal(expected_area, got_area, @caption2)
|
211
|
+
|
212
|
+
|
213
|
+
@chart.embedded = true
|
214
|
+
|
215
|
+
reset_chart(@chart, true)
|
216
|
+
|
217
|
+
@chart.set_chartarea(
|
218
|
+
)
|
219
|
+
|
220
|
+
expected_line = %w(
|
221
|
+
07 10 0C 00 00 00 00 00 00 00 00 00 09 00 4D 00
|
222
|
+
).join(' ')
|
223
|
+
|
224
|
+
expected_area = %w(
|
225
|
+
0A 10 10 00 FF FF FF 00 00 00 00 00 01 00 01 00
|
226
|
+
4E 00 4D 00
|
227
|
+
).join(' ')
|
228
|
+
|
229
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
230
|
+
|
231
|
+
assert_equal(expected_line, got_line, @embed_caption1)
|
232
|
+
assert_equal(expected_area, got_area, @embed_caption2)
|
233
|
+
|
234
|
+
|
235
|
+
reset_chart(@chart, true)
|
236
|
+
|
237
|
+
@chart.set_chartarea(
|
238
|
+
:color => 'red',
|
239
|
+
:line_color => 'black',
|
240
|
+
:line_pattern => 2,
|
241
|
+
:line_weight => 3
|
242
|
+
)
|
243
|
+
|
244
|
+
expected_line = %w(
|
245
|
+
07 10 0C 00 00 00 00 00 01 00 01 00 00 00 08 00
|
246
|
+
).join(' ')
|
247
|
+
|
248
|
+
expected_area = %w(
|
249
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
250
|
+
0A 00 08 00
|
251
|
+
).join(' ')
|
252
|
+
|
253
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
254
|
+
|
255
|
+
assert_equal(expected_line, got_line, @embed_caption1)
|
256
|
+
assert_equal(expected_area, got_area, @embed_caption2)
|
257
|
+
|
258
|
+
|
259
|
+
reset_chart(@chart, true)
|
260
|
+
|
261
|
+
@chart.set_chartarea(
|
262
|
+
:color => 'red'
|
263
|
+
)
|
264
|
+
|
265
|
+
expected_line = %w(
|
266
|
+
07 10 0C 00 00 00 00 00 00 00 FF FF 09 00 4D 00
|
267
|
+
).join(' ')
|
268
|
+
|
269
|
+
expected_area = %w(
|
270
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
271
|
+
0A 00 08 00
|
272
|
+
).join(' ')
|
273
|
+
|
274
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
275
|
+
|
276
|
+
assert_equal(expected_line, got_line, @embed_caption1)
|
277
|
+
assert_equal(expected_area, got_area, @embed_caption2)
|
278
|
+
|
279
|
+
|
280
|
+
reset_chart(@chart, true)
|
281
|
+
|
282
|
+
@chart.set_chartarea(
|
283
|
+
:line_color => 'red'
|
284
|
+
)
|
285
|
+
|
286
|
+
expected_line = %w(
|
287
|
+
07 10 0C 00 FF 00 00 00 00 00 FF FF 00 00 0A 00
|
288
|
+
).join(' ')
|
289
|
+
|
290
|
+
expected_area = %w(
|
291
|
+
0A 10 10 00 FF FF FF 00 00 00 00 00 01 00 01 00
|
292
|
+
4E 00 4D 00
|
293
|
+
).join(' ')
|
294
|
+
|
295
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
296
|
+
|
297
|
+
assert_equal(expected_line, got_line, @embed_caption1)
|
298
|
+
assert_equal(expected_area, got_area, @embed_caption2)
|
299
|
+
|
300
|
+
|
301
|
+
reset_chart(@chart, true)
|
302
|
+
|
303
|
+
@chart.set_chartarea(
|
304
|
+
:line_pattern => 2
|
305
|
+
)
|
306
|
+
|
307
|
+
expected_line = %w(
|
308
|
+
07 10 0C 00 00 00 00 00 01 00 FF FF 00 00 4F 00
|
309
|
+
).join(' ')
|
310
|
+
|
311
|
+
expected_area = %w(
|
312
|
+
0A 10 10 00 FF FF FF 00 00 00 00 00 01 00 01 00
|
313
|
+
4E 00 4D 00
|
314
|
+
).join(' ')
|
315
|
+
|
316
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
317
|
+
|
318
|
+
assert_equal(expected_line, got_line, @embed_caption1)
|
319
|
+
assert_equal(expected_area, got_area, @embed_caption2)
|
320
|
+
|
321
|
+
|
322
|
+
reset_chart(@chart, true)
|
323
|
+
|
324
|
+
@chart.set_chartarea(
|
325
|
+
:line_weight => 3
|
326
|
+
)
|
327
|
+
|
328
|
+
expected_line = %w(
|
329
|
+
07 10 0C 00 00 00 00 00 00 00 01 00 00 00 4F 00
|
330
|
+
).join(' ')
|
331
|
+
|
332
|
+
expected_area = %w(
|
333
|
+
0A 10 10 00 FF FF FF 00 00 00 00 00 01 00 01 00
|
334
|
+
4E 00 4D 00
|
335
|
+
).join(' ')
|
336
|
+
|
337
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
338
|
+
|
339
|
+
assert_equal(expected_line, got_line, @embed_caption1)
|
340
|
+
assert_equal(expected_area, got_area, @embed_caption2)
|
341
|
+
|
342
|
+
|
343
|
+
reset_chart(@chart, true)
|
344
|
+
|
345
|
+
@chart.set_chartarea(
|
346
|
+
:color => 'red',
|
347
|
+
:line_color => 'black'
|
348
|
+
)
|
349
|
+
|
350
|
+
expected_line = %w(
|
351
|
+
07 10 0C 00 00 00 00 00 00 00 FF FF 00 00 08 00
|
352
|
+
).join(' ')
|
353
|
+
|
354
|
+
expected_area = %w(
|
355
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
356
|
+
0A 00 08 00
|
357
|
+
).join(' ')
|
358
|
+
|
359
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
360
|
+
|
361
|
+
assert_equal(expected_line, got_line, @embed_caption1)
|
362
|
+
assert_equal(expected_area, got_area, @embed_caption2)
|
363
|
+
|
364
|
+
|
365
|
+
reset_chart(@chart, true)
|
366
|
+
|
367
|
+
@chart.set_chartarea(
|
368
|
+
:color => 'red',
|
369
|
+
:line_pattern => 2
|
370
|
+
)
|
371
|
+
|
372
|
+
expected_line = %w(
|
373
|
+
07 10 0C 00 00 00 00 00 01 00 FF FF 00 00 4F 00
|
374
|
+
).join(' ')
|
375
|
+
|
376
|
+
expected_area = %w(
|
377
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
378
|
+
0A 00 08 00
|
379
|
+
).join(' ')
|
380
|
+
|
381
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
382
|
+
|
383
|
+
assert_equal(expected_line, got_line, @embed_caption1)
|
384
|
+
assert_equal(expected_area, got_area, @embed_caption2)
|
385
|
+
|
386
|
+
|
387
|
+
reset_chart(@chart, true)
|
388
|
+
|
389
|
+
@chart.set_chartarea(
|
390
|
+
:color => 'red',
|
391
|
+
:line_weight => 3
|
392
|
+
)
|
393
|
+
|
394
|
+
expected_line = %w(
|
395
|
+
07 10 0C 00 00 00 00 00 00 00 01 00 00 00 4F 00
|
396
|
+
).join(' ')
|
397
|
+
|
398
|
+
expected_area = %w(
|
399
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
400
|
+
0A 00 08 00
|
401
|
+
).join(' ')
|
402
|
+
|
403
|
+
got_line, got_area = get_chartarea_formats(@chart)
|
404
|
+
|
405
|
+
assert_equal(expected_line, got_line, @embed_caption1)
|
406
|
+
assert_equal(expected_area, got_area, @embed_caption2)
|
407
|
+
|
408
|
+
|
409
|
+
@chart.embedded = false
|
410
|
+
|
411
|
+
reset_chart(@chart)
|
412
|
+
|
413
|
+
@chart.set_plotarea(
|
414
|
+
)
|
415
|
+
|
416
|
+
expected_line = %w(
|
417
|
+
07 10 0C 00 80 80 80 00 00 00 00 00 00 00 17 00
|
418
|
+
).join(' ')
|
419
|
+
|
420
|
+
expected_area = %w(
|
421
|
+
0A 10 10 00 C0 C0 C0 00 00 00 00 00 01 00 00 00
|
422
|
+
16 00 4F 00
|
423
|
+
).join(' ')
|
424
|
+
|
425
|
+
got_line, got_area = get_plotarea_formats(@chart)
|
426
|
+
|
427
|
+
assert_equal(expected_line, got_line, @plotarea_caption1)
|
428
|
+
assert_equal(expected_area, got_area, @plotarea_caption2)
|
429
|
+
|
430
|
+
|
431
|
+
reset_chart(@chart)
|
432
|
+
|
433
|
+
@chart.set_plotarea(
|
434
|
+
:color => 'red',
|
435
|
+
:line_color => 'black',
|
436
|
+
:line_pattern => 2,
|
437
|
+
:line_weight => 3
|
438
|
+
)
|
439
|
+
|
440
|
+
expected_line = %w(
|
441
|
+
07 10 0C 00 00 00 00 00 01 00 01 00 00 00 08 00
|
442
|
+
).join(' ')
|
443
|
+
|
444
|
+
expected_area = %w(
|
445
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
446
|
+
0A 00 08 00
|
447
|
+
).join(' ')
|
448
|
+
|
449
|
+
got_line, got_area = get_plotarea_formats(@chart)
|
450
|
+
|
451
|
+
assert_equal(expected_line, got_line, @plotarea_caption1)
|
452
|
+
assert_equal(expected_area, got_area, @plotarea_caption2)
|
453
|
+
|
454
|
+
|
455
|
+
reset_chart(@chart)
|
456
|
+
|
457
|
+
@chart.set_plotarea(
|
458
|
+
:color => 'red'
|
459
|
+
)
|
460
|
+
|
461
|
+
expected_line = %w(
|
462
|
+
07 10 0C 00 80 80 80 00 00 00 00 00 00 00 17 00
|
463
|
+
).join(' ')
|
464
|
+
|
465
|
+
expected_area = %w(
|
466
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
467
|
+
0A 00 08 00
|
468
|
+
).join(' ')
|
469
|
+
|
470
|
+
got_line, got_area = get_plotarea_formats(@chart)
|
471
|
+
|
472
|
+
assert_equal(expected_line, got_line, @plotarea_caption1)
|
473
|
+
assert_equal(expected_area, got_area, @plotarea_caption2)
|
474
|
+
|
475
|
+
|
476
|
+
reset_chart(@chart)
|
477
|
+
|
478
|
+
@chart.set_plotarea(
|
479
|
+
:line_color => 'red'
|
480
|
+
)
|
481
|
+
|
482
|
+
expected_line = %w(
|
483
|
+
07 10 0C 00 FF 00 00 00 00 00 00 00 00 00 0A 00
|
484
|
+
).join(' ')
|
485
|
+
|
486
|
+
expected_area = %w(
|
487
|
+
0A 10 10 00 C0 C0 C0 00 00 00 00 00 01 00 00 00
|
488
|
+
16 00 08 00
|
489
|
+
).join(' ')
|
490
|
+
|
491
|
+
got_line, got_area = get_plotarea_formats(@chart)
|
492
|
+
|
493
|
+
assert_equal(expected_line, got_line, @plotarea_caption1)
|
494
|
+
assert_equal(expected_area, got_area, @plotarea_caption2)
|
495
|
+
|
496
|
+
|
497
|
+
reset_chart(@chart)
|
498
|
+
|
499
|
+
@chart.set_plotarea(
|
500
|
+
:line_pattern => 2
|
501
|
+
)
|
502
|
+
|
503
|
+
expected_line = %w(
|
504
|
+
07 10 0C 00 80 80 80 00 01 00 00 00 00 00 17 00
|
505
|
+
).join(' ')
|
506
|
+
|
507
|
+
expected_area = %w(
|
508
|
+
0A 10 10 00 C0 C0 C0 00 00 00 00 00 01 00 00 00
|
509
|
+
16 00 08 00
|
510
|
+
).join(' ')
|
511
|
+
|
512
|
+
got_line, got_area = get_plotarea_formats(@chart)
|
513
|
+
|
514
|
+
assert_equal(expected_line, got_line, @plotarea_caption1)
|
515
|
+
assert_equal(expected_area, got_area, @plotarea_caption2)
|
516
|
+
|
517
|
+
|
518
|
+
reset_chart(@chart)
|
519
|
+
|
520
|
+
@chart.set_plotarea(
|
521
|
+
:line_weight => 3
|
522
|
+
)
|
523
|
+
|
524
|
+
expected_line = %w(
|
525
|
+
07 10 0C 00 80 80 80 00 00 00 01 00 00 00 17 00
|
526
|
+
).join(' ')
|
527
|
+
|
528
|
+
expected_area = %w(
|
529
|
+
0A 10 10 00 C0 C0 C0 00 00 00 00 00 01 00 00 00
|
530
|
+
16 00 08 00
|
531
|
+
).join(' ')
|
532
|
+
|
533
|
+
got_line, got_area = get_plotarea_formats(@chart)
|
534
|
+
|
535
|
+
assert_equal(expected_line, got_line, @plotarea_caption1)
|
536
|
+
assert_equal(expected_area, got_area, @plotarea_caption2)
|
537
|
+
|
538
|
+
|
539
|
+
reset_chart(@chart)
|
540
|
+
|
541
|
+
@chart.set_plotarea(
|
542
|
+
:color => 'red',
|
543
|
+
:line_color => 'black'
|
544
|
+
)
|
545
|
+
|
546
|
+
expected_line = %w(
|
547
|
+
07 10 0C 00 00 00 00 00 00 00 00 00 00 00 08 00
|
548
|
+
).join(' ')
|
549
|
+
|
550
|
+
expected_area = %w(
|
551
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
552
|
+
0A 00 08 00
|
553
|
+
).join(' ')
|
554
|
+
|
555
|
+
got_line, got_area = get_plotarea_formats(@chart)
|
556
|
+
|
557
|
+
assert_equal(expected_line, got_line, @plotarea_caption1)
|
558
|
+
assert_equal(expected_area, got_area, @plotarea_caption2)
|
559
|
+
|
560
|
+
|
561
|
+
reset_chart(@chart)
|
562
|
+
|
563
|
+
@chart.set_plotarea(
|
564
|
+
:color => 'red',
|
565
|
+
:line_pattern => 2
|
566
|
+
)
|
567
|
+
|
568
|
+
expected_line = %w(
|
569
|
+
07 10 0C 00 80 80 80 00 01 00 00 00 00 00 17 00
|
570
|
+
).join(' ')
|
571
|
+
|
572
|
+
expected_area = %w(
|
573
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
574
|
+
0A 00 08 00
|
575
|
+
).join(' ')
|
576
|
+
|
577
|
+
got_line, got_area = get_plotarea_formats(@chart)
|
578
|
+
|
579
|
+
assert_equal(expected_line, got_line, @plotarea_caption1)
|
580
|
+
assert_equal(expected_area, got_area, @plotarea_caption2)
|
581
|
+
|
582
|
+
|
583
|
+
reset_chart(@chart)
|
584
|
+
|
585
|
+
@chart.set_plotarea(
|
586
|
+
:color => 'red',
|
587
|
+
:line_weight => 3
|
588
|
+
)
|
589
|
+
|
590
|
+
expected_line = %w(
|
591
|
+
07 10 0C 00 80 80 80 00 00 00 01 00 00 00 17 00
|
592
|
+
).join(' ')
|
593
|
+
|
594
|
+
expected_area = %w(
|
595
|
+
0A 10 10 00 FF 00 00 00 00 00 00 00 01 00 00 00
|
596
|
+
0A 00 08 00
|
597
|
+
).join(' ')
|
598
|
+
|
599
|
+
got_line, got_area = get_plotarea_formats(@chart)
|
600
|
+
|
601
|
+
assert_equal(expected_line, got_line, @plotarea_caption1)
|
602
|
+
assert_equal(expected_area, got_area, @plotarea_caption2)
|
603
|
+
end
|
604
|
+
|
605
|
+
|
606
|
+
###############################################################################
|
607
|
+
#
|
608
|
+
# Reset the chart data for testing.
|
609
|
+
#
|
610
|
+
def reset_chart(chart, embedded = nil)
|
611
|
+
# Reset the chart data.
|
612
|
+
chart.data = ''
|
613
|
+
chart.set_default_properties
|
614
|
+
|
615
|
+
if embedded
|
616
|
+
chart.set_embedded_config_data
|
617
|
+
end
|
618
|
+
end
|
619
|
+
|
620
|
+
###############################################################################
|
621
|
+
#
|
622
|
+
# Extract Line and Area format records from the Chartarea Frame stream.
|
623
|
+
#
|
624
|
+
def get_chartarea_formats(chart)
|
625
|
+
chart.store_chartarea_frame_stream
|
626
|
+
|
627
|
+
line = unpack_record(chart.data[12, 16])
|
628
|
+
area = unpack_record(chart.data[28, 20])
|
629
|
+
|
630
|
+
[line, area]
|
631
|
+
end
|
632
|
+
|
633
|
+
###############################################################################
|
634
|
+
#
|
635
|
+
# Extract Line and Area format records from the Chartarea Frame stream.
|
636
|
+
#
|
637
|
+
def get_plotarea_formats(chart)
|
638
|
+
chart.store_plotarea_frame_stream
|
639
|
+
|
640
|
+
line = unpack_record(chart.data[12, 16])
|
641
|
+
area = unpack_record(chart.data[28, 20])
|
642
|
+
|
643
|
+
[line, area]
|
644
|
+
end
|
645
|
+
|
646
|
+
def unpack_record(data)
|
647
|
+
data.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ')
|
648
|
+
end
|
649
|
+
end
|