write_xlsx 0.81.0 → 0.81.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Changes +3 -0
- data/README.md +1 -1
- data/examples/a_simple.rb +0 -1
- data/examples/add_vba_project.rb +0 -1
- data/examples/array_formula.rb +0 -1
- data/examples/autofilter.rb +0 -1
- data/examples/chart_area.rb +0 -1
- data/examples/chart_bar.rb +0 -1
- data/examples/chart_data_table.rb +0 -1
- data/examples/chart_data_tools.rb +0 -1
- data/examples/chart_doughnut.rb +0 -1
- data/examples/chart_line.rb +0 -1
- data/examples/chart_pie.rb +0 -1
- data/examples/chart_radar.rb +0 -1
- data/examples/chart_scatter.rb +0 -1
- data/examples/chart_secondary_axis.rb +0 -1
- data/examples/chart_stock.rb +0 -1
- data/examples/colors.rb +0 -1
- data/examples/comments1.rb +0 -1
- data/examples/comments2.rb +0 -1
- data/examples/conditional_format.rb +0 -1
- data/examples/data_validate.rb +0 -1
- data/examples/date_time.rb +0 -1
- data/examples/defined_name.rb +0 -1
- data/examples/demo.rb +0 -1
- data/examples/diag_border.rb +0 -1
- data/examples/formats.rb +0 -1
- data/examples/headers.rb +0 -1
- data/examples/hide_row_col.rb +0 -1
- data/examples/hide_sheet.rb +0 -1
- data/examples/hyperlink1.rb +0 -1
- data/examples/indent.rb +0 -1
- data/examples/macros.rb +0 -1
- data/examples/merge1.rb +0 -1
- data/examples/merge2.rb +0 -1
- data/examples/merge3.rb +0 -1
- data/examples/merge4.rb +0 -1
- data/examples/merge5.rb +0 -1
- data/examples/merge6.rb +0 -1
- data/examples/outline.rb +0 -1
- data/examples/outline_collapsed.rb +0 -1
- data/examples/panes.rb +0 -1
- data/examples/properties.rb +0 -1
- data/examples/protection.rb +0 -1
- data/examples/regions.rb +0 -1
- data/examples/rich_strings.rb +0 -1
- data/examples/right_to_left.rb +0 -1
- data/examples/shape1.rb +0 -1
- data/examples/shape2.rb +0 -1
- data/examples/shape3.rb +0 -1
- data/examples/shape4.rb +0 -1
- data/examples/shape5.rb +0 -1
- data/examples/shape6.rb +0 -1
- data/examples/shape7.rb +0 -1
- data/examples/shape8.rb +0 -1
- data/examples/sparklines1.rb +0 -1
- data/examples/sparklines2.rb +0 -1
- data/examples/stats.rb +0 -1
- data/examples/stats_ext.rb +0 -1
- data/examples/stocks.rb +0 -1
- data/examples/tab_colors.rb +0 -1
- data/examples/tables.rb +0 -1
- data/lib/write_xlsx.rb +0 -1
- data/lib/write_xlsx/chart.rb +32 -5
- data/lib/write_xlsx/version.rb +1 -5
- data/test/helper.rb +1 -2
- data/test/regression/test_chart_gap04.rb +54 -0
- data/test/regression/test_chart_gap05.rb +56 -0
- data/test/regression/xlsx_files/chart_gap04.xlsx +0 -0
- data/test/regression/xlsx_files/chart_gap05.xlsx +0 -0
- data/write_xlsx.gemspec +3 -1
- metadata +27 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a47873b65edc4837593147baf4b03c8b7a0aca4c
|
4
|
+
data.tar.gz: 3b18363eaa6f1f1ac48a15c28dd39285202369bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30ff5c82ce5ede263bee14816a0b52463f60a5336641176dc6bca5669d244996790abbac68491ff1a028b11fa1466a87d86de3ef355e82307832b93cc5cddb5f
|
7
|
+
data.tar.gz: 48d97134f94f572573f1981da0c900a4ce1ac8dea0cf7cba35ccacdd8b27b30e06f61a3b86dae90f54b16999b0014bfa50505a36579ffa7a754099fa3f22e660
|
data/.gitignore
CHANGED
data/Changes
CHANGED
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
gem to create a new file in the Excel 2007+ XLSX format, and you can use the
|
6
6
|
same interface as writeexcel gem. write_xlsx is converted from Perl's module
|
7
|
-
[Excel::Writer::XLSX-0.
|
7
|
+
[Excel::Writer::XLSX-0.81](https://github.com/jmcnamara/excel-writer-xlsx) .
|
8
8
|
|
9
9
|
## Description
|
10
10
|
|
data/examples/a_simple.rb
CHANGED
data/examples/add_vba_project.rb
CHANGED
data/examples/array_formula.rb
CHANGED
data/examples/autofilter.rb
CHANGED
data/examples/chart_area.rb
CHANGED
data/examples/chart_bar.rb
CHANGED
data/examples/chart_doughnut.rb
CHANGED
data/examples/chart_line.rb
CHANGED
data/examples/chart_pie.rb
CHANGED
data/examples/chart_radar.rb
CHANGED
data/examples/chart_scatter.rb
CHANGED
data/examples/chart_stock.rb
CHANGED
data/examples/colors.rb
CHANGED
data/examples/comments1.rb
CHANGED
data/examples/comments2.rb
CHANGED
data/examples/data_validate.rb
CHANGED
data/examples/date_time.rb
CHANGED
data/examples/defined_name.rb
CHANGED
data/examples/demo.rb
CHANGED
data/examples/diag_border.rb
CHANGED
data/examples/formats.rb
CHANGED
data/examples/headers.rb
CHANGED
data/examples/hide_row_col.rb
CHANGED
data/examples/hide_sheet.rb
CHANGED
data/examples/hyperlink1.rb
CHANGED
data/examples/indent.rb
CHANGED
data/examples/macros.rb
CHANGED
data/examples/merge1.rb
CHANGED
data/examples/merge2.rb
CHANGED
data/examples/merge3.rb
CHANGED
data/examples/merge4.rb
CHANGED
data/examples/merge5.rb
CHANGED
data/examples/merge6.rb
CHANGED
data/examples/outline.rb
CHANGED
data/examples/panes.rb
CHANGED
data/examples/properties.rb
CHANGED
data/examples/protection.rb
CHANGED
data/examples/regions.rb
CHANGED
data/examples/rich_strings.rb
CHANGED
data/examples/right_to_left.rb
CHANGED
data/examples/shape1.rb
CHANGED
data/examples/shape2.rb
CHANGED
data/examples/shape3.rb
CHANGED
data/examples/shape4.rb
CHANGED
data/examples/shape5.rb
CHANGED
data/examples/shape6.rb
CHANGED
data/examples/shape7.rb
CHANGED
data/examples/shape8.rb
CHANGED
data/examples/sparklines1.rb
CHANGED
data/examples/sparklines2.rb
CHANGED
data/examples/stats.rb
CHANGED
data/examples/stats_ext.rb
CHANGED
data/examples/stocks.rb
CHANGED
data/examples/tab_colors.rb
CHANGED
data/examples/tables.rb
CHANGED
data/lib/write_xlsx.rb
CHANGED
data/lib/write_xlsx/chart.rb
CHANGED
@@ -241,9 +241,27 @@ def add_series(params)
|
|
241
241
|
|
242
242
|
@series << Series.new(self, params)
|
243
243
|
|
244
|
+
# Set the secondary axis properties.
|
245
|
+
x2_axis = params[:x2_axis]
|
246
|
+
y2_axis = params[:y2_axis]
|
247
|
+
|
244
248
|
# Set the gap and overlap for Bar/Column charts.
|
245
|
-
|
246
|
-
|
249
|
+
if params[:gap]
|
250
|
+
if ptrue?(y2_axis)
|
251
|
+
@series_gap_2 = params[:gap]
|
252
|
+
else
|
253
|
+
@series_gap_1 = params[:gap]
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
# Set the overlap for Bar/Column charts.
|
258
|
+
if params[:overlap]
|
259
|
+
if ptrue?(y2_axis)
|
260
|
+
@series_overlap_2 = params[:overlap]
|
261
|
+
else
|
262
|
+
@series_overlap_1 = params[:overlap]
|
263
|
+
end
|
264
|
+
end
|
247
265
|
end
|
248
266
|
|
249
267
|
#
|
@@ -428,7 +446,7 @@ def write_bar_chart(params) # :nodoc:
|
|
428
446
|
|
429
447
|
# Set a default overlap for stacked charts.
|
430
448
|
if @subtype =~ /stacked/
|
431
|
-
@
|
449
|
+
@series_overlap_1 = 100 unless @series_overlap_1
|
432
450
|
end
|
433
451
|
|
434
452
|
@writer.tag_elements('c:barChart') do
|
@@ -442,8 +460,17 @@ def write_bar_chart(params) # :nodoc:
|
|
442
460
|
# write the c:marker element.
|
443
461
|
write_marker_value
|
444
462
|
|
445
|
-
|
446
|
-
|
463
|
+
if ptrue?(params[:primary_axes])
|
464
|
+
# Write the c:gapWidth element.
|
465
|
+
write_gap_width(@series_gap_1)
|
466
|
+
# Write the c:overlap element.
|
467
|
+
write_overlap(@series_overlap_1)
|
468
|
+
else
|
469
|
+
# Write the c:gapWidth element.
|
470
|
+
write_gap_width(@series_gap_2)
|
471
|
+
# Write the c:overlap element.
|
472
|
+
write_overlap(@series_overlap_2)
|
473
|
+
end
|
447
474
|
|
448
475
|
# write the c:overlap element.
|
449
476
|
write_overlap(@series_overlap)
|
data/lib/write_xlsx/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
-
require 'rubygems'
|
3
2
|
require 'bundler'
|
4
3
|
|
5
4
|
begin
|
@@ -9,7 +8,7 @@
|
|
9
8
|
$stderr.puts "Run `bundle install` to install missing gems"
|
10
9
|
exit e.status_code
|
11
10
|
end
|
12
|
-
require 'test
|
11
|
+
require 'test-unit'
|
13
12
|
|
14
13
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
14
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartGap04 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_gap04
|
14
|
+
@xlsx = 'chart_gap04.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'column', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [45938176, 59715584])
|
21
|
+
chart.instance_variable_set(:@axis2_ids, [62526208, 59718272])
|
22
|
+
|
23
|
+
data = [
|
24
|
+
[1, 2, 3, 4, 5],
|
25
|
+
[6, 8, 6, 4, 2]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(
|
31
|
+
:values => '=Sheet1!$A$1:$A$5',
|
32
|
+
:gap => 51,
|
33
|
+
:overlap => 12
|
34
|
+
)
|
35
|
+
|
36
|
+
chart.add_series(
|
37
|
+
:values => '=Sheet1!$B$1:$B$5',
|
38
|
+
:y2_axis => 1,
|
39
|
+
:gap => 251,
|
40
|
+
:overlap => -27
|
41
|
+
)
|
42
|
+
|
43
|
+
worksheet.insert_chart('E9', chart)
|
44
|
+
|
45
|
+
workbook.close
|
46
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
47
|
+
[],
|
48
|
+
{
|
49
|
+
'xl/charts/chart1.xml' => ['<c:pageMargins'],
|
50
|
+
'xl/workbook.xml' => [ '<fileVersion' ]
|
51
|
+
}
|
52
|
+
)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
|
4
|
+
class TestRegressionChartGap05 < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
setup_dir_var
|
7
|
+
end
|
8
|
+
|
9
|
+
def teardown
|
10
|
+
File.delete(@xlsx) if File.exist?(@xlsx)
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_chart_gap05
|
14
|
+
@xlsx = 'chart_gap05.xlsx'
|
15
|
+
workbook = WriteXLSX.new(@xlsx)
|
16
|
+
worksheet = workbook.add_worksheet
|
17
|
+
chart = workbook.add_chart(:type => 'bar', :embedded => 1)
|
18
|
+
|
19
|
+
# For testing, copy the randomly generated axis ids in the target xlsx file.
|
20
|
+
chart.instance_variable_set(:@axis_ids, [45938176, 59715584])
|
21
|
+
chart.instance_variable_set(:@axis2_ids, [70848512, 54519680])
|
22
|
+
|
23
|
+
data = [
|
24
|
+
[1, 2, 3, 4, 5],
|
25
|
+
[6, 8, 6, 4, 2]
|
26
|
+
]
|
27
|
+
|
28
|
+
worksheet.write('A1', data)
|
29
|
+
|
30
|
+
chart.add_series(
|
31
|
+
:values => '=Sheet1!$A$1:$A$5',
|
32
|
+
:gap => 51,
|
33
|
+
:overlap => 12
|
34
|
+
)
|
35
|
+
|
36
|
+
chart.add_series(
|
37
|
+
:values => '=Sheet1!$B$1:$B$5',
|
38
|
+
:y2_axis => 1,
|
39
|
+
:gap => 251,
|
40
|
+
:overlap => -27
|
41
|
+
)
|
42
|
+
|
43
|
+
chart.set_x2_axis(:label_position => 'next_to')
|
44
|
+
|
45
|
+
worksheet.insert_chart('E9', chart)
|
46
|
+
|
47
|
+
workbook.close
|
48
|
+
compare_xlsx_for_regression(File.join(@regression_output, @xlsx), @xlsx,
|
49
|
+
[],
|
50
|
+
{
|
51
|
+
'xl/charts/chart1.xml' => ['<c:pageMargins'],
|
52
|
+
'xl/workbook.xml' => [ '<fileVersion' ]
|
53
|
+
}
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
Binary file
|
Binary file
|
data/write_xlsx.gemspec
CHANGED
@@ -5,12 +5,13 @@ require 'write_xlsx/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
7
|
gem.name = "write_xlsx"
|
8
|
-
gem.version =
|
8
|
+
gem.version = WriteXLSX_VERSION
|
9
9
|
gem.authors = ["Hideo NAKAMURA"]
|
10
10
|
gem.email = ["cxn03651@msj.biglobe.ne.jp"]
|
11
11
|
gem.description = "write_xlsx is a gem to create a new file in the Excel 2007+ XLSX format."
|
12
12
|
gem.summary = "write_xlsx is a gem to create a new file in the Excel 2007+ XLSX format."
|
13
13
|
gem.homepage = "http://github.com/cxn03651/write_xlsx#readme"
|
14
|
+
gem.license = 'MIT'
|
14
15
|
|
15
16
|
gem.files = `git ls-files`.split($/)
|
16
17
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -18,6 +19,7 @@ Gem::Specification.new do |gem|
|
|
18
19
|
gem.require_paths = ["lib"]
|
19
20
|
gem.add_runtime_dependency 'rubyzip', '>= 1.0.0'
|
20
21
|
gem.add_runtime_dependency 'zip-zip'
|
22
|
+
gem.add_development_dependency 'test-unit'
|
21
23
|
gem.extra_rdoc_files = [
|
22
24
|
"LICENSE.txt",
|
23
25
|
"README.md",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: write_xlsx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.81.
|
4
|
+
version: 0.81.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hideo NAKAMURA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: test-unit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: write_xlsx is a gem to create a new file in the Excel 2007+ XLSX format.
|
42
56
|
email:
|
43
57
|
- cxn03651@msj.biglobe.ne.jp
|
@@ -551,6 +565,8 @@ files:
|
|
551
565
|
- test/regression/test_chart_gap01.rb
|
552
566
|
- test/regression/test_chart_gap02.rb
|
553
567
|
- test/regression/test_chart_gap03.rb
|
568
|
+
- test/regression/test_chart_gap04.rb
|
569
|
+
- test/regression/test_chart_gap05.rb
|
554
570
|
- test/regression/test_chart_gridlines01.rb
|
555
571
|
- test/regression/test_chart_gridlines02.rb
|
556
572
|
- test/regression/test_chart_gridlines03.rb
|
@@ -1086,6 +1102,8 @@ files:
|
|
1086
1102
|
- test/regression/xlsx_files/chart_gap01.xlsx
|
1087
1103
|
- test/regression/xlsx_files/chart_gap02.xlsx
|
1088
1104
|
- test/regression/xlsx_files/chart_gap03.xlsx
|
1105
|
+
- test/regression/xlsx_files/chart_gap04.xlsx
|
1106
|
+
- test/regression/xlsx_files/chart_gap05.xlsx
|
1089
1107
|
- test/regression/xlsx_files/chart_gridlines01.xlsx
|
1090
1108
|
- test/regression/xlsx_files/chart_gridlines02.xlsx
|
1091
1109
|
- test/regression/xlsx_files/chart_gridlines03.xlsx
|
@@ -1539,7 +1557,8 @@ files:
|
|
1539
1557
|
- test/worksheet/test_write_worksheet_attributes.rb
|
1540
1558
|
- write_xlsx.gemspec
|
1541
1559
|
homepage: http://github.com/cxn03651/write_xlsx#readme
|
1542
|
-
licenses:
|
1560
|
+
licenses:
|
1561
|
+
- MIT
|
1543
1562
|
metadata: {}
|
1544
1563
|
post_install_message:
|
1545
1564
|
rdoc_options: []
|
@@ -1557,7 +1576,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1557
1576
|
version: '0'
|
1558
1577
|
requirements: []
|
1559
1578
|
rubyforge_project:
|
1560
|
-
rubygems_version: 2.4.
|
1579
|
+
rubygems_version: 2.4.5
|
1561
1580
|
signing_key:
|
1562
1581
|
specification_version: 4
|
1563
1582
|
summary: write_xlsx is a gem to create a new file in the Excel 2007+ XLSX format.
|
@@ -1944,6 +1963,8 @@ test_files:
|
|
1944
1963
|
- test/regression/test_chart_gap01.rb
|
1945
1964
|
- test/regression/test_chart_gap02.rb
|
1946
1965
|
- test/regression/test_chart_gap03.rb
|
1966
|
+
- test/regression/test_chart_gap04.rb
|
1967
|
+
- test/regression/test_chart_gap05.rb
|
1947
1968
|
- test/regression/test_chart_gridlines01.rb
|
1948
1969
|
- test/regression/test_chart_gridlines02.rb
|
1949
1970
|
- test/regression/test_chart_gridlines03.rb
|
@@ -2479,6 +2500,8 @@ test_files:
|
|
2479
2500
|
- test/regression/xlsx_files/chart_gap01.xlsx
|
2480
2501
|
- test/regression/xlsx_files/chart_gap02.xlsx
|
2481
2502
|
- test/regression/xlsx_files/chart_gap03.xlsx
|
2503
|
+
- test/regression/xlsx_files/chart_gap04.xlsx
|
2504
|
+
- test/regression/xlsx_files/chart_gap05.xlsx
|
2482
2505
|
- test/regression/xlsx_files/chart_gridlines01.xlsx
|
2483
2506
|
- test/regression/xlsx_files/chart_gridlines02.xlsx
|
2484
2507
|
- test/regression/xlsx_files/chart_gridlines03.xlsx
|