xlsxwriter 0.2.0.pre.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/ext/xlsxwriter/chart.c +2 -1
- data/ext/xlsxwriter/extconf.rb +1 -1
- data/ext/xlsxwriter/rich_string.c +2 -1
- data/ext/xlsxwriter/workbook.c +1 -0
- data/ext/xlsxwriter/worksheet.c +6 -3
- data/ext/xlsxwriter/xlsxwriter_ext.h +1 -1
- data/lib/xlsxwriter/version.rb +1 -1
- data/test/test-chart-legend.rb +67 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5952e238ec4dc55988d50bacd80e39132daca19f62ad8c6191705b240ad40cf1
|
4
|
+
data.tar.gz: '05824be3c90e0ebbf3a44df01034b3d300191ea8712cb7e4d24643aa68b0beef'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3733fc664a8e74657d194268b3b653a28bb886078fe92a35cdbcfefc1665d47add6117b35598726db1159caca7b983db0358f6e0c28be27a2a6d503b06fea81
|
7
|
+
data.tar.gz: 630f607d92e91c348b0a126f121242fcafd81bece774f642363b272c721c5d10d4a12ac8213290c7fbef1b8b4519f745c7ee6b5c364cc19a84fe26af256f8411
|
data/Rakefile
CHANGED
data/ext/xlsxwriter/chart.c
CHANGED
@@ -221,7 +221,8 @@ chart_legend_delete_series_(VALUE self, VALUE series) {
|
|
221
221
|
series = rb_check_array_type(series);
|
222
222
|
const size_t len = RARRAY_LEN(series);
|
223
223
|
int16_t series_arr[len+1];
|
224
|
-
|
224
|
+
size_t i;
|
225
|
+
for (i = 0; i < len; ++i) {
|
225
226
|
series_arr[i] = NUM2INT(rb_check_to_int(rb_ary_entry(series, i)));
|
226
227
|
}
|
227
228
|
series_arr[len] = -1;
|
data/ext/xlsxwriter/extconf.rb
CHANGED
@@ -7,7 +7,7 @@ raise 'Make failed for xlsxwriter' unless $? == 0
|
|
7
7
|
|
8
8
|
# enable_config('static', true)
|
9
9
|
# find_library('xlsxwriter', 'workbook_new', File.expand_path('../libxlsxwriter/lib', __FILE__))
|
10
|
-
$CFLAGS="-I'#{libxlsxwriter_dir}/include' -g -Wall -
|
10
|
+
$CFLAGS="-I'#{libxlsxwriter_dir}/include' -g -Wall -O2"
|
11
11
|
# $LDFLAGS="-L./libxlsxwriter/lib/ -Wl,-Bstatic -lxlsxwriter -Wl,-Bdynamic"
|
12
12
|
$LDFLAGS="-lz #{libxlsxwriter_dir}/lib/libxlsxwriter.a"
|
13
13
|
|
@@ -59,7 +59,8 @@ serialize_rich_string(VALUE rs) {
|
|
59
59
|
lxw_rich_string_tuple **res = *(lxw_rich_string_tuple ***)ptr;
|
60
60
|
|
61
61
|
lxw_rich_string_tuple *base_ptr = ((void *)*ptr + sizeof(lxw_rich_string_tuple *) * (len + 1));
|
62
|
-
|
62
|
+
int i;
|
63
|
+
for (i = 0; i < len; ++i) {
|
63
64
|
VALUE part = rb_ary_entry(arr, i);
|
64
65
|
VALUE text = rb_ary_entry(part, 0);
|
65
66
|
VALUE format = rb_ary_entry(part, 1);
|
data/ext/xlsxwriter/workbook.c
CHANGED
data/ext/xlsxwriter/worksheet.c
CHANGED
@@ -983,7 +983,8 @@ VALUE
|
|
983
983
|
worksheet_set_h_pagebreaks_(VALUE self, VALUE val) {
|
984
984
|
const size_t len = RARRAY_LEN(val);
|
985
985
|
lxw_row_t rows[len+1];
|
986
|
-
|
986
|
+
size_t i;
|
987
|
+
for (i = 0; i<len; ++i) {
|
987
988
|
rows[i] = NUM2INT(rb_ary_entry(val, i));
|
988
989
|
}
|
989
990
|
rows[len] = 0;
|
@@ -1003,7 +1004,8 @@ VALUE
|
|
1003
1004
|
worksheet_set_v_pagebreaks_(VALUE self, VALUE val) {
|
1004
1005
|
const size_t len = RARRAY_LEN(val);
|
1005
1006
|
lxw_col_t cols[len+1];
|
1006
|
-
|
1007
|
+
size_t i;
|
1008
|
+
for (i = 0; i<len; ++i) {
|
1007
1009
|
cols[i] = value_to_col(rb_ary_entry(val, i));
|
1008
1010
|
}
|
1009
1011
|
cols[len] = 0;
|
@@ -1422,9 +1424,10 @@ worksheet_data_validation_(int argc, VALUE *argv, VALUE self) {
|
|
1422
1424
|
#define parse_array_1(prefix) \
|
1423
1425
|
if (TYPE(val) == T_ARRAY) { \
|
1424
1426
|
int len = RARRAY_LEN(val); \
|
1427
|
+
int i; \
|
1425
1428
|
data_validation.prefix##_list = malloc(sizeof(char *) * (len + 1)); \
|
1426
1429
|
data_validation.prefix##_list[len] = NULL; \
|
1427
|
-
for (
|
1430
|
+
for (i = 0; i < len; ++i) { \
|
1428
1431
|
data_validation.prefix##_list[i] = RSTRING_PTR(rb_ary_entry(val, i)); \
|
1429
1432
|
} \
|
1430
1433
|
} else
|
@@ -6,7 +6,7 @@
|
|
6
6
|
extern VALUE mXlsxWriter;
|
7
7
|
extern VALUE eXlsxWriterError;
|
8
8
|
|
9
|
-
inline void handle_lxw_error(lxw_error err) {
|
9
|
+
static inline void handle_lxw_error(lxw_error err) {
|
10
10
|
if (err) {
|
11
11
|
rb_exc_raise(rb_funcall(eXlsxWriterError, rb_intern("new"), 2, rb_str_new_cstr(lxw_strerror(err)), INT2NUM(err)));
|
12
12
|
}
|
data/lib/xlsxwriter/version.rb
CHANGED
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative './xlsx-func-testcase'
|
4
|
+
|
5
|
+
class TestChartLegend < 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 'chart_legend01' do |wb|
|
15
|
+
wb.add_worksheet do |ws|
|
16
|
+
DATA.each { |row| ws.add_row row }
|
17
|
+
|
18
|
+
wb.add_chart(XlsxWriter::Workbook::Chart::COLUMN) do |chart|
|
19
|
+
chart.axis_id_1 = 54_461_952
|
20
|
+
chart.axis_id_2 = 54_463_872
|
21
|
+
|
22
|
+
chart.add_series '=Sheet1!$A$1:$A$5'
|
23
|
+
chart.add_series '=Sheet1!$B$1:$B$5'
|
24
|
+
chart.add_series '=Sheet1!$C$1:$C$5'
|
25
|
+
chart.legend_position = XlsxWriter::Workbook::Chart::LEGEND_NONE
|
26
|
+
|
27
|
+
ws.insert_chart 'E9', chart
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
test 'chart_legend03' do |wb|
|
33
|
+
wb.add_worksheet do |ws|
|
34
|
+
DATA.each { |row| ws.add_row row }
|
35
|
+
|
36
|
+
wb.add_chart(XlsxWriter::Workbook::Chart::LINE) do |chart|
|
37
|
+
chart.axis_id_1 = 93_548_928
|
38
|
+
chart.axis_id_2 = 93_550_464
|
39
|
+
|
40
|
+
chart.add_series '=Sheet1!$A$1:$A$5'
|
41
|
+
chart.add_series '=Sheet1!$B$1:$B$5'
|
42
|
+
chart.add_series '=Sheet1!$C$1:$C$5'
|
43
|
+
chart.legend_position = XlsxWriter::Workbook::Chart::LEGEND_TOP_RIGHT
|
44
|
+
|
45
|
+
ws.insert_chart 'E9', chart
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
test 'chart_legend04' do |wb|
|
51
|
+
wb.add_worksheet do |ws|
|
52
|
+
DATA.each { |row| ws.add_row row }
|
53
|
+
|
54
|
+
wb.add_chart(XlsxWriter::Workbook::Chart::LINE) do |chart|
|
55
|
+
chart.axis_id_1 = 93_548_928
|
56
|
+
chart.axis_id_2 = 93_550_464
|
57
|
+
|
58
|
+
chart.add_series '=Sheet1!$A$1:$A$5'
|
59
|
+
chart.add_series '=Sheet1!$B$1:$B$5'
|
60
|
+
chart.add_series '=Sheet1!$C$1:$C$5'
|
61
|
+
chart.legend_position = XlsxWriter::Workbook::Chart::LEGEND_OVERLAY_TOP_RIGHT
|
62
|
+
|
63
|
+
ws.insert_chart 'E9', chart
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
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.0
|
4
|
+
version: 0.2.0
|
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-04-
|
11
|
+
date: 2019-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -154,6 +154,7 @@ files:
|
|
154
154
|
- test/test-chart-bar.rb
|
155
155
|
- test/test-chart-column.rb
|
156
156
|
- test/test-chart-doughnut.rb
|
157
|
+
- test/test-chart-legend.rb
|
157
158
|
- test/test-chart-pie.rb
|
158
159
|
- test/test-chart-scatter.rb
|
159
160
|
- test/test-chart-size.rb
|
@@ -205,9 +206,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
206
|
version: '0'
|
206
207
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
208
|
requirements:
|
208
|
-
- - "
|
209
|
+
- - ">="
|
209
210
|
- !ruby/object:Gem::Version
|
210
|
-
version:
|
211
|
+
version: '0'
|
211
212
|
requirements: []
|
212
213
|
rubygems_version: 3.0.3
|
213
214
|
signing_key:
|
@@ -220,6 +221,7 @@ test_files:
|
|
220
221
|
- test/test-page-breaks.rb
|
221
222
|
- test/test-protect.rb
|
222
223
|
- test/test-ruby-worksheet.rb
|
224
|
+
- test/test-chart-legend.rb
|
223
225
|
- test/test-chart-axis.rb
|
224
226
|
- test/test-print-area.rb
|
225
227
|
- test/test-default-row.rb
|