xlsxwriter 0.2.1.pre → 0.2.1.pre.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,4 +18,4 @@ void init_xlsxwriter_worksheet();
18
18
 
19
19
  extern VALUE cWorksheet;
20
20
 
21
- #endif /// __WORKSHEET__
21
+ #endif // __WORKSHEET__
@@ -1,6 +1,7 @@
1
1
  #include <ruby.h>
2
2
  #include <xlsxwriter.h>
3
3
  #include "chart.h"
4
+ #include "chartsheet.h"
4
5
  #include "format.h"
5
6
  #include "rich_string.h"
6
7
  #include "workbook.h"
@@ -41,5 +42,6 @@ void Init_xlsxwriter() {
41
42
  init_xlsxwriter_format();
42
43
  init_xlsxwriter_worksheet();
43
44
  init_xlsxwriter_chart();
45
+ init_xlsxwriter_chartsheet();
44
46
  init_xlsxwriter_rich_string();
45
47
  }
@@ -2,5 +2,5 @@
2
2
 
3
3
  module XlsxWriter
4
4
  # :nodoc:
5
- VERSION = '0.2.1.pre'.freeze
5
+ VERSION = '0.2.1.pre.2'.freeze
6
6
  end
@@ -0,0 +1,201 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative './xlsx-func-testcase'
4
+
5
+ class TestChartsheet < XlsxWriterTestCase
6
+ DATA = [
7
+ [1, 2, 3],
8
+ [2, 4, 6],
9
+ [3, 6, 9],
10
+ [4, 8, 12],
11
+ [5, 10, 15]
12
+ ]
13
+
14
+ test 'chartsheet01' do |wb|
15
+ wb.add_worksheet do |ws|
16
+ DATA.each { |row| ws.add_row row }
17
+
18
+ cs = wb.add_chartsheet
19
+ cs.activate
20
+
21
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
22
+ chart.axis_id_1 = 79_858_304
23
+ chart.axis_id_2 = 79_860_096
24
+
25
+ chart.add_series '=Sheet1!$A$1:$A$5'
26
+ chart.add_series '=Sheet1!$B$1:$B$5'
27
+ chart.add_series '=Sheet1!$C$1:$C$5'
28
+ cs.chart = chart
29
+ end
30
+ end
31
+ end
32
+
33
+ test 'chartsheet02' do |wb|
34
+ wb.add_worksheet do |ws|
35
+ DATA.each { |row| ws.add_row row }
36
+
37
+ cs = wb.add_chartsheet
38
+ cs.activate
39
+
40
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
41
+ chart.axis_id_1 = 79_858_304
42
+ chart.axis_id_2 = 79_860_096
43
+
44
+ chart.add_series '=Sheet1!$A$1:$A$5'
45
+ chart.add_series '=Sheet1!$B$1:$B$5'
46
+ chart.add_series '=Sheet1!$C$1:$C$5'
47
+ cs.chart = chart
48
+ end
49
+ end
50
+ wb.add_worksheet.select
51
+ end
52
+
53
+ test 'chartsheet03' do |wb|
54
+ wb.add_worksheet do |ws|
55
+ DATA.each { |row| ws.add_row row }
56
+
57
+ cs = wb.add_chartsheet
58
+ cs.hide
59
+
60
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
61
+ chart.axis_id_1 = 43_794_816
62
+ chart.axis_id_2 = 43_796_352
63
+
64
+ chart.add_series '=Sheet1!$A$1:$A$5'
65
+ chart.add_series '=Sheet1!$B$1:$B$5'
66
+ chart.add_series '=Sheet1!$C$1:$C$5'
67
+ cs.chart = chart
68
+ end
69
+ end
70
+ end
71
+
72
+ test 'chartsheet04' do |wb|
73
+ wb.add_worksheet do |ws|
74
+ DATA.each { |row| ws.add_row row }
75
+
76
+ cs = wb.add_chartsheet
77
+ cs.protect
78
+
79
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
80
+ chart.axis_id_1 = 43_913_216
81
+ chart.axis_id_2 = 43_914_752
82
+
83
+ chart.add_series '=Sheet1!$A$1:$A$5'
84
+ chart.add_series '=Sheet1!$B$1:$B$5'
85
+ chart.add_series '=Sheet1!$C$1:$C$5'
86
+ cs.chart = chart
87
+ end
88
+ end
89
+ end
90
+
91
+ test 'chartsheet05' do |wb|
92
+ wb.add_worksheet do |ws|
93
+ DATA.each { |row| ws.add_row row }
94
+
95
+ cs = wb.add_chartsheet
96
+ cs.zoom = 75
97
+
98
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
99
+ chart.axis_id_1 = 43_695_104
100
+ chart.axis_id_2 = 43_787_008
101
+
102
+ chart.add_series '=Sheet1!$A$1:$A$5'
103
+ chart.add_series '=Sheet1!$B$1:$B$5'
104
+ chart.add_series '=Sheet1!$C$1:$C$5'
105
+ cs.chart = chart
106
+ end
107
+ end
108
+ end
109
+
110
+ test 'chartsheet06' do |wb|
111
+ wb.add_worksheet do |ws|
112
+ DATA.each { |row| ws.add_row row }
113
+
114
+ cs = wb.add_chartsheet
115
+ cs.tab_color = XlsxWriter::Format::COLOR_RED
116
+
117
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
118
+ chart.axis_id_1 = 43_778_432
119
+ chart.axis_id_2 = 43_780_352
120
+
121
+ chart.add_series '=Sheet1!$A$1:$A$5'
122
+ chart.add_series '=Sheet1!$B$1:$B$5'
123
+ chart.add_series '=Sheet1!$C$1:$C$5'
124
+ cs.chart = chart
125
+ end
126
+ end
127
+ end
128
+
129
+ test 'chartsheet07' do |wb|
130
+ wb.add_worksheet do |ws|
131
+ DATA.each { |row| ws.add_row row }
132
+
133
+ cs = wb.add_chartsheet
134
+ cs.set_portrait
135
+ cs.paper = 9
136
+ cs.horizontal_dpi = cs.vertical_dpi = 200
137
+
138
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
139
+ chart.axis_id_1 = 61_296_640
140
+ chart.axis_id_2 = 61_298_176
141
+
142
+ chart.add_series '=Sheet1!$A$1:$A$5'
143
+ chart.add_series '=Sheet1!$B$1:$B$5'
144
+ chart.add_series '=Sheet1!$C$1:$C$5'
145
+ cs.chart = chart
146
+ end
147
+ end
148
+ end
149
+
150
+ test 'chartsheet08' do |wb, t|
151
+ t.ignore_files = ['xl/drawings/drawing1.xml']
152
+ wb.add_worksheet do |ws|
153
+ DATA.each { |row| ws.add_row row }
154
+
155
+ cs = wb.add_chartsheet
156
+ cs.set_margins(
157
+ 0.511811023622047,
158
+ 0.511811023622047,
159
+ 0.551181102362204,
160
+ 0.944881889763779
161
+ )
162
+ cs.paper = 9
163
+ cs.set_portrait
164
+ cs.set_header('&CPage &P', margin: 0.118110236220472)
165
+ cs.set_footer('&C&A', margin: 0.118110236220472)
166
+ cs.horizontal_dpi = cs.vertical_dpi = 200
167
+
168
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
169
+ chart.axis_id_1 = 61_297_792
170
+ chart.axis_id_2 = 61_299_328
171
+
172
+ chart.add_series '=Sheet1!$A$1:$A$5'
173
+ chart.add_series '=Sheet1!$B$1:$B$5'
174
+ chart.add_series '=Sheet1!$C$1:$C$5'
175
+ cs.chart = chart
176
+ end
177
+ end
178
+ end
179
+
180
+ test 'chartsheet09' do |wb|
181
+ wb.add_worksheet do |ws|
182
+ DATA.each { |row| ws.add_row row }
183
+
184
+ cs = wb.add_chartsheet
185
+ cs.activate
186
+
187
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
188
+ chart.axis_id_1 = 49_044_480
189
+ chart.axis_id_2 = 49_055_232
190
+
191
+ series = chart.add_series '=Sheet1!$A$1:$A$5'
192
+ chart.add_series '=Sheet1!$B$1:$B$5'
193
+ chart.add_series '=Sheet1!$C$1:$C$5'
194
+
195
+ series.set_line(color: XlsxWriter::Format::COLOR_YELLOW)
196
+ series.set_fill(color: XlsxWriter::Format::COLOR_RED)
197
+ cs.chart = chart
198
+ end
199
+ end
200
+ end
201
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xlsxwriter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1.pre
4
+ version: 0.2.1.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick H
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-29 00:00:00.000000000 Z
11
+ date: 2019-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -62,6 +62,9 @@ files:
62
62
  - Rakefile
63
63
  - ext/xlsxwriter/chart.c
64
64
  - ext/xlsxwriter/chart.h
65
+ - ext/xlsxwriter/chartsheet.c
66
+ - ext/xlsxwriter/chartsheet.h
67
+ - ext/xlsxwriter/common.h
65
68
  - ext/xlsxwriter/extconf.rb
66
69
  - ext/xlsxwriter/format.c
67
70
  - ext/xlsxwriter/format.h
@@ -160,6 +163,7 @@ files:
160
163
  - test/test-chart-scatter.rb
161
164
  - test/test-chart-size.rb
162
165
  - test/test-chart-title.rb
166
+ - test/test-chartsheet.rb
163
167
  - test/test-data-validation.rb
164
168
  - test/test-data.rb
165
169
  - test/test-default-row.rb
@@ -221,6 +225,7 @@ test_files:
221
225
  - test/test-chart-bar.rb
222
226
  - test/test-page-setup.rb
223
227
  - test/test-page-breaks.rb
228
+ - test/test-chartsheet.rb
224
229
  - test/test-protect.rb
225
230
  - test/test-ruby-worksheet.rb
226
231
  - test/test-chart-legend.rb