xlsxwriter 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,34 @@
1
+ require_relative './xlsx-func-testcase'
2
+
3
+ class TestChartBar < XlsxWriterTestCase
4
+ DATA = [
5
+ [1, 2, 3],
6
+ [2, 4, 6],
7
+ [3, 6, 9],
8
+ [4, 8, 12],
9
+ [5, 10, 15]
10
+ ]
11
+
12
+ # 61, 01 does not add any coverage
13
+ test 'chart_bar01' do |wb|
14
+ wb.add_worksheet do |ws|
15
+ DATA.each { |row| ws.add_row row }
16
+
17
+ wb.add_chart(XlsxWriter::Workbook::Chart::BAR) do |chart|
18
+ chart.axis_id_1 = 64_052_224
19
+ chart.axis_id_2 = 64_055_552
20
+
21
+ series1 = chart.add_series
22
+ series2 = chart.add_series
23
+
24
+ series1.set_categories 'Sheet1', 0, 0, 4, 0
25
+ series1.set_values 'Sheet1', 0, 1, 4, 1
26
+
27
+ series2.set_categories 'Sheet1', 0, 0, 4, 0
28
+ series2.set_values 'Sheet1', 0, 2, 4, 2
29
+
30
+ ws.insert_chart 'E9', chart
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,30 @@
1
+ require_relative './xlsx-func-testcase'
2
+
3
+ class TestChartColumn < XlsxWriterTestCase
4
+ DATA = [
5
+ [1, 2, 3],
6
+ [2, 4, 6],
7
+ [3, 6, 9],
8
+ [4, 8, 12],
9
+ [5, 10, 15]
10
+ ]
11
+
12
+ test 'chart_column11' do |wb|
13
+ wb.add_worksheet do |ws|
14
+ DATA.each { |row| ws.add_row row }
15
+
16
+ wb.add_chart(XlsxWriter::Workbook::Chart::COLUMN) do |chart|
17
+ chart.axis_id_1 = 46_847_488
18
+ chart.axis_id_2 = 46_849_408
19
+
20
+ chart.add_series '=Sheet1!$A$1:$A$5'
21
+ chart.add_series '=Sheet1!$B$1:$B$5'
22
+ chart.add_series '=Sheet1!$C$1:$C$5'
23
+
24
+ chart.style = 1
25
+
26
+ ws.insert_chart('E9', chart)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,31 @@
1
+ require_relative './xlsx-func-testcase'
2
+
3
+ class TestChartDoughnut < XlsxWriterTestCase
4
+ DATA = [ [2, 60], [4, 30], [6, 10] ]
5
+
6
+ test 'chart_doughnut02' do |wb|
7
+ wb.add_worksheet do |ws|
8
+ DATA.each { |row| ws.add_row row }
9
+
10
+ wb.add_chart(XlsxWriter::Workbook::Chart::DOUGHNUT) do |chart|
11
+ chart.add_series '=Sheet1!$A$1:$A$3', '=Sheet1!$B$1:$B$3'
12
+ chart.hole_size = 10
13
+
14
+ ws.insert_chart('E9', chart)
15
+ end
16
+ end
17
+ end
18
+
19
+ test 'chart_doughnut04' do |wb|
20
+ wb.add_worksheet do |ws|
21
+ DATA.each { |row| ws.add_row row }
22
+
23
+ wb.add_chart(XlsxWriter::Workbook::Chart::DOUGHNUT) do |chart|
24
+ chart.add_series '=Sheet1!$A$1:$A$3', '=Sheet1!$B$1:$B$3'
25
+ chart.rotation = 30
26
+
27
+ ws.insert_chart('E9', chart)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,44 @@
1
+ require_relative './xlsx-func-testcase'
2
+
3
+ class TestChartPie < XlsxWriterTestCase
4
+ DATA = [ [2, 60], [4, 30], [6, 10] ]
5
+
6
+ test 'chart_pie02' do |wb|
7
+ wb.add_worksheet do |ws|
8
+ DATA.each { |row| ws.add_row row }
9
+
10
+ wb.add_chart(XlsxWriter::Workbook::Chart::PIE) do |chart|
11
+ chart.add_series '=Sheet1!$A$1:$A$3', '=Sheet1!$B$1:$B$3'
12
+ chart.legend_set_font bold: true, italic: true, baseline: -1
13
+
14
+ ws.insert_chart('E9', chart)
15
+ end
16
+ end
17
+ end
18
+
19
+ test 'chart_pie03' do |wb|
20
+ wb.add_worksheet do |ws|
21
+ DATA.each { |row| ws.add_row row }
22
+
23
+ wb.add_chart(XlsxWriter::Workbook::Chart::PIE) do |chart|
24
+ chart.add_series '=Sheet1!$A$1:$A$3', '=Sheet1!$B$1:$B$3'
25
+ chart.legend_delete_series [1]
26
+
27
+ ws.insert_chart('E9', chart)
28
+ end
29
+ end
30
+ end
31
+
32
+ test 'chart_pie04' do |wb|
33
+ wb.add_worksheet do |ws|
34
+ DATA.each { |row| ws.add_row row }
35
+
36
+ wb.add_chart(XlsxWriter::Workbook::Chart::PIE) do |chart|
37
+ chart.add_series '=Sheet1!$A$1:$A$3', '=Sheet1!$B$1:$B$3'
38
+ chart.legend_position = XlsxWriter::Workbook::Chart::LEGEND_OVERLAY_RIGHT
39
+
40
+ ws.insert_chart('E9', chart)
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,29 @@
1
+ require_relative './xlsx-func-testcase'
2
+
3
+ class TestChartScatter < XlsxWriterTestCase
4
+ test 'chart_scatter15' do |wb|
5
+ wb.add_worksheet do |ws|
6
+ wb.add_chart(XlsxWriter::Workbook::Chart::SCATTER) do |chart|
7
+ chart.axis_id_1 = 58_843_520
8
+ chart.axis_id_2 = 58_845_440
9
+
10
+
11
+ ws.write_string 0, 0, 'X'
12
+ ws.write_string 0, 1, 'Y'
13
+ ws.write_number 1, 0, 1
14
+ ws.write_number 1, 1, 10
15
+ ws.write_number 2, 0, 3
16
+ ws.write_number 2, 1, 30
17
+
18
+ chart.add_series '=Sheet1!$A$2:$A$3', '=Sheet1!$B$2:$B$3'
19
+
20
+ chart.x_axis.set_name_range 'Sheet1', 0, 0
21
+ chart.x_axis.set_name_font italic: true, baseline: -1
22
+
23
+ chart.y_axis.set_name_range 'Sheet1', 0, 1
24
+
25
+ ws.insert_chart 'E9', chart
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,45 @@
1
+ require_relative './xlsx-func-testcase'
2
+
3
+ class TestChartSize < XlsxWriterTestCase
4
+ DATA = [
5
+ [1, 2, 3],
6
+ [2, 4, 6],
7
+ [3, 6, 9],
8
+ [4, 8, 12],
9
+ [5, 10, 15]
10
+ ]
11
+
12
+ test 'chart_size01' do |wb|
13
+ wb.add_worksheet do |ws|
14
+ DATA.each { |row| ws.add_row row }
15
+
16
+ wb.add_chart(XlsxWriter::Workbook::Chart::COLUMN) do |chart|
17
+ chart.axis_id_1 = 61_355_904
18
+ chart.axis_id_2 = 61_365_248
19
+
20
+ chart.add_series '=Sheet1!$A$1:$A$5'
21
+ chart.add_series '=Sheet1!$B$1:$B$5'
22
+ chart.add_series '=Sheet1!$C$1:$C$5'
23
+
24
+ ws.insert_chart('E9', chart, x_scale: 1.06666667, y_scale: 1.11111112)
25
+ end
26
+ end
27
+ end
28
+
29
+ test 'chart_size04' do |wb|
30
+ wb.add_worksheet do |ws|
31
+ DATA.each { |row| ws.add_row row }
32
+
33
+ wb.add_chart(XlsxWriter::Workbook::Chart::COLUMN) do |chart|
34
+ chart.axis_id_1 = 73_773_440
35
+ chart.axis_id_2 = 73_774_976
36
+
37
+ chart.add_series '=Sheet1!$A$1:$A$5'
38
+ chart.add_series '=Sheet1!$B$1:$B$5'
39
+ chart.add_series '=Sheet1!$C$1:$C$5'
40
+
41
+ ws.insert_chart('E9', chart, x_offset: 8, y_offset: 9)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,44 @@
1
+ require_relative './xlsx-func-testcase'
2
+
3
+ class TestChartTitle < XlsxWriterTestCase
4
+ DATA = [
5
+ [1, 2, 3],
6
+ [2, 4, 6],
7
+ [3, 6, 9],
8
+ [4, 8, 12],
9
+ [5, 10, 15]
10
+ ]
11
+
12
+ test 'chart_title01' do |wb|
13
+ wb.add_worksheet do |ws|
14
+ DATA.each { |row| ws.add_row row }
15
+
16
+ wb.add_chart(XlsxWriter::Workbook::Chart::COLUMN) do |chart|
17
+ chart.axis_id_1 = 46_165_376
18
+ chart.axis_id_2 = 54_462_720
19
+
20
+ series = chart.add_series('=Sheet1!$A$1:$A$5')
21
+ series.name = 'Foo'
22
+ chart.title = nil
23
+
24
+ ws.insert_chart 'E9', chart
25
+ end
26
+ end
27
+ end
28
+
29
+ test 'chart_title02' do |wb|
30
+ wb.add_worksheet do |ws|
31
+ DATA.each { |row| ws.add_row row }
32
+
33
+ wb.add_chart(XlsxWriter::Workbook::Chart::COLUMN) do |chart|
34
+ chart.axis_id_1 = 73_655_040
35
+ chart.axis_id_2 = 73_656_576
36
+
37
+ series = chart.add_series('=Sheet1!$A$1:$A$5')
38
+ chart.title = 'Title!'
39
+
40
+ ws.insert_chart 'E9', chart
41
+ end
42
+ end
43
+ end
44
+ end
@@ -6,40 +6,40 @@ class TestPanes < XlsxWriterTestCase
6
6
  .write_string(0, 'A', 'Foo', nil)
7
7
  .freeze_panes(1, 'A')
8
8
  wb.add_worksheet
9
- .write_string(0, 'A', 'Foo', nil)
10
- .freeze_panes(2, 'A')
9
+ .write_string('A1', 'Foo')
10
+ .freeze_panes('A3')
11
11
  wb.add_worksheet
12
- .write_string(0, 'A', 'Foo', nil)
13
- .freeze_panes(0, 'B')
12
+ .write_string('A1', 'Foo')
13
+ .freeze_panes('B1')
14
14
  wb.add_worksheet
15
- .write_string(0, 'A', 'Foo', nil)
16
- .freeze_panes(0, 'C')
15
+ .write_string('A1', 'Foo')
16
+ .freeze_panes('C1')
17
17
  wb.add_worksheet
18
- .write_string(0, 'A', 'Foo', nil)
19
- .freeze_panes(1, 'B')
18
+ .write_string('A1', 'Foo')
19
+ .freeze_panes('B2')
20
20
  wb.add_worksheet
21
- .write_string(0, 'A', 'Foo', nil)
22
- .freeze_panes(3, 'G')
21
+ .write_string('A1', 'Foo')
22
+ .freeze_panes('G4')
23
23
  wb.add_worksheet
24
- .write_string(0, 'A', 'Foo', nil)
25
- .freeze_panes(3, 6, 3, 6, 1)
24
+ .write_string('A1', 'Foo')
25
+ .freeze_panes('G4', 'G4', 1)
26
26
  wb.add_worksheet
27
- .write_string(0, 'A', 'Foo', nil)
27
+ .write_string('A1', 'Foo')
28
28
  .split_panes(15, 0)
29
29
  wb.add_worksheet
30
- .write_string(0, 'A', 'Foo', nil)
30
+ .write_string('A1', 'Foo')
31
31
  .split_panes(30, 0)
32
32
  wb.add_worksheet
33
- .write_string(0, 'A', 'Foo', nil)
33
+ .write_string('A1', 'Foo')
34
34
  .split_panes(0, 8.46)
35
35
  wb.add_worksheet
36
- .write_string(0, 'A', 'Foo', nil)
36
+ .write_string('A1', 'Foo')
37
37
  .split_panes(0, 17.57)
38
38
  wb.add_worksheet
39
- .write_string(0, 'A', 'Foo', nil)
39
+ .write_string('A1', 'Foo')
40
40
  .split_panes(15, 8.46)
41
41
  wb.add_worksheet
42
- .write_string(0, 'A', 'Foo', nil)
42
+ .write_string('A1', 'Foo')
43
43
  .split_panes(45, 54.14)
44
44
  end
45
45
  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.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick H
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-03 00:00:00.000000000 Z
11
+ date: 2017-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -142,6 +142,14 @@ files:
142
142
  - test/test-array-formula.rb
143
143
  - test/test-autofilter.rb
144
144
  - test/test-chart-area.rb
145
+ - test/test-chart-axis.rb
146
+ - test/test-chart-bar.rb
147
+ - test/test-chart-column.rb
148
+ - test/test-chart-doughnut.rb
149
+ - test/test-chart-pie.rb
150
+ - test/test-chart-scatter.rb
151
+ - test/test-chart-size.rb
152
+ - test/test-chart-title.rb
145
153
  - test/test-data.rb
146
154
  - test/test-default-row.rb
147
155
  - test/test-defined-name.rb
@@ -195,17 +203,22 @@ specification_version: 4
195
203
  summary: Ruby interface to libxlsxwriter
196
204
  test_files:
197
205
  - test/test-simple.rb
206
+ - test/test-chart-bar.rb
198
207
  - test/test-page-setup.rb
199
208
  - test/test-page-breaks.rb
200
209
  - test/test-protect.rb
210
+ - test/test-chart-axis.rb
201
211
  - test/test-print-area.rb
202
212
  - test/test-default-row.rb
203
213
  - test/test-set-selection.rb
204
214
  - test/test-chart-area.rb
205
215
  - test/run-test.rb
216
+ - test/test-chart-column.rb
206
217
  - test/test-types.rb
207
218
  - test/test-set-start-page.rb
219
+ - test/test-chart-pie.rb
208
220
  - test/test-repeat.rb
221
+ - test/test-chart-doughnut.rb
209
222
  - test/test-row-col-format.rb
210
223
  - test/test-escapes.rb
211
224
  - test/test-formatting.rb
@@ -215,14 +228,17 @@ test_files:
215
228
  - test/xlsx-func-testcase.rb
216
229
  - test/test-merge-range.rb
217
230
  - test/test-defined-name.rb
231
+ - test/test-chart-size.rb
218
232
  - test/test-hyperlink.rb
219
233
  - test/test-array-formula.rb
220
234
  - test/test-print-options.rb
221
235
  - test/test-optimize.rb
222
236
  - test/test-print-scale.rb
237
+ - test/test-chart-scatter.rb
223
238
  - test/test-misc.rb
224
239
  - test/test-autofilter.rb
225
240
  - test/test-panes.rb
241
+ - test/test-chart-title.rb
226
242
  - test/test-fit-to-pages.rb
227
243
  - test/test-properties.rb
228
244
  - test/test-data.rb