xlsxwriter 0.0.3 → 0.0.4.pre.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/xlsxwriter/libxlsxwriter/{LICENSE.txt → License.txt} +64 -3
- data/ext/xlsxwriter/libxlsxwriter/Makefile +42 -7
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +2 -2
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +2481 -97
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +41 -2
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +5 -5
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +8 -3
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +1 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +2 -2
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +381 -1
- data/ext/xlsxwriter/libxlsxwriter/src/Makefile +25 -5
- data/ext/xlsxwriter/libxlsxwriter/src/app.c +17 -13
- data/ext/xlsxwriter/libxlsxwriter/src/chart.c +3903 -976
- data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +18 -14
- data/ext/xlsxwriter/libxlsxwriter/src/core.c +9 -9
- data/ext/xlsxwriter/libxlsxwriter/src/format.c +2 -2
- data/ext/xlsxwriter/libxlsxwriter/src/packager.c +179 -95
- data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +11 -8
- data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +2 -0
- data/ext/xlsxwriter/libxlsxwriter/src/styles.c +10 -8
- data/ext/xlsxwriter/libxlsxwriter/src/utility.c +18 -1
- data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +41 -25
- data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +672 -42
- data/ext/xlsxwriter/libxlsxwriter/third_party/minizip/Makefile +6 -1
- data/lib/xlsxwriter/version.rb +1 -1
- data/lib/xlsxwriter/worksheet.rb +11 -5
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 839412a8decaf536e0038b052d1011decb97def0
|
4
|
+
data.tar.gz: b0f75509d82602b093b07a2eb82309b0da97d595
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a664d20a84b92fa12ff13bc6f8ef8505a6c403aacc9909ca69954480e6d7fd3913939a817d96bf90a69170b74a812704a76af5be1021c43561de31ae263bfe2
|
7
|
+
data.tar.gz: e348114d307aa35244210e9b62f8cd3e89b38b9dd25f9724de94e17c9226393da5021a72d22e121196a20d6777fad5058708167fd9e62175713f49d3a3ce740f
|
@@ -1,3 +1,6 @@
|
|
1
|
+
/**
|
2
|
+
|
3
|
+
@page license License
|
1
4
|
|
2
5
|
Libxlsxwriter is released under a FreeBSD license:
|
3
6
|
|
@@ -31,8 +34,8 @@ Libxlsxwriter is released under a FreeBSD license:
|
|
31
34
|
official policies, either expressed or implied, of the FreeBSD Project.
|
32
35
|
|
33
36
|
|
34
|
-
Libxlsxwriter includes `queue.h` from FreeBSD
|
35
|
-
`zlib` which have the following licenses:
|
37
|
+
Libxlsxwriter includes `queue.h` and `tree.h` from FreeBSD, the `minizip`
|
38
|
+
component of `zlib` and `tmpfileplus` which have the following licenses:
|
36
39
|
|
37
40
|
|
38
41
|
Queue.h from FreeBSD:
|
@@ -65,7 +68,35 @@ Queue.h from FreeBSD:
|
|
65
68
|
SUCH DAMAGE.
|
66
69
|
|
67
70
|
|
68
|
-
|
71
|
+
Tree.h from FreeBSD:
|
72
|
+
|
73
|
+
Copyright 2002 Niels Provos <provos@citi.umich.edu>
|
74
|
+
All rights reserved.
|
75
|
+
|
76
|
+
Redistribution and use in source and binary forms, with or without
|
77
|
+
modification, are permitted provided that the following conditions
|
78
|
+
are met:
|
79
|
+
1. Redistributions of source code must retain the above copyright
|
80
|
+
notice, this list of conditions and the following disclaimer.
|
81
|
+
2. Redistributions in binary form must reproduce the above copyright
|
82
|
+
notice, this list of conditions and the following disclaimer in the
|
83
|
+
documentation and/or other materials provided with the distribution.
|
84
|
+
|
85
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
86
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
87
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
88
|
+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
89
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
90
|
+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
91
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
92
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
93
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
94
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
95
|
+
|
96
|
+
|
97
|
+
The `minizip` files used in the libxlsxwriter source tree are taken from the
|
98
|
+
`zlib` ` contrib/minizip` directory. [Zlib](http://www.zlib.net) has the
|
99
|
+
following License/Copyright:
|
69
100
|
|
70
101
|
(C) 1995-2013 Jean-loup Gailly and Mark Adler
|
71
102
|
|
@@ -87,3 +118,33 @@ Zlib has the following License/Copyright:
|
|
87
118
|
|
88
119
|
Jean-loup Gailly Mark Adler
|
89
120
|
jloup@gzip.org madler@alumni.caltech.edu
|
121
|
+
|
122
|
+
The `minizip` files have the following additional copyright declarations:
|
123
|
+
|
124
|
+
Copyright (C) 1998-2010 Gilles Vollant
|
125
|
+
(minizip) ( http://www.winimage.com/zLibDll/minizip.html )
|
126
|
+
|
127
|
+
Modifications for Zip64 support
|
128
|
+
Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com )
|
129
|
+
|
130
|
+
Note, it is possible to compile libxlsxwriter without statically linking the
|
131
|
+
`minizip` files and instead dynamically linking to `lminizip`, see
|
132
|
+
@ref gsg_minizip.
|
133
|
+
|
134
|
+
[Tmpfileplus](http://www.di-mgt.com.au/c_function_to_create_temp_file.html)
|
135
|
+
has the following license:
|
136
|
+
|
137
|
+
This Source Code Form is subject to the terms of the Mozilla Public
|
138
|
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
139
|
+
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
140
|
+
|
141
|
+
Copyright (c) 2012-16 David Ireland, DI Management Services Pty Ltd
|
142
|
+
<http://www.di-mgt.com.au/contact/>.
|
143
|
+
|
144
|
+
See the [Mozilla Public License, v. 2.0](http://mozilla.org/MPL/2.0/).
|
145
|
+
|
146
|
+
Note, it is possible to compile libxlsxwriter using the standard library
|
147
|
+
`tmpfile()` function instead of `tmpfileplus`, see @ref gsg_tmpdir.
|
148
|
+
|
149
|
+
Next: @ref changes
|
150
|
+
*/
|
@@ -11,11 +11,15 @@ ifdef V
|
|
11
11
|
Q=
|
12
12
|
endif
|
13
13
|
|
14
|
+
INSTALL_DIR ?= /usr/local
|
15
|
+
|
14
16
|
.PHONY: docs tags examples
|
15
17
|
|
16
18
|
# Build the libs.
|
17
19
|
all :
|
20
|
+
ifndef USE_SYSTEM_MINIZIP
|
18
21
|
$(Q)$(MAKE) -C third_party/minizip
|
22
|
+
endif
|
19
23
|
ifndef USE_STANDARD_TMPFILE
|
20
24
|
$(Q)$(MAKE) -C third_party/tmpfileplus
|
21
25
|
endif
|
@@ -31,11 +35,13 @@ clean :
|
|
31
35
|
$(Q)$(MAKE) clean -C test/unit
|
32
36
|
$(Q)$(MAKE) clean -C test/functional/src
|
33
37
|
$(Q)$(MAKE) clean -C examples
|
34
|
-
$(Q)$(MAKE) clean -C third_party/minizip
|
35
38
|
$(Q)rm -rf docs/html
|
36
39
|
$(Q)rm -rf test/functional/__pycache__
|
37
40
|
$(Q)rm -f test/functional/*.pyc
|
38
41
|
$(Q)rm -f lib/*
|
42
|
+
ifndef USE_STANDARD_TMPFILE
|
43
|
+
$(Q)$(MAKE) clean -C third_party/minizip
|
44
|
+
endif
|
39
45
|
ifndef USE_STANDARD_TMPFILE
|
40
46
|
$(Q)$(MAKE) clean -C third_party/tmpfileplus
|
41
47
|
endif
|
@@ -43,6 +49,12 @@ endif
|
|
43
49
|
# Run the unit tests.
|
44
50
|
test : all test_functional test_unit
|
45
51
|
|
52
|
+
# Test for C++ const correctness on APIs.
|
53
|
+
test_const : all
|
54
|
+
$(Q)$(MAKE) clean -C test/functional/src
|
55
|
+
$(Q)! $(MAKE) -C test/functional/src CFLAGS=-Wwrite-strings 2>&1 | grep -A 1 "note:"
|
56
|
+
|
57
|
+
|
46
58
|
# Run the functional tests.
|
47
59
|
test_functional : all
|
48
60
|
$(Q)$(MAKE) -C test/functional/src
|
@@ -51,7 +63,9 @@ test_functional : all
|
|
51
63
|
# Run all tests.
|
52
64
|
test_unit :
|
53
65
|
@echo "Compiling unit tests ..."
|
66
|
+
ifndef USE_SYSTEM_MINIZIP
|
54
67
|
$(Q)$(MAKE) -C third_party/minizip
|
68
|
+
endif
|
55
69
|
ifndef USE_STANDARD_TMPFILE
|
56
70
|
$(Q)$(MAKE) -C third_party/tmpfileplus
|
57
71
|
endif
|
@@ -83,14 +97,16 @@ docs:
|
|
83
97
|
$(Q)$(MAKE) -C docs
|
84
98
|
|
85
99
|
# Simple minded install.
|
86
|
-
install:
|
87
|
-
$(Q)
|
88
|
-
$(Q)cp
|
100
|
+
install: all
|
101
|
+
$(Q)mkdir -p $(INSTALL_DIR)/include
|
102
|
+
$(Q)cp -R include/* $(INSTALL_DIR)/include
|
103
|
+
$(Q)mkdir -p $(INSTALL_DIR)/lib
|
104
|
+
$(Q)cp lib/* $(INSTALL_DIR)/lib
|
89
105
|
|
90
106
|
# Simpler minded uninstall.
|
91
107
|
uninstall:
|
92
|
-
$(Q)rm -rf /
|
93
|
-
$(Q)rm
|
108
|
+
$(Q)rm -rf $(INSTALL_DIR)/include/xlsxwriter*
|
109
|
+
$(Q)rm $(INSTALL_DIR)/lib/libxlsxwriter.*
|
94
110
|
|
95
111
|
# Strip the lib files.
|
96
112
|
strip:
|
@@ -98,16 +114,35 @@ strip:
|
|
98
114
|
|
99
115
|
# Run a coverity static analysis.
|
100
116
|
coverity:
|
117
|
+
ifndef USE_SYSTEM_MINIZIP
|
101
118
|
$(Q)$(MAKE) -C third_party/minizip
|
119
|
+
endif
|
120
|
+
ifndef USE_STANDARD_TMPFILE
|
121
|
+
$(Q)$(MAKE) -C third_party/tmpfileplus
|
122
|
+
endif
|
102
123
|
$(Q)$(MAKE) -C src clean
|
103
124
|
$(Q)rm -f lib/*
|
104
125
|
$(Q)rm -rf cov-int
|
105
126
|
$(Q)rm -f libxlsxwriter-coverity.tgz
|
106
|
-
$(Q)
|
127
|
+
$(Q)../../cov-analysis-linux64-8.7.0/bin/cov-build --dir cov-int make -C src libxlsxwriter.a
|
107
128
|
$(Q)tar -czf libxlsxwriter-coverity.tgz cov-int
|
108
129
|
$(Q)$(MAKE) -C src clean
|
109
130
|
$(Q)rm -f lib/*
|
110
131
|
|
132
|
+
# Run a scan-build static analysis.
|
133
|
+
scan_build:
|
134
|
+
ifndef USE_SYSTEM_MINIZIP
|
135
|
+
$(Q)$(MAKE) -C third_party/minizip
|
136
|
+
endif
|
137
|
+
ifndef USE_STANDARD_TMPFILE
|
138
|
+
$(Q)$(MAKE) -C third_party/tmpfileplus
|
139
|
+
endif
|
140
|
+
$(Q)$(MAKE) -C src clean
|
141
|
+
$(Q)rm -f lib/*
|
142
|
+
$(Q)scan-build make -C src libxlsxwriter.a
|
143
|
+
$(Q)$(MAKE) -C src clean
|
144
|
+
$(Q)rm -f lib/*
|
145
|
+
|
111
146
|
spellcheck:
|
112
147
|
$(Q)for f in docs/src/*.dox; do aspell --lang=en_US --check $$f; done
|
113
148
|
$(Q)for f in include/xlsxwriter/*.h; do aspell --lang=en_US --check $$f; done
|
@@ -11,8 +11,8 @@
|
|
11
11
|
|
12
12
|
#include <stdint.h>
|
13
13
|
#include <string.h>
|
14
|
-
#include "
|
15
|
-
#include "
|
14
|
+
#include "workbook.h"
|
15
|
+
#include "common.h"
|
16
16
|
|
17
17
|
/* Define the queue.h TAILQ structs for the App structs. */
|
18
18
|
STAILQ_HEAD(lxw_heading_pairs, lxw_heading_pair);
|
@@ -81,8 +81,11 @@ STAILQ_HEAD(lxw_chart_series_list, lxw_chart_series);
|
|
81
81
|
STAILQ_HEAD(lxw_series_data_points, lxw_series_data_point);
|
82
82
|
|
83
83
|
#define LXW_CHART_NUM_FORMAT_LEN 128
|
84
|
+
#define LXW_CHART_DEFAULT_GAP 501
|
84
85
|
|
85
|
-
/**
|
86
|
+
/**
|
87
|
+
* @brief Available chart types.
|
88
|
+
*/
|
86
89
|
typedef enum lxw_chart_type {
|
87
90
|
|
88
91
|
/** None. */
|
@@ -149,7 +152,9 @@ typedef enum lxw_chart_type {
|
|
149
152
|
LXW_CHART_RADAR_FILLED
|
150
153
|
} lxw_chart_type;
|
151
154
|
|
152
|
-
/**
|
155
|
+
/**
|
156
|
+
* @brief Chart legend positions.
|
157
|
+
*/
|
153
158
|
typedef enum lxw_chart_legend_position {
|
154
159
|
|
155
160
|
/** No chart legend. */
|
@@ -174,7 +179,8 @@ typedef enum lxw_chart_legend_position {
|
|
174
179
|
LXW_CHART_LEGEND_OVERLAY_LEFT
|
175
180
|
} lxw_chart_legend_position;
|
176
181
|
|
177
|
-
/**
|
182
|
+
/**
|
183
|
+
* @brief Chart line dash types.
|
178
184
|
*
|
179
185
|
* The dash types are shown in the order that they appear in the Excel dialog.
|
180
186
|
* See @ref chart_lines.
|
@@ -209,8 +215,254 @@ typedef enum lxw_chart_line_dash_type {
|
|
209
215
|
LXW_CHART_LINE_DASH_DOT,
|
210
216
|
LXW_CHART_LINE_DASH_SYSTEM_DASH_DOT,
|
211
217
|
LXW_CHART_LINE_DASH_SYSTEM_DASH_DOT_DOT
|
218
|
+
} lxw_chart_line_dash_type;
|
219
|
+
|
220
|
+
/**
|
221
|
+
* @brief Chart marker types.
|
222
|
+
*/
|
223
|
+
typedef enum lxw_chart_marker_type {
|
224
|
+
|
225
|
+
/** Automatic, series default, marker type. */
|
226
|
+
LXW_CHART_MARKER_AUTOMATIC,
|
227
|
+
|
228
|
+
/** No marker type. */
|
229
|
+
LXW_CHART_MARKER_NONE,
|
230
|
+
|
231
|
+
/** Square marker type. */
|
232
|
+
LXW_CHART_MARKER_SQUARE,
|
233
|
+
|
234
|
+
/** Diamond marker type. */
|
235
|
+
LXW_CHART_MARKER_DIAMOND,
|
236
|
+
|
237
|
+
/** Triangle marker type. */
|
238
|
+
LXW_CHART_MARKER_TRIANGLE,
|
239
|
+
|
240
|
+
/** X shape marker type. */
|
241
|
+
LXW_CHART_MARKER_X,
|
242
|
+
|
243
|
+
/** Star marker type. */
|
244
|
+
LXW_CHART_MARKER_STAR,
|
245
|
+
|
246
|
+
/** Short dash marker type. */
|
247
|
+
LXW_CHART_MARKER_SHORT_DASH,
|
248
|
+
|
249
|
+
/** Long dash marker type. */
|
250
|
+
LXW_CHART_MARKER_LONG_DASH,
|
251
|
+
|
252
|
+
/** Circle marker type. */
|
253
|
+
LXW_CHART_MARKER_CIRCLE,
|
254
|
+
|
255
|
+
/** Plus (+) marker type. */
|
256
|
+
LXW_CHART_MARKER_PLUS
|
257
|
+
} lxw_chart_marker_type;
|
258
|
+
|
259
|
+
/**
|
260
|
+
* @brief Chart pattern types.
|
261
|
+
*/
|
262
|
+
typedef enum lxw_chart_pattern_type {
|
263
|
+
|
264
|
+
/** None pattern. */
|
265
|
+
LXW_CHART_PATTERN_NONE,
|
266
|
+
|
267
|
+
/** 5 Percent pattern. */
|
268
|
+
LXW_CHART_PATTERN_PERCENT_5,
|
269
|
+
|
270
|
+
/** 10 Percent pattern. */
|
271
|
+
LXW_CHART_PATTERN_PERCENT_10,
|
272
|
+
|
273
|
+
/** 20 Percent pattern. */
|
274
|
+
LXW_CHART_PATTERN_PERCENT_20,
|
275
|
+
|
276
|
+
/** 25 Percent pattern. */
|
277
|
+
LXW_CHART_PATTERN_PERCENT_25,
|
278
|
+
|
279
|
+
/** 30 Percent pattern. */
|
280
|
+
LXW_CHART_PATTERN_PERCENT_30,
|
281
|
+
|
282
|
+
/** 40 Percent pattern. */
|
283
|
+
LXW_CHART_PATTERN_PERCENT_40,
|
284
|
+
|
285
|
+
/** 50 Percent pattern. */
|
286
|
+
LXW_CHART_PATTERN_PERCENT_50,
|
287
|
+
|
288
|
+
/** 60 Percent pattern. */
|
289
|
+
LXW_CHART_PATTERN_PERCENT_60,
|
290
|
+
|
291
|
+
/** 70 Percent pattern. */
|
292
|
+
LXW_CHART_PATTERN_PERCENT_70,
|
293
|
+
|
294
|
+
/** 75 Percent pattern. */
|
295
|
+
LXW_CHART_PATTERN_PERCENT_75,
|
296
|
+
|
297
|
+
/** 80 Percent pattern. */
|
298
|
+
LXW_CHART_PATTERN_PERCENT_80,
|
299
|
+
|
300
|
+
/** 90 Percent pattern. */
|
301
|
+
LXW_CHART_PATTERN_PERCENT_90,
|
302
|
+
|
303
|
+
/** Light downward diagonal pattern. */
|
304
|
+
LXW_CHART_PATTERN_LIGHT_DOWNWARD_DIAGONAL,
|
305
|
+
|
306
|
+
/** Light upward diagonal pattern. */
|
307
|
+
LXW_CHART_PATTERN_LIGHT_UPWARD_DIAGONAL,
|
308
|
+
|
309
|
+
/** Dark downward diagonal pattern. */
|
310
|
+
LXW_CHART_PATTERN_DARK_DOWNWARD_DIAGONAL,
|
311
|
+
|
312
|
+
/** Dark upward diagonal pattern. */
|
313
|
+
LXW_CHART_PATTERN_DARK_UPWARD_DIAGONAL,
|
314
|
+
|
315
|
+
/** Wide downward diagonal pattern. */
|
316
|
+
LXW_CHART_PATTERN_WIDE_DOWNWARD_DIAGONAL,
|
317
|
+
|
318
|
+
/** Wide upward diagonal pattern. */
|
319
|
+
LXW_CHART_PATTERN_WIDE_UPWARD_DIAGONAL,
|
320
|
+
|
321
|
+
/** Light vertical pattern. */
|
322
|
+
LXW_CHART_PATTERN_LIGHT_VERTICAL,
|
323
|
+
|
324
|
+
/** Light horizontal pattern. */
|
325
|
+
LXW_CHART_PATTERN_LIGHT_HORIZONTAL,
|
326
|
+
|
327
|
+
/** Narrow vertical pattern. */
|
328
|
+
LXW_CHART_PATTERN_NARROW_VERTICAL,
|
329
|
+
|
330
|
+
/** Narrow horizontal pattern. */
|
331
|
+
LXW_CHART_PATTERN_NARROW_HORIZONTAL,
|
332
|
+
|
333
|
+
/** Dark vertical pattern. */
|
334
|
+
LXW_CHART_PATTERN_DARK_VERTICAL,
|
335
|
+
|
336
|
+
/** Dark horizontal pattern. */
|
337
|
+
LXW_CHART_PATTERN_DARK_HORIZONTAL,
|
338
|
+
|
339
|
+
/** Dashed downward diagonal pattern. */
|
340
|
+
LXW_CHART_PATTERN_DASHED_DOWNWARD_DIAGONAL,
|
341
|
+
|
342
|
+
/** Dashed upward diagonal pattern. */
|
343
|
+
LXW_CHART_PATTERN_DASHED_UPWARD_DIAGONAL,
|
344
|
+
|
345
|
+
/** Dashed horizontal pattern. */
|
346
|
+
LXW_CHART_PATTERN_DASHED_HORIZONTAL,
|
347
|
+
|
348
|
+
/** Dashed vertical pattern. */
|
349
|
+
LXW_CHART_PATTERN_DASHED_VERTICAL,
|
350
|
+
|
351
|
+
/** Small confetti pattern. */
|
352
|
+
LXW_CHART_PATTERN_SMALL_CONFETTI,
|
353
|
+
|
354
|
+
/** Large confetti pattern. */
|
355
|
+
LXW_CHART_PATTERN_LARGE_CONFETTI,
|
356
|
+
|
357
|
+
/** Zigzag pattern. */
|
358
|
+
LXW_CHART_PATTERN_ZIGZAG,
|
359
|
+
|
360
|
+
/** Wave pattern. */
|
361
|
+
LXW_CHART_PATTERN_WAVE,
|
362
|
+
|
363
|
+
/** Diagonal brick pattern. */
|
364
|
+
LXW_CHART_PATTERN_DIAGONAL_BRICK,
|
365
|
+
|
366
|
+
/** Horizontal brick pattern. */
|
367
|
+
LXW_CHART_PATTERN_HORIZONTAL_BRICK,
|
368
|
+
|
369
|
+
/** Weave pattern. */
|
370
|
+
LXW_CHART_PATTERN_WEAVE,
|
371
|
+
|
372
|
+
/** Plaid pattern. */
|
373
|
+
LXW_CHART_PATTERN_PLAID,
|
374
|
+
|
375
|
+
/** Divot pattern. */
|
376
|
+
LXW_CHART_PATTERN_DIVOT,
|
377
|
+
|
378
|
+
/** Dotted grid pattern. */
|
379
|
+
LXW_CHART_PATTERN_DOTTED_GRID,
|
380
|
+
|
381
|
+
/** Dotted diamond pattern. */
|
382
|
+
LXW_CHART_PATTERN_DOTTED_DIAMOND,
|
383
|
+
|
384
|
+
/** Shingle pattern. */
|
385
|
+
LXW_CHART_PATTERN_SHINGLE,
|
386
|
+
|
387
|
+
/** Trellis pattern. */
|
388
|
+
LXW_CHART_PATTERN_TRELLIS,
|
212
389
|
|
213
|
-
|
390
|
+
/** Sphere pattern. */
|
391
|
+
LXW_CHART_PATTERN_SPHERE,
|
392
|
+
|
393
|
+
/** Small grid pattern. */
|
394
|
+
LXW_CHART_PATTERN_SMALL_GRID,
|
395
|
+
|
396
|
+
/** Large grid pattern. */
|
397
|
+
LXW_CHART_PATTERN_LARGE_GRID,
|
398
|
+
|
399
|
+
/** Small check pattern. */
|
400
|
+
LXW_CHART_PATTERN_SMALL_CHECK,
|
401
|
+
|
402
|
+
/** Large check pattern. */
|
403
|
+
LXW_CHART_PATTERN_LARGE_CHECK,
|
404
|
+
|
405
|
+
/** Outlined diamond pattern. */
|
406
|
+
LXW_CHART_PATTERN_OUTLINED_DIAMOND,
|
407
|
+
|
408
|
+
/** Solid diamond pattern. */
|
409
|
+
LXW_CHART_PATTERN_SOLID_DIAMOND
|
410
|
+
} lxw_chart_pattern_type;
|
411
|
+
|
412
|
+
/**
|
413
|
+
* @brief Chart data label positions.
|
414
|
+
*/
|
415
|
+
typedef enum lxw_chart_label_position {
|
416
|
+
/** Series data label position: default position. */
|
417
|
+
LXW_CHART_LABEL_POSITION_DEFAULT,
|
418
|
+
|
419
|
+
/** Series data label position: center. */
|
420
|
+
LXW_CHART_LABEL_POSITION_CENTER,
|
421
|
+
|
422
|
+
/** Series data label position: right. */
|
423
|
+
LXW_CHART_LABEL_POSITION_RIGHT,
|
424
|
+
|
425
|
+
/** Series data label position: left. */
|
426
|
+
LXW_CHART_LABEL_POSITION_LEFT,
|
427
|
+
|
428
|
+
/** Series data label position: above. */
|
429
|
+
LXW_CHART_LABEL_POSITION_ABOVE,
|
430
|
+
|
431
|
+
/** Series data label position: below. */
|
432
|
+
LXW_CHART_LABEL_POSITION_BELOW,
|
433
|
+
|
434
|
+
/** Series data label position: inside base. */
|
435
|
+
LXW_CHART_LABEL_POSITION_INSIDE_BASE,
|
436
|
+
|
437
|
+
/** Series data label position: inside end. */
|
438
|
+
LXW_CHART_LABEL_POSITION_INSIDE_END,
|
439
|
+
|
440
|
+
/** Series data label position: outside end. */
|
441
|
+
LXW_CHART_LABEL_POSITION_OUTSIDE_END,
|
442
|
+
|
443
|
+
/** Series data label position: best fit. */
|
444
|
+
LXW_CHART_LABEL_POSITION_BEST_FIT
|
445
|
+
} lxw_chart_label_position;
|
446
|
+
|
447
|
+
/**
|
448
|
+
* @brief Chart data label separator.
|
449
|
+
*/
|
450
|
+
typedef enum lxw_chart_label_separator {
|
451
|
+
/** Series data label separator: comma (the default). */
|
452
|
+
LXW_CHART_LABEL_SEPARATOR_COMMA,
|
453
|
+
|
454
|
+
/** Series data label separator: semicolon. */
|
455
|
+
LXW_CHART_LABEL_SEPARATOR_SEMICOLON,
|
456
|
+
|
457
|
+
/** Series data label separator: period. */
|
458
|
+
LXW_CHART_LABEL_SEPARATOR_PERIOD,
|
459
|
+
|
460
|
+
/** Series data label separator: newline. */
|
461
|
+
LXW_CHART_LABEL_SEPARATOR_NEWLINE,
|
462
|
+
|
463
|
+
/** Series data label separator: space. */
|
464
|
+
LXW_CHART_LABEL_SEPARATOR_SPACE
|
465
|
+
} lxw_chart_label_separator;
|
214
466
|
|
215
467
|
enum lxw_chart_subtype {
|
216
468
|
|
@@ -226,17 +478,96 @@ enum lxw_chart_grouping {
|
|
226
478
|
LXW_GROUPING_STACKED
|
227
479
|
};
|
228
480
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
481
|
+
/**
|
482
|
+
* @brief Axis positions for category axes.
|
483
|
+
*/
|
484
|
+
typedef enum lxw_chart_axis_tick_position {
|
233
485
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
486
|
+
LXW_CHART_AXIS_POSITION_DEFAULT,
|
487
|
+
|
488
|
+
/** Position category axis on tick marks. */
|
489
|
+
LXW_CHART_AXIS_POSITION_ON_TICK,
|
490
|
+
|
491
|
+
/** Position category axis between tick marks. */
|
492
|
+
LXW_CHART_AXIS_POSITION_BETWEEN
|
493
|
+
} lxw_chart_axis_tick_position;
|
494
|
+
|
495
|
+
/**
|
496
|
+
* @brief Axis label positions.
|
497
|
+
*/
|
498
|
+
typedef enum lxw_chart_axis_label_position {
|
499
|
+
|
500
|
+
/** Position the axis labels next to the axis. The default. */
|
501
|
+
LXW_CHART_AXIS_LABEL_POSITION_NEXT_TO,
|
502
|
+
|
503
|
+
/** Position the axis labels at the top of the chart, for horizontal
|
504
|
+
* axes, or to the right for vertical axes.*/
|
505
|
+
LXW_CHART_AXIS_LABEL_POSITION_HIGH,
|
506
|
+
|
507
|
+
/** Position the axis labels at the bottom of the chart, for horizontal
|
508
|
+
* axes, or to the left for vertical axes.*/
|
509
|
+
LXW_CHART_AXIS_LABEL_POSITION_LOW,
|
510
|
+
|
511
|
+
/** Turn off the the axis labels. */
|
512
|
+
LXW_CHART_AXIS_LABEL_POSITION_NONE
|
513
|
+
} lxw_chart_axis_label_position;
|
514
|
+
|
515
|
+
/**
|
516
|
+
* @brief Display units for chart value axis.
|
517
|
+
*/
|
518
|
+
typedef enum lxw_chart_axis_display_unit {
|
519
|
+
|
520
|
+
/** Axis display units: None. The default. */
|
521
|
+
LXW_CHART_AXIS_UNITS_NONE,
|
522
|
+
|
523
|
+
/** Axis display units: Hundreds. */
|
524
|
+
LXW_CHART_AXIS_UNITS_HUNDREDS,
|
525
|
+
|
526
|
+
/** Axis display units: Thousands. */
|
527
|
+
LXW_CHART_AXIS_UNITS_THOUSANDS,
|
528
|
+
|
529
|
+
/** Axis display units: Ten thousands. */
|
530
|
+
LXW_CHART_AXIS_UNITS_TEN_THOUSANDS,
|
531
|
+
|
532
|
+
/** Axis display units: Hundred thousands. */
|
533
|
+
LXW_CHART_AXIS_UNITS_HUNDRED_THOUSANDS,
|
534
|
+
|
535
|
+
/** Axis display units: Millions. */
|
536
|
+
LXW_CHART_AXIS_UNITS_MILLIONS,
|
537
|
+
|
538
|
+
/** Axis display units: Ten millions. */
|
539
|
+
LXW_CHART_AXIS_UNITS_TEN_MILLIONS,
|
540
|
+
|
541
|
+
/** Axis display units: Hundred millions. */
|
542
|
+
LXW_CHART_AXIS_UNITS_HUNDRED_MILLIONS,
|
543
|
+
|
544
|
+
/** Axis display units: Billions. */
|
545
|
+
LXW_CHART_AXIS_UNITS_BILLIONS,
|
546
|
+
|
547
|
+
/** Axis display units: Trillions. */
|
548
|
+
LXW_CHART_AXIS_UNITS_TRILLIONS
|
549
|
+
} lxw_chart_axis_display_unit;
|
550
|
+
|
551
|
+
/**
|
552
|
+
* @brief Tick mark types for an axis.
|
553
|
+
*/
|
554
|
+
typedef enum lxw_chart_axis_tick_mark {
|
555
|
+
|
556
|
+
/** Default tick mark for the chart axis. Usually outside. */
|
557
|
+
LXW_CHART_AXIS_TICK_MARK_DEFAULT,
|
558
|
+
|
559
|
+
/** No tick mark for the axis. */
|
560
|
+
LXW_CHART_AXIS_TICK_MARK_NONE,
|
561
|
+
|
562
|
+
/** Tick mark inside the axis only. */
|
563
|
+
LXW_CHART_AXIS_TICK_MARK_INSIDE,
|
564
|
+
|
565
|
+
/** Tick mark outside the axis only. */
|
566
|
+
LXW_CHART_AXIS_TICK_MARK_OUTSIDE,
|
567
|
+
|
568
|
+
/** Tick mark inside and outside the axis. */
|
569
|
+
LXW_CHART_AXIS_TICK_MARK_CROSSING
|
570
|
+
} lxw_chart_tick_mark;
|
240
571
|
|
241
572
|
typedef struct lxw_series_range {
|
242
573
|
char *formula;
|
@@ -291,7 +622,7 @@ typedef struct lxw_chart_line {
|
|
291
622
|
} lxw_chart_line;
|
292
623
|
|
293
624
|
/**
|
294
|
-
* @brief Struct to represent a chart
|
625
|
+
* @brief Struct to represent a chart fill.
|
295
626
|
*
|
296
627
|
* See @ref chart_fills.
|
297
628
|
*/
|
@@ -311,6 +642,28 @@ typedef struct lxw_chart_fill {
|
|
311
642
|
|
312
643
|
} lxw_chart_fill;
|
313
644
|
|
645
|
+
/**
|
646
|
+
* @brief Struct to represent a chart pattern.
|
647
|
+
*
|
648
|
+
* See @ref chart_patterns.
|
649
|
+
*/
|
650
|
+
typedef struct lxw_chart_pattern {
|
651
|
+
|
652
|
+
/** The pattern foreground color. See @ref working_with_colors. */
|
653
|
+
lxw_color_t fg_color;
|
654
|
+
|
655
|
+
/** The pattern background color. See @ref working_with_colors. */
|
656
|
+
lxw_color_t bg_color;
|
657
|
+
|
658
|
+
/** The pattern type. See #lxw_chart_pattern_type. */
|
659
|
+
uint8_t type;
|
660
|
+
|
661
|
+
/* Members for internal use only. */
|
662
|
+
uint8_t has_fg_color;
|
663
|
+
uint8_t has_bg_color;
|
664
|
+
|
665
|
+
} lxw_chart_pattern;
|
666
|
+
|
314
667
|
/**
|
315
668
|
* @brief Struct to represent a chart font.
|
316
669
|
*
|
@@ -322,7 +675,7 @@ typedef struct lxw_chart_font {
|
|
322
675
|
char *name;
|
323
676
|
|
324
677
|
/** The chart font size. The default is 11. */
|
325
|
-
|
678
|
+
double size;
|
326
679
|
|
327
680
|
/** The chart font bold property. Set to 0 or 1. */
|
328
681
|
uint8_t bold;
|
@@ -347,6 +700,16 @@ typedef struct lxw_chart_font {
|
|
347
700
|
|
348
701
|
} lxw_chart_font;
|
349
702
|
|
703
|
+
typedef struct lxw_chart_marker {
|
704
|
+
|
705
|
+
uint8_t type;
|
706
|
+
uint8_t size;
|
707
|
+
lxw_chart_line *line;
|
708
|
+
lxw_chart_fill *fill;
|
709
|
+
lxw_chart_pattern *pattern;
|
710
|
+
|
711
|
+
} lxw_chart_marker;
|
712
|
+
|
350
713
|
typedef struct lxw_chart_legend {
|
351
714
|
|
352
715
|
lxw_chart_font *font;
|
@@ -372,6 +735,126 @@ typedef struct lxw_chart_title {
|
|
372
735
|
|
373
736
|
} lxw_chart_title;
|
374
737
|
|
738
|
+
/**
|
739
|
+
* @brief Struct to represent an Excel chart data point.
|
740
|
+
*
|
741
|
+
* The lxw_chart_point used to set the line, fill and pattern of one or more
|
742
|
+
* points in a chart data series. See @ref chart_points.
|
743
|
+
*/
|
744
|
+
typedef struct lxw_chart_point {
|
745
|
+
|
746
|
+
/** The line/border for the chart point. See @ref chart_lines. */
|
747
|
+
lxw_chart_line *line;
|
748
|
+
|
749
|
+
/** The fill for the chart point. See @ref chart_fills. */
|
750
|
+
lxw_chart_fill *fill;
|
751
|
+
|
752
|
+
/** The pattern for the chart point. See @ref chart_patterns.*/
|
753
|
+
lxw_chart_pattern *pattern;
|
754
|
+
|
755
|
+
} lxw_chart_point;
|
756
|
+
|
757
|
+
/**
|
758
|
+
* @brief Define how blank values are displayed in a chart.
|
759
|
+
*/
|
760
|
+
typedef enum lxw_chart_blank {
|
761
|
+
|
762
|
+
/** Show empty chart cells as gaps in the data. The default. */
|
763
|
+
LXW_CHART_BLANKS_AS_GAP,
|
764
|
+
|
765
|
+
/** Show empty chart cells as zeros. */
|
766
|
+
LXW_CHART_BLANKS_AS_ZERO,
|
767
|
+
|
768
|
+
/** Show empty chart cells as connected. Only for charts with lines. */
|
769
|
+
LXW_CHART_BLANKS_AS_CONNECTED
|
770
|
+
} lxw_chart_blank;
|
771
|
+
|
772
|
+
enum lxw_chart_position {
|
773
|
+
LXW_CHART_AXIS_RIGHT,
|
774
|
+
LXW_CHART_AXIS_LEFT,
|
775
|
+
LXW_CHART_AXIS_TOP,
|
776
|
+
LXW_CHART_AXIS_BOTTOM
|
777
|
+
};
|
778
|
+
|
779
|
+
/**
|
780
|
+
* @brief Type/amount of data series error bar.
|
781
|
+
*/
|
782
|
+
typedef enum lxw_chart_error_bar_type {
|
783
|
+
/** Error bar type: Standard error. */
|
784
|
+
LXW_CHART_ERROR_BAR_TYPE_STD_ERROR,
|
785
|
+
|
786
|
+
/** Error bar type: Fixed value. */
|
787
|
+
LXW_CHART_ERROR_BAR_TYPE_FIXED,
|
788
|
+
|
789
|
+
/** Error bar type: Percentage. */
|
790
|
+
LXW_CHART_ERROR_BAR_TYPE_PERCENTAGE,
|
791
|
+
|
792
|
+
/** Error bar type: Standard deviation(s). */
|
793
|
+
LXW_CHART_ERROR_BAR_TYPE_STD_DEV
|
794
|
+
} lxw_chart_error_bar_type;
|
795
|
+
|
796
|
+
/**
|
797
|
+
* @brief Direction for a data series error bar.
|
798
|
+
*/
|
799
|
+
typedef enum lxw_chart_error_bar_direction {
|
800
|
+
|
801
|
+
/** Error bar extends in both directions. The default. */
|
802
|
+
LXW_CHART_ERROR_BAR_DIR_BOTH,
|
803
|
+
|
804
|
+
/** Error bar extends in positive direction. */
|
805
|
+
LXW_CHART_ERROR_BAR_DIR_PLUS,
|
806
|
+
|
807
|
+
/** Error bar extends in negative direction. */
|
808
|
+
LXW_CHART_ERROR_BAR_DIR_MINUS
|
809
|
+
} lxw_chart_error_bar_direction;
|
810
|
+
|
811
|
+
/**
|
812
|
+
* @brief End cap styles for a data series error bar.
|
813
|
+
*/
|
814
|
+
typedef enum lxw_chart_error_bar_cap {
|
815
|
+
/** Flat end cap. The default. */
|
816
|
+
LXW_CHART_ERROR_BAR_END_CAP,
|
817
|
+
|
818
|
+
/** No end cap. */
|
819
|
+
LXW_CHART_ERROR_BAR_NO_CAP
|
820
|
+
} lxw_chart_error_bar_cap;
|
821
|
+
|
822
|
+
typedef struct lxw_series_error_bars {
|
823
|
+
uint8_t type;
|
824
|
+
uint8_t direction;
|
825
|
+
uint8_t endcap;
|
826
|
+
uint8_t has_value;
|
827
|
+
uint8_t is_set;
|
828
|
+
uint8_t is_x;
|
829
|
+
uint8_t chart_group;
|
830
|
+
double value;
|
831
|
+
lxw_chart_line *line;
|
832
|
+
|
833
|
+
} lxw_series_error_bars;
|
834
|
+
|
835
|
+
/**
|
836
|
+
* @brief Series trendline/regression types.
|
837
|
+
*/
|
838
|
+
typedef enum lxw_chart_trendline_type {
|
839
|
+
/** Trendline type: Linear. */
|
840
|
+
LXW_CHART_TRENDLINE_TYPE_LINEAR,
|
841
|
+
|
842
|
+
/** Trendline type: Logarithm. */
|
843
|
+
LXW_CHART_TRENDLINE_TYPE_LOG,
|
844
|
+
|
845
|
+
/** Trendline type: Polynomial. */
|
846
|
+
LXW_CHART_TRENDLINE_TYPE_POLY,
|
847
|
+
|
848
|
+
/** Trendline type: Power. */
|
849
|
+
LXW_CHART_TRENDLINE_TYPE_POWER,
|
850
|
+
|
851
|
+
/** Trendline type: Exponential. */
|
852
|
+
LXW_CHART_TRENDLINE_TYPE_EXP,
|
853
|
+
|
854
|
+
/** Trendline type: Moving Average. */
|
855
|
+
LXW_CHART_TRENDLINE_TYPE_AVERAGE
|
856
|
+
} lxw_chart_trendline_type;
|
857
|
+
|
375
858
|
/**
|
376
859
|
* @brief Struct to represent an Excel chart data series.
|
377
860
|
*
|
@@ -386,11 +869,57 @@ typedef struct lxw_chart_series {
|
|
386
869
|
lxw_chart_title title;
|
387
870
|
lxw_chart_line *line;
|
388
871
|
lxw_chart_fill *fill;
|
872
|
+
lxw_chart_pattern *pattern;
|
873
|
+
lxw_chart_marker *marker;
|
874
|
+
lxw_chart_point *points;
|
875
|
+
uint16_t point_count;
|
876
|
+
|
877
|
+
uint8_t smooth;
|
878
|
+
uint8_t invert_if_negative;
|
879
|
+
|
880
|
+
/* Data label parameters. */
|
881
|
+
uint8_t has_labels;
|
882
|
+
uint8_t show_labels_value;
|
883
|
+
uint8_t show_labels_category;
|
884
|
+
uint8_t show_labels_name;
|
885
|
+
uint8_t show_labels_leader;
|
886
|
+
uint8_t show_labels_legend;
|
887
|
+
uint8_t show_labels_percent;
|
888
|
+
uint8_t label_position;
|
889
|
+
uint8_t label_separator;
|
890
|
+
uint8_t default_label_position;
|
891
|
+
char *label_num_format;
|
892
|
+
lxw_chart_font *label_font;
|
893
|
+
|
894
|
+
lxw_series_error_bars *x_error_bars;
|
895
|
+
lxw_series_error_bars *y_error_bars;
|
896
|
+
|
897
|
+
uint8_t has_trendline;
|
898
|
+
uint8_t has_trendline_forecast;
|
899
|
+
uint8_t has_trendline_equation;
|
900
|
+
uint8_t has_trendline_r_squared;
|
901
|
+
uint8_t has_trendline_intercept;
|
902
|
+
uint8_t trendline_type;
|
903
|
+
uint8_t trendline_value;
|
904
|
+
double trendline_forward;
|
905
|
+
double trendline_backward;
|
906
|
+
uint8_t trendline_value_type;
|
907
|
+
char *trendline_name;
|
908
|
+
lxw_chart_line *trendline_line;
|
909
|
+
double trendline_intercept;
|
389
910
|
|
390
911
|
STAILQ_ENTRY (lxw_chart_series) list_pointers;
|
391
912
|
|
392
913
|
} lxw_chart_series;
|
393
914
|
|
915
|
+
/* Struct for major/minor axis gridlines. */
|
916
|
+
typedef struct lxw_chart_gridline {
|
917
|
+
|
918
|
+
uint8_t visible;
|
919
|
+
lxw_chart_line *line;
|
920
|
+
|
921
|
+
} lxw_chart_gridline;
|
922
|
+
|
394
923
|
/**
|
395
924
|
* @brief Struct to represent an Excel chart axis.
|
396
925
|
*
|
@@ -401,16 +930,52 @@ typedef struct lxw_chart_axis {
|
|
401
930
|
|
402
931
|
lxw_chart_title title;
|
403
932
|
|
404
|
-
char num_format
|
405
|
-
char default_num_format
|
933
|
+
char *num_format;
|
934
|
+
char *default_num_format;
|
935
|
+
uint8_t source_linked;
|
406
936
|
|
407
|
-
uint8_t default_major_gridlines;
|
408
937
|
uint8_t major_tick_mark;
|
938
|
+
uint8_t minor_tick_mark;
|
409
939
|
uint8_t is_horizontal;
|
410
940
|
|
941
|
+
lxw_chart_gridline major_gridlines;
|
942
|
+
lxw_chart_gridline minor_gridlines;
|
943
|
+
|
411
944
|
lxw_chart_font *num_font;
|
412
945
|
lxw_chart_line *line;
|
413
946
|
lxw_chart_fill *fill;
|
947
|
+
lxw_chart_pattern *pattern;
|
948
|
+
|
949
|
+
uint8_t is_category;
|
950
|
+
uint8_t is_date;
|
951
|
+
uint8_t is_value;
|
952
|
+
uint8_t axis_position;
|
953
|
+
uint8_t position_axis;
|
954
|
+
uint8_t label_position;
|
955
|
+
uint8_t hidden;
|
956
|
+
uint8_t reverse;
|
957
|
+
|
958
|
+
uint8_t has_min;
|
959
|
+
double min;
|
960
|
+
uint8_t has_max;
|
961
|
+
double max;
|
962
|
+
|
963
|
+
uint8_t has_major_unit;
|
964
|
+
double major_unit;
|
965
|
+
uint8_t has_minor_unit;
|
966
|
+
double minor_unit;
|
967
|
+
|
968
|
+
uint16_t interval_unit;
|
969
|
+
uint16_t interval_tick;
|
970
|
+
|
971
|
+
uint16_t log_base;
|
972
|
+
|
973
|
+
uint8_t display_units;
|
974
|
+
uint8_t display_units_visible;
|
975
|
+
|
976
|
+
uint8_t has_crossing;
|
977
|
+
uint8_t crossing_max;
|
978
|
+
double crossing;
|
414
979
|
|
415
980
|
} lxw_chart_axis;
|
416
981
|
|
@@ -452,7 +1017,7 @@ typedef struct lxw_chart {
|
|
452
1017
|
uint32_t axis_id_4;
|
453
1018
|
|
454
1019
|
uint8_t in_use;
|
455
|
-
uint8_t
|
1020
|
+
uint8_t chart_group;
|
456
1021
|
uint8_t cat_has_num_fmt;
|
457
1022
|
|
458
1023
|
uint8_t has_horiz_cat_axis;
|
@@ -463,21 +1028,53 @@ typedef struct lxw_chart {
|
|
463
1028
|
uint16_t hole_size;
|
464
1029
|
|
465
1030
|
uint8_t no_title;
|
466
|
-
uint8_t has_markers;
|
467
1031
|
uint8_t has_overlap;
|
468
|
-
|
1032
|
+
int8_t overlap_y1;
|
1033
|
+
int8_t overlap_y2;
|
1034
|
+
uint16_t gap_y1;
|
1035
|
+
uint16_t gap_y2;
|
469
1036
|
|
470
1037
|
uint8_t grouping;
|
471
|
-
uint8_t
|
472
|
-
uint8_t cat_axis_position;
|
473
|
-
uint8_t val_axis_position;
|
1038
|
+
uint8_t default_cross_between;
|
474
1039
|
|
475
1040
|
lxw_chart_legend legend;
|
476
1041
|
int16_t *delete_series;
|
477
1042
|
uint16_t delete_series_count;
|
1043
|
+
lxw_chart_marker *default_marker;
|
1044
|
+
|
1045
|
+
lxw_chart_line *chartarea_line;
|
1046
|
+
lxw_chart_fill *chartarea_fill;
|
1047
|
+
lxw_chart_pattern *chartarea_pattern;
|
1048
|
+
lxw_chart_line *plotarea_line;
|
1049
|
+
lxw_chart_fill *plotarea_fill;
|
1050
|
+
lxw_chart_pattern *plotarea_pattern;
|
1051
|
+
|
1052
|
+
uint8_t has_drop_lines;
|
1053
|
+
lxw_chart_line *drop_lines_line;
|
1054
|
+
|
1055
|
+
uint8_t has_high_low_lines;
|
1056
|
+
lxw_chart_line *high_low_lines_line;
|
478
1057
|
|
479
1058
|
struct lxw_chart_series_list *series_list;
|
480
1059
|
|
1060
|
+
uint8_t has_table;
|
1061
|
+
uint8_t has_table_vertical;
|
1062
|
+
uint8_t has_table_horizontal;
|
1063
|
+
uint8_t has_table_outline;
|
1064
|
+
uint8_t has_table_legend_keys;
|
1065
|
+
lxw_chart_font *table_font;
|
1066
|
+
|
1067
|
+
uint8_t show_blanks_as;
|
1068
|
+
uint8_t show_hidden_data;
|
1069
|
+
|
1070
|
+
uint8_t has_up_down_bars;
|
1071
|
+
lxw_chart_line *up_bar_line;
|
1072
|
+
lxw_chart_line *down_bar_line;
|
1073
|
+
lxw_chart_fill *up_bar_fill;
|
1074
|
+
lxw_chart_fill *down_bar_fill;
|
1075
|
+
|
1076
|
+
uint8_t default_label_position;
|
1077
|
+
|
481
1078
|
STAILQ_ENTRY (lxw_chart) ordered_list_pointers;
|
482
1079
|
STAILQ_ENTRY (lxw_chart) list_pointers;
|
483
1080
|
|
@@ -734,139 +1331,1513 @@ void chart_series_set_line(lxw_chart_series *series, lxw_chart_line *line);
|
|
734
1331
|
void chart_series_set_fill(lxw_chart_series *series, lxw_chart_fill *fill);
|
735
1332
|
|
736
1333
|
/**
|
737
|
-
* @brief
|
1334
|
+
* @brief Invert the fill color for negative series values.
|
738
1335
|
*
|
739
|
-
* @param
|
740
|
-
* @param name The name caption of the axis.
|
1336
|
+
* @param series A series object created via `chart_add_series()`.
|
741
1337
|
*
|
742
|
-
*
|
743
|
-
*
|
744
|
-
* displayed below an X axis and to the side of a Y axis.
|
1338
|
+
* Invert the fill color for negative values. Usually only applicable to
|
1339
|
+
* column and bar charts.
|
745
1340
|
*
|
746
1341
|
* @code
|
747
|
-
*
|
748
|
-
* chart_axis_set_name(chart->y_axis, "US Dollars (Millions)");
|
1342
|
+
* chart_series_set_invert_if_negative(series);
|
749
1343
|
* @endcode
|
750
1344
|
*
|
751
|
-
|
1345
|
+
*/
|
1346
|
+
void chart_series_set_invert_if_negative(lxw_chart_series *series);
|
1347
|
+
|
1348
|
+
/**
|
1349
|
+
* @brief Set the pattern properties for a chart series.
|
752
1350
|
*
|
753
|
-
*
|
754
|
-
*
|
1351
|
+
* @param series A series object created via `chart_add_series()`.
|
1352
|
+
* @param pattern A #lxw_chart_pattern struct.
|
1353
|
+
*
|
1354
|
+
* Set the pattern properties of a chart series:
|
755
1355
|
*
|
756
1356
|
* @code
|
757
|
-
*
|
1357
|
+
* lxw_chart_pattern pattern1 = {.type = LXW_CHART_PATTERN_SHINGLE,
|
1358
|
+
* .fg_color = 0x804000,
|
1359
|
+
* .bg_color = 0XC68C53};
|
1360
|
+
*
|
1361
|
+
* lxw_chart_pattern pattern2 = {.type = LXW_CHART_PATTERN_HORIZONTAL_BRICK,
|
1362
|
+
* .fg_color = 0XB30000,
|
1363
|
+
* .bg_color = 0XFF6666};
|
1364
|
+
*
|
1365
|
+
* chart_series_set_pattern(series1, &pattern1);
|
1366
|
+
* chart_series_set_pattern(series2, &pattern2);
|
1367
|
+
*
|
758
1368
|
* @endcode
|
759
1369
|
*
|
760
|
-
*
|
761
|
-
* name formula programmatically.
|
1370
|
+
* @image html chart_pattern.png
|
762
1371
|
*
|
763
|
-
*
|
1372
|
+
* For more information see #lxw_chart_pattern_type and @ref chart_patterns.
|
764
1373
|
*/
|
765
|
-
void
|
1374
|
+
void chart_series_set_pattern(lxw_chart_series *series,
|
1375
|
+
lxw_chart_pattern *pattern);
|
766
1376
|
|
767
1377
|
/**
|
768
|
-
* @brief Set
|
1378
|
+
* @brief Set the data marker type for a series.
|
769
1379
|
*
|
770
|
-
* @param
|
771
|
-
* @param
|
772
|
-
* @param row The zero indexed row number of the range.
|
773
|
-
* @param col The zero indexed column number of the range.
|
1380
|
+
* @param series A series object created via `chart_add_series()`.
|
1381
|
+
* @param type The marker type, see #lxw_chart_marker_type.
|
774
1382
|
*
|
775
|
-
*
|
776
|
-
*
|
777
|
-
*
|
1383
|
+
* In Excel a chart marker is used to distinguish data points in a plotted
|
1384
|
+
* series. In general only Line and Scatter and Radar chart types use
|
1385
|
+
* markers. The libxlsxwriter chart types that can have markers are:
|
1386
|
+
*
|
1387
|
+
* - #LXW_CHART_LINE
|
1388
|
+
* - #LXW_CHART_SCATTER
|
1389
|
+
* - #LXW_CHART_SCATTER_STRAIGHT
|
1390
|
+
* - #LXW_CHART_SCATTER_STRAIGHT_WITH_MARKERS
|
1391
|
+
* - #LXW_CHART_SCATTER_SMOOTH
|
1392
|
+
* - #LXW_CHART_SCATTER_SMOOTH_WITH_MARKERS
|
1393
|
+
* - #LXW_CHART_RADAR
|
1394
|
+
* - #LXW_CHART_RADAR_WITH_MARKERS
|
1395
|
+
*
|
1396
|
+
* The chart types with `MARKERS` in the name have markers with default colors
|
1397
|
+
* and shapes turned on by default but it is possible using the various
|
1398
|
+
* `chart_series_set_marker_xxx()` functions below to change these defaults. It
|
1399
|
+
* is also possible to turn on an off markers.
|
1400
|
+
*
|
1401
|
+
* The `%chart_series_set_marker_type()` function is used to specify the
|
1402
|
+
* type of the series marker:
|
778
1403
|
*
|
779
1404
|
* @code
|
780
|
-
*
|
781
|
-
* chart_axis_set_name_range(chart->y_axis, "Sheet1", 2, 0);
|
1405
|
+
* chart_series_set_marker_type(series, LXW_CHART_MARKER_DIAMOND);
|
782
1406
|
* @endcode
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
1407
|
+
*
|
1408
|
+
* @image html chart_marker1.png
|
1409
|
+
*
|
1410
|
+
* The available marker types defined by #lxw_chart_marker_type are:
|
1411
|
+
*
|
1412
|
+
* - #LXW_CHART_MARKER_AUTOMATIC
|
1413
|
+
* - #LXW_CHART_MARKER_NONE
|
1414
|
+
* - #LXW_CHART_MARKER_SQUARE
|
1415
|
+
* - #LXW_CHART_MARKER_DIAMOND
|
1416
|
+
* - #LXW_CHART_MARKER_TRIANGLE
|
1417
|
+
* - #LXW_CHART_MARKER_X
|
1418
|
+
* - #LXW_CHART_MARKER_STAR
|
1419
|
+
* - #LXW_CHART_MARKER_SHORT_DASH
|
1420
|
+
* - #LXW_CHART_MARKER_LONG_DASH
|
1421
|
+
* - #LXW_CHART_MARKER_CIRCLE
|
1422
|
+
* - #LXW_CHART_MARKER_PLUS
|
1423
|
+
*
|
1424
|
+
* The `#LXW_CHART_MARKER_NONE` type can be used to turn off default markers:
|
1425
|
+
*
|
1426
|
+
* @code
|
1427
|
+
* chart_series_set_marker_type(series, LXW_CHART_MARKER_NONE);
|
1428
|
+
* @endcode
|
1429
|
+
*
|
1430
|
+
* @image html chart_series_set_marker_none.png
|
1431
|
+
*
|
1432
|
+
* The `#LXW_CHART_MARKER_AUTOMATIC` type is a special case which turns on a
|
1433
|
+
* marker using the default marker style for the particular series. If
|
1434
|
+
* automatic is on then other marker properties such as size, line or fill
|
1435
|
+
* cannot be set.
|
1436
|
+
*/
|
1437
|
+
void chart_series_set_marker_type(lxw_chart_series *series, uint8_t type);
|
1438
|
+
|
1439
|
+
/**
|
1440
|
+
* @brief Set the size of a data marker for a series.
|
1441
|
+
*
|
1442
|
+
* @param series A series object created via `chart_add_series()`.
|
1443
|
+
* @param size The size of the marker.
|
1444
|
+
*
|
1445
|
+
* The `%chart_series_set_marker_size()` function is used to specify the
|
1446
|
+
* size of the series marker:
|
1447
|
+
*
|
1448
|
+
* @code
|
1449
|
+
* chart_series_set_marker_type(series, LXW_CHART_MARKER_CIRCLE);
|
1450
|
+
* chart_series_set_marker_size(series, 10);
|
1451
|
+
* @endcode
|
1452
|
+
*
|
1453
|
+
* @image html chart_series_set_marker_size.png
|
1454
|
+
*
|
1455
|
+
*/
|
1456
|
+
void chart_series_set_marker_size(lxw_chart_series *series, uint8_t size);
|
1457
|
+
|
1458
|
+
/**
|
1459
|
+
* @brief Set the line properties for a chart series marker.
|
1460
|
+
*
|
1461
|
+
* @param series A series object created via `chart_add_series()`.
|
1462
|
+
* @param line A #lxw_chart_line struct.
|
1463
|
+
*
|
1464
|
+
* Set the line/border properties of a chart marker:
|
1465
|
+
*
|
1466
|
+
* @code
|
1467
|
+
* lxw_chart_line line = {.color = LXW_COLOR_BLACK};
|
1468
|
+
* lxw_chart_fill fill = {.color = LXW_COLOR_RED};
|
1469
|
+
*
|
1470
|
+
* chart_series_set_marker_type(series, LXW_CHART_MARKER_SQUARE);
|
1471
|
+
* chart_series_set_marker_size(series, 8);
|
1472
|
+
*
|
1473
|
+
* chart_series_set_marker_line(series, &line);
|
1474
|
+
* chart_series_set_marker_fill(series, &fill);
|
1475
|
+
* @endcode
|
1476
|
+
*
|
1477
|
+
* @image html chart_marker2.png
|
1478
|
+
*
|
1479
|
+
* For more information see @ref chart_lines.
|
1480
|
+
*/
|
1481
|
+
void chart_series_set_marker_line(lxw_chart_series *series,
|
1482
|
+
lxw_chart_line *line);
|
1483
|
+
|
1484
|
+
/**
|
1485
|
+
* @brief Set the fill properties for a chart series marker.
|
1486
|
+
*
|
1487
|
+
* @param series A series object created via `chart_add_series()`.
|
1488
|
+
* @param fill A #lxw_chart_fill struct.
|
1489
|
+
*
|
1490
|
+
* Set the fill properties of a chart marker:
|
1491
|
+
*
|
1492
|
+
* @code
|
1493
|
+
* chart_series_set_marker_fill(series, &fill);
|
1494
|
+
* @endcode
|
1495
|
+
*
|
1496
|
+
* See the example and image above and also see @ref chart_fills.
|
1497
|
+
*/
|
1498
|
+
void chart_series_set_marker_fill(lxw_chart_series *series,
|
1499
|
+
lxw_chart_fill *fill);
|
1500
|
+
|
1501
|
+
/**
|
1502
|
+
* @brief Set the pattern properties for a chart series marker.
|
1503
|
+
*
|
1504
|
+
* @param series A series object created via `chart_add_series()`.
|
1505
|
+
* @param pattern A #lxw_chart_pattern struct.
|
1506
|
+
*
|
1507
|
+
* Set the pattern properties of a chart marker:
|
1508
|
+
*
|
1509
|
+
* @code
|
1510
|
+
* chart_series_set_marker_pattern(series, &pattern);
|
1511
|
+
* @endcode
|
1512
|
+
*
|
1513
|
+
* For more information see #lxw_chart_pattern_type and @ref chart_patterns.
|
1514
|
+
*/
|
1515
|
+
void chart_series_set_marker_pattern(lxw_chart_series *series,
|
1516
|
+
lxw_chart_pattern *pattern);
|
1517
|
+
|
1518
|
+
/**
|
1519
|
+
* @brief Set the formatting for points in the series.
|
1520
|
+
*
|
1521
|
+
* @param series A series object created via `chart_add_series()`.
|
1522
|
+
* @param points An NULL terminated array of #lxw_chart_point pointers.
|
1523
|
+
*
|
1524
|
+
* @return A #lxw_error.
|
1525
|
+
*
|
1526
|
+
* In general formatting is applied to an entire series in a chart. However,
|
1527
|
+
* it is occasionally required to format individual points in a series. In
|
1528
|
+
* particular this is required for Pie/Doughnut charts where each segment is
|
1529
|
+
* represented by a point.
|
1530
|
+
*
|
1531
|
+
* @dontinclude chart_pie_colors.c
|
1532
|
+
* @skip Add the data series
|
1533
|
+
* @until chart_series_set_points
|
1534
|
+
*
|
1535
|
+
* @image html chart_points1.png
|
1536
|
+
*
|
1537
|
+
* @note The array of #lxw_chart_point pointers should be NULL terminated
|
1538
|
+
* as shown in the example.
|
1539
|
+
*
|
1540
|
+
* For more details see @ref chart_points
|
1541
|
+
*/
|
1542
|
+
lxw_error chart_series_set_points(lxw_chart_series *series,
|
1543
|
+
lxw_chart_point *points[]);
|
1544
|
+
|
1545
|
+
/**
|
1546
|
+
* @brief Smooth a line or scatter chart series.
|
1547
|
+
*
|
1548
|
+
* @param series A series object created via `chart_add_series()`.
|
1549
|
+
* @param smooth Turn off/on the line smoothing. (0/1)
|
1550
|
+
*
|
1551
|
+
* The `chart_series_set_smooth()` function is used to set the smooth property
|
1552
|
+
* of a line series. It is only applicable to the line and scatter chart
|
1553
|
+
* types:
|
1554
|
+
*
|
1555
|
+
* @code
|
1556
|
+
* chart_series_set_smooth(series2, LXW_TRUE);
|
1557
|
+
* @endcode
|
1558
|
+
*
|
1559
|
+
* @image html chart_smooth.png
|
1560
|
+
*
|
1561
|
+
*
|
1562
|
+
*/
|
1563
|
+
void chart_series_set_smooth(lxw_chart_series *series, uint8_t smooth);
|
1564
|
+
|
1565
|
+
/**
|
1566
|
+
* @brief Add data labels to a chart series.
|
1567
|
+
*
|
1568
|
+
* @param series A series object created via `chart_add_series()`.
|
1569
|
+
*
|
1570
|
+
* The `%chart_series_set_labels()` function is used to turn on data labels
|
1571
|
+
* for a chart series. Data labels indicate the values of the plotted data
|
1572
|
+
* points.
|
1573
|
+
*
|
1574
|
+
* @code
|
1575
|
+
* chart_series_set_labels(series);
|
1576
|
+
* @endcode
|
1577
|
+
*
|
1578
|
+
* @image html chart_labels1.png
|
1579
|
+
*
|
1580
|
+
* By default data labels are displayed in Excel with only the values shown:
|
1581
|
+
*
|
1582
|
+
* @image html chart_labels2.png
|
1583
|
+
*
|
1584
|
+
* However, it is possible to configure other display options, as shown
|
1585
|
+
* in the functions below.
|
1586
|
+
*
|
1587
|
+
* For more information see @ref chart_labels.
|
1588
|
+
*/
|
1589
|
+
void chart_series_set_labels(lxw_chart_series *series);
|
1590
|
+
|
1591
|
+
/**
|
1592
|
+
* @brief Set the display options for the labels of a data series.
|
1593
|
+
*
|
1594
|
+
* @param series A series object created via `chart_add_series()`.
|
1595
|
+
* @param show_name Turn on/off the series name in the label caption.
|
1596
|
+
* @param show_category Turn on/off the category name in the label caption.
|
1597
|
+
* @param show_value Turn on/off the value in the label caption.
|
1598
|
+
*
|
1599
|
+
* The `%chart_series_set_labels_options()` function is used to set the
|
1600
|
+
* parameters that are displayed in the series data label:
|
1601
|
+
*
|
1602
|
+
* @code
|
1603
|
+
* chart_series_set_labels(series);
|
1604
|
+
* chart_series_set_labels_options(series, LXW_TRUE, LXW_TRUE, LXW_TRUE);
|
1605
|
+
* @endcode
|
1606
|
+
*
|
1607
|
+
* @image html chart_labels3.png
|
1608
|
+
*
|
1609
|
+
* For more information see @ref chart_labels.
|
1610
|
+
*/
|
1611
|
+
void chart_series_set_labels_options(lxw_chart_series *series,
|
1612
|
+
uint8_t show_name, uint8_t show_category,
|
1613
|
+
uint8_t show_value);
|
1614
|
+
|
1615
|
+
/**
|
1616
|
+
* @brief Set the separator for the data label captions.
|
1617
|
+
*
|
1618
|
+
* @param series A series object created via `chart_add_series()`.
|
1619
|
+
* @param separator The separator for the data label options:
|
1620
|
+
* #lxw_chart_label_separator.
|
1621
|
+
*
|
1622
|
+
* The `%chart_series_set_labels_separator()` function is used to change the
|
1623
|
+
* separator between multiple data label items. The default options is a comma
|
1624
|
+
* separator as shown in the previous example.
|
1625
|
+
*
|
1626
|
+
* The available options are:
|
1627
|
+
*
|
1628
|
+
* - #LXW_CHART_LABEL_SEPARATOR_SEMICOLON: semicolon separator.
|
1629
|
+
* - #LXW_CHART_LABEL_SEPARATOR_PERIOD: a period (dot) separator.
|
1630
|
+
* - #LXW_CHART_LABEL_SEPARATOR_NEWLINE: a newline separator.
|
1631
|
+
* - #LXW_CHART_LABEL_SEPARATOR_SPACE: a space separator.
|
1632
|
+
*
|
1633
|
+
* For example:
|
1634
|
+
*
|
1635
|
+
* @code
|
1636
|
+
* chart_series_set_labels(series);
|
1637
|
+
* chart_series_set_labels_options(series, LXW_TRUE, LXW_TRUE, LXW_TRUE);
|
1638
|
+
* chart_series_set_labels_separator(series, LXW_CHART_LABEL_SEPARATOR_NEWLINE);
|
1639
|
+
* @endcode
|
1640
|
+
*
|
1641
|
+
* @image html chart_labels4.png
|
1642
|
+
*
|
1643
|
+
* For more information see @ref chart_labels.
|
1644
|
+
*/
|
1645
|
+
void chart_series_set_labels_separator(lxw_chart_series *series,
|
1646
|
+
uint8_t separator);
|
1647
|
+
|
1648
|
+
/**
|
1649
|
+
* @brief Set the data label position for a series.
|
1650
|
+
*
|
1651
|
+
* @param series A series object created via `chart_add_series()`.
|
1652
|
+
* @param position The data label position: #lxw_chart_label_position.
|
1653
|
+
*
|
1654
|
+
* The `%chart_series_set_labels_position()` function sets the position of
|
1655
|
+
* the labels in the data series:
|
1656
|
+
*
|
1657
|
+
* @code
|
1658
|
+
* chart_series_set_labels(series);
|
1659
|
+
* chart_series_set_labels_position(series, LXW_CHART_LABEL_POSITION_ABOVE);
|
1660
|
+
* @endcode
|
1661
|
+
*
|
1662
|
+
* @image html chart_labels5.png
|
1663
|
+
*
|
1664
|
+
* In Excel the allowable data label positions vary for different chart
|
1665
|
+
* types. The allowable, and default, positions are:
|
1666
|
+
*
|
1667
|
+
* | Position | Line, Scatter | Bar, Column | Pie, Doughnut | Area, Radar |
|
1668
|
+
* | :------------------------------------ | :------------ | :------------ | :------------ | :------------ |
|
1669
|
+
* | #LXW_CHART_LABEL_POSITION_CENTER | Yes | Yes | Yes | Yes (default) |
|
1670
|
+
* | #LXW_CHART_LABEL_POSITION_RIGHT | Yes (default) | | | |
|
1671
|
+
* | #LXW_CHART_LABEL_POSITION_LEFT | Yes | | | |
|
1672
|
+
* | #LXW_CHART_LABEL_POSITION_ABOVE | Yes | | | |
|
1673
|
+
* | #LXW_CHART_LABEL_POSITION_BELOW | Yes | | | |
|
1674
|
+
* | #LXW_CHART_LABEL_POSITION_INSIDE_BASE | | Yes | | |
|
1675
|
+
* | #LXW_CHART_LABEL_POSITION_INSIDE_END | | Yes | Yes | |
|
1676
|
+
* | #LXW_CHART_LABEL_POSITION_OUTSIDE_END | | Yes (default) | Yes | |
|
1677
|
+
* | #LXW_CHART_LABEL_POSITION_BEST_FIT | | | Yes (default) | |
|
1678
|
+
*
|
1679
|
+
*
|
1680
|
+
* For more information see @ref chart_labels.
|
1681
|
+
*/
|
1682
|
+
void chart_series_set_labels_position(lxw_chart_series *series,
|
1683
|
+
uint8_t position);
|
1684
|
+
|
1685
|
+
/**
|
1686
|
+
* @brief Set leader lines for Pie and Doughnut charts.
|
1687
|
+
*
|
1688
|
+
* @param series A series object created via `chart_add_series()`.
|
1689
|
+
*
|
1690
|
+
* The `%chart_series_set_labels_leader_line()` function is used to turn on
|
1691
|
+
* leader lines for the data label of a series. It is mainly used for pie
|
1692
|
+
* or doughnut charts:
|
1693
|
+
*
|
1694
|
+
* @code
|
1695
|
+
* chart_series_set_labels(series);
|
1696
|
+
* chart_series_set_labels_leader_line(series);
|
1697
|
+
* @endcode
|
1698
|
+
*
|
1699
|
+
* @note Even when leader lines are turned on they aren't automatically
|
1700
|
+
* visible in Excel or XlsxWriter. Due to an Excel limitation
|
1701
|
+
* (or design) leader lines only appear if the data label is moved
|
1702
|
+
* manually or if the data labels are very close and need to be
|
1703
|
+
* adjusted automatically.
|
1704
|
+
*
|
1705
|
+
* For more information see @ref chart_labels.
|
1706
|
+
*/
|
1707
|
+
void chart_series_set_labels_leader_line(lxw_chart_series *series);
|
1708
|
+
|
1709
|
+
/**
|
1710
|
+
* @brief Set the legend key for a data label in a chart series.
|
1711
|
+
*
|
1712
|
+
* @param series A series object created via `chart_add_series()`.
|
1713
|
+
*
|
1714
|
+
* The `%chart_series_set_labels_legend()` function is used to set the
|
1715
|
+
* legend key for a data series:
|
1716
|
+
*
|
1717
|
+
* @code
|
1718
|
+
* chart_series_set_labels(series);
|
1719
|
+
* chart_series_set_labels_legend(series);
|
1720
|
+
* @endcode
|
1721
|
+
*
|
1722
|
+
* @image html chart_labels6.png
|
1723
|
+
*
|
1724
|
+
* For more information see @ref chart_labels.
|
1725
|
+
*/
|
1726
|
+
void chart_series_set_labels_legend(lxw_chart_series *series);
|
1727
|
+
|
1728
|
+
/**
|
1729
|
+
* @brief Set the percentage for a Pie/Doughnut data point.
|
1730
|
+
*
|
1731
|
+
* @param series A series object created via `chart_add_series()`.
|
1732
|
+
*
|
1733
|
+
* The `%chart_series_set_labels_percentage()` function is used to turn on
|
1734
|
+
* the display of data labels as a percentage for a series. It is mainly
|
1735
|
+
* used for pie charts:
|
1736
|
+
*
|
1737
|
+
* @code
|
1738
|
+
* chart_series_set_labels(series);
|
1739
|
+
* chart_series_set_labels_options(series, LXW_FALSE, LXW_FALSE, LXW_FALSE);
|
1740
|
+
* chart_series_set_labels_percentage(series);
|
1741
|
+
* @endcode
|
1742
|
+
*
|
1743
|
+
* @image html chart_labels7.png
|
1744
|
+
*
|
1745
|
+
* For more information see @ref chart_labels.
|
1746
|
+
*/
|
1747
|
+
void chart_series_set_labels_percentage(lxw_chart_series *series);
|
1748
|
+
|
1749
|
+
/**
|
1750
|
+
* @brief Set the number format for chart data labels in a series.
|
1751
|
+
*
|
1752
|
+
* @param series A series object created via `chart_add_series()`.
|
1753
|
+
* @param num_format The number format string.
|
1754
|
+
*
|
1755
|
+
* The `%chart_series_set_labels_num_format()` function is used to set the
|
1756
|
+
* number format for data labels:
|
1757
|
+
*
|
1758
|
+
* @code
|
1759
|
+
* chart_series_set_labels(series);
|
1760
|
+
* chart_series_set_labels_num_format(series, "$0.00");
|
1761
|
+
* @endcode
|
1762
|
+
*
|
1763
|
+
* @image html chart_labels8.png
|
1764
|
+
*
|
1765
|
+
* The number format is similar to the Worksheet Cell Format num_format,
|
1766
|
+
* see `format_set_num_format()`.
|
1767
|
+
*
|
1768
|
+
* For more information see @ref chart_labels.
|
1769
|
+
*/
|
1770
|
+
void chart_series_set_labels_num_format(lxw_chart_series *series,
|
1771
|
+
const char *num_format);
|
1772
|
+
|
1773
|
+
/**
|
1774
|
+
* @brief Set the font properties for chart data labels in a series
|
1775
|
+
*
|
1776
|
+
* @param series A series object created via `chart_add_series()`.
|
1777
|
+
* @param font A pointer to a chart #lxw_chart_font font struct.
|
1778
|
+
*
|
1779
|
+
*
|
1780
|
+
* The `%chart_series_set_labels_font()` function is used to set the font
|
1781
|
+
* for data labels:
|
1782
|
+
*
|
1783
|
+
* @code
|
1784
|
+
* lxw_chart_font font = {.name = "Consolas", .color = LXW_COLOR_RED};
|
1785
|
+
*
|
1786
|
+
* chart_series_set_labels(series);
|
1787
|
+
* chart_series_set_labels_font(series, &font);
|
1788
|
+
* @endcode
|
1789
|
+
*
|
1790
|
+
* @image html chart_labels9.png
|
1791
|
+
*
|
1792
|
+
* For more information see @ref chart_fonts and @ref chart_labels.
|
1793
|
+
*
|
1794
|
+
*/
|
1795
|
+
void chart_series_set_labels_font(lxw_chart_series *series,
|
1796
|
+
lxw_chart_font *font);
|
1797
|
+
|
1798
|
+
/**
|
1799
|
+
* @brief Turn on a trendline for a chart data series.
|
1800
|
+
*
|
1801
|
+
* @param series A series object created via `chart_add_series()`.
|
1802
|
+
* @param type The type of trendline: #lxw_chart_trendline_type.
|
1803
|
+
* @param value The order/period value for polynomial and moving average
|
1804
|
+
* trendlines.
|
1805
|
+
*
|
1806
|
+
* A trendline can be added to a chart series to indicate trends in the data
|
1807
|
+
* such as a moving average or a polynomial fit. The trendlines types are
|
1808
|
+
* shown in the following Excel dialog:
|
1809
|
+
*
|
1810
|
+
* @image html chart_trendline0.png
|
1811
|
+
*
|
1812
|
+
* The `%chart_series_set_trendline()` function turns on these trendlines for
|
1813
|
+
* a data series:
|
1814
|
+
*
|
1815
|
+
* @code
|
1816
|
+
* chart = workbook_add_chart(workbook, LXW_CHART_LINE);
|
1817
|
+
* series = chart_add_series(chart, NULL, "Sheet1!$A$1:$A$6");
|
1818
|
+
*
|
1819
|
+
* chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
|
1820
|
+
* @endcode
|
1821
|
+
*
|
1822
|
+
* @image html chart_trendline2.png
|
1823
|
+
*
|
1824
|
+
* The `value` parameter corresponds to *order* for a polynomial trendline
|
1825
|
+
* and *period* for a Moving Average trendline. It both cases it must be >= 2.
|
1826
|
+
* The `value` parameter is ignored for all other trendlines:
|
1827
|
+
*
|
1828
|
+
* @code
|
1829
|
+
* chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_AVERAGE, 2);
|
1830
|
+
* @endcode
|
1831
|
+
*
|
1832
|
+
* @image html chart_trendline3.png
|
1833
|
+
*
|
1834
|
+
* The allowable values for the the trendline `type` are:
|
1835
|
+
*
|
1836
|
+
* - #LXW_CHART_TRENDLINE_TYPE_LINEAR: Linear trendline.
|
1837
|
+
* - #LXW_CHART_TRENDLINE_TYPE_LOG: Logarithm trendline.
|
1838
|
+
* - #LXW_CHART_TRENDLINE_TYPE_POLY: Polynomial trendline. The `value`
|
1839
|
+
* parameter corresponds to *order*.
|
1840
|
+
* - #LXW_CHART_TRENDLINE_TYPE_POWER: Power trendline.
|
1841
|
+
* - #LXW_CHART_TRENDLINE_TYPE_EXP: Exponential trendline.
|
1842
|
+
* - #LXW_CHART_TRENDLINE_TYPE_AVERAGE: Moving Average trendline. The `value`
|
1843
|
+
* parameter corresponds to *period*.
|
1844
|
+
*
|
1845
|
+
* Other trendline options, such as those shown in the following Excel
|
1846
|
+
* dialog, can be set using the functions below.
|
1847
|
+
*
|
1848
|
+
* @image html chart_trendline1.png
|
1849
|
+
*
|
1850
|
+
* For more information see @ref chart_trendlines.
|
1851
|
+
*/
|
1852
|
+
void chart_series_set_trendline(lxw_chart_series *series, uint8_t type,
|
1853
|
+
uint8_t value);
|
1854
|
+
|
1855
|
+
/**
|
1856
|
+
* @brief Set the trendline forecast for a chart data series.
|
1857
|
+
*
|
1858
|
+
* @param series A series object created via `chart_add_series()`.
|
1859
|
+
* @param forward The forward period.
|
1860
|
+
* @param backward The backwards period.
|
1861
|
+
*
|
1862
|
+
* The `%chart_series_set_trendline_forecast()` function sets the forward
|
1863
|
+
* and backward forecast periods for the trendline:
|
1864
|
+
*
|
1865
|
+
* @code
|
1866
|
+
* chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
|
1867
|
+
* chart_series_set_trendline_forecast(series, 0.5, 0.5);
|
1868
|
+
* @endcode
|
1869
|
+
*
|
1870
|
+
* @image html chart_trendline4.png
|
1871
|
+
*
|
1872
|
+
* @note This feature isn't available for Moving Average in Excel.
|
1873
|
+
*
|
1874
|
+
* For more information see @ref chart_trendlines.
|
1875
|
+
*/
|
1876
|
+
void chart_series_set_trendline_forecast(lxw_chart_series *series,
|
1877
|
+
double forward, double backward);
|
1878
|
+
|
1879
|
+
/**
|
1880
|
+
* @brief Display the equation of a trendline for a chart data series.
|
1881
|
+
*
|
1882
|
+
* @param series A series object created via `chart_add_series()`.
|
1883
|
+
*
|
1884
|
+
* The `%chart_series_set_trendline_equation()` function displays the
|
1885
|
+
* equation of the trendline on the chart:
|
1886
|
+
*
|
1887
|
+
* @code
|
1888
|
+
* chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
|
1889
|
+
* chart_series_set_trendline_equation(series);
|
1890
|
+
* @endcode
|
1891
|
+
*
|
1892
|
+
* @image html chart_trendline5.png
|
1893
|
+
*
|
1894
|
+
* @note This feature isn't available for Moving Average in Excel.
|
1895
|
+
*
|
1896
|
+
* For more information see @ref chart_trendlines.
|
1897
|
+
*/
|
1898
|
+
void chart_series_set_trendline_equation(lxw_chart_series *series);
|
1899
|
+
|
1900
|
+
/**
|
1901
|
+
* @brief Display the R squared value of a trendline for a chart data series.
|
1902
|
+
*
|
1903
|
+
* @param series A series object created via `chart_add_series()`.
|
1904
|
+
*
|
1905
|
+
* The `%chart_series_set_trendline_r_squared()` function displays the
|
1906
|
+
* R-squared value for the trendline on the chart:
|
1907
|
+
*
|
1908
|
+
* @code
|
1909
|
+
* chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
|
1910
|
+
* chart_series_set_trendline_r_squared(series);
|
1911
|
+
* @endcode
|
1912
|
+
*
|
1913
|
+
* @image html chart_trendline6.png
|
1914
|
+
*
|
1915
|
+
* @note This feature isn't available for Moving Average in Excel.
|
1916
|
+
*
|
1917
|
+
* For more information see @ref chart_trendlines.
|
1918
|
+
*/
|
1919
|
+
void chart_series_set_trendline_r_squared(lxw_chart_series *series);
|
1920
|
+
|
1921
|
+
/**
|
1922
|
+
* @brief Set the trendline Y-axis intercept for a chart data series.
|
1923
|
+
*
|
1924
|
+
* @param series A series object created via `chart_add_series()`.
|
1925
|
+
* @param intercept Y-axis intercept value.
|
1926
|
+
*
|
1927
|
+
* The `%chart_series_set_trendline_intercept()` function sets the Y-axis
|
1928
|
+
* intercept for the trendline:
|
1929
|
+
*
|
1930
|
+
* @code
|
1931
|
+
* chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
|
1932
|
+
* chart_series_set_trendline_equation(series);
|
1933
|
+
* chart_series_set_trendline_intercept(series, 0.8);
|
1934
|
+
* @endcode
|
1935
|
+
*
|
1936
|
+
* @image html chart_trendline7.png
|
1937
|
+
*
|
1938
|
+
* As can be seen from the equation on the chart the intercept point
|
1939
|
+
* (when X=0) is the same as the value set in the equation.
|
1940
|
+
*
|
1941
|
+
* @note The intercept feature is only available in Excel for Exponential,
|
1942
|
+
* Linear and Polynomial trendline types.
|
1943
|
+
*
|
1944
|
+
* For more information see @ref chart_trendlines.
|
1945
|
+
*/
|
1946
|
+
void chart_series_set_trendline_intercept(lxw_chart_series *series,
|
1947
|
+
double intercept);
|
1948
|
+
|
1949
|
+
/**
|
1950
|
+
* @brief Set the trendline name for a chart data series.
|
1951
|
+
*
|
1952
|
+
* @param series A series object created via `chart_add_series()`.
|
1953
|
+
* @param name The name of the trendline to display in the legend.
|
1954
|
+
*
|
1955
|
+
* The `%chart_series_set_trendline_name()` function sets the name of the
|
1956
|
+
* trendline that is displayed in the chart legend. In the examples above
|
1957
|
+
* the trendlines are displayed with default names like "Linear (Series 1)"
|
1958
|
+
* and "2 per Mov. Avg. (Series 1)". If these names are too verbose or not
|
1959
|
+
* descriptive enough you can set your own trendline name:
|
1960
|
+
*
|
1961
|
+
* @code
|
1962
|
+
* chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
|
1963
|
+
* chart_series_set_trendline_name(series, "My trendline");
|
1964
|
+
* @endcode
|
1965
|
+
*
|
1966
|
+
* @image html chart_trendline8.png
|
1967
|
+
*
|
1968
|
+
* It is often preferable to turn off the trendline caption in the legend.
|
1969
|
+
* This is down in Excel by deleting the trendline name from the legend.
|
1970
|
+
* In libxlsxwriter this is done using the `chart_legend_delete_series()`
|
1971
|
+
* function to delete the zero based series numbers:
|
1972
|
+
*
|
1973
|
+
* @code
|
1974
|
+
* chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
|
1975
|
+
*
|
1976
|
+
* // Delete the series name for the second series (=1 in zero base).
|
1977
|
+
* // The -1 value indicates the end of the array of values.
|
1978
|
+
* int16_t names[] = {1, -1};
|
1979
|
+
* chart_legend_delete_series(chart, names);
|
1980
|
+
* @endcode
|
1981
|
+
*
|
1982
|
+
* @image html chart_trendline9.png
|
1983
|
+
*
|
1984
|
+
* For more information see @ref chart_trendlines.
|
1985
|
+
*/
|
1986
|
+
void chart_series_set_trendline_name(lxw_chart_series *series,
|
1987
|
+
const char *name);
|
1988
|
+
|
1989
|
+
/**
|
1990
|
+
* @brief Set the trendline line properties for a chart data series.
|
1991
|
+
*
|
1992
|
+
* @param series A series object created via `chart_add_series()`.
|
1993
|
+
* @param line A #lxw_chart_line struct.
|
1994
|
+
*
|
1995
|
+
* The `%chart_series_set_trendline_line()` function is used to set the line
|
1996
|
+
* properties of a trendline:
|
1997
|
+
*
|
1998
|
+
* @code
|
1999
|
+
* lxw_chart_line line = {.color = LXW_COLOR_RED,
|
2000
|
+
* .dash_type = LXW_CHART_LINE_DASH_LONG_DASH};
|
2001
|
+
*
|
2002
|
+
* chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
|
2003
|
+
* chart_series_set_trendline_line(series, &line);
|
2004
|
+
* @endcode
|
2005
|
+
*
|
2006
|
+
* @image html chart_trendline10.png
|
2007
|
+
*
|
2008
|
+
* For more information see @ref chart_trendlines and @ref chart_lines.
|
2009
|
+
*/
|
2010
|
+
void chart_series_set_trendline_line(lxw_chart_series *series,
|
2011
|
+
lxw_chart_line *line);
|
2012
|
+
|
2013
|
+
/**
|
2014
|
+
* Set the X or Y error bars for a chart series.
|
2015
|
+
*
|
2016
|
+
* @param error_bars A pointer to the series X or Y error bars.
|
2017
|
+
* @param type The type of error bar: #lxw_chart_error_bar_type.
|
2018
|
+
* @param value The error value.
|
2019
|
+
*
|
2020
|
+
* Error bars can be added to a chart series to indicate error bounds in the
|
2021
|
+
* data. The error bars can be vertical `y_error_bars` (the most common type)
|
2022
|
+
* or horizontal `x_error_bars` (for Bar and Scatter charts only).
|
2023
|
+
*
|
2024
|
+
* @image html chart_error_bars0.png
|
2025
|
+
*
|
2026
|
+
* The `%chart_series_set_error_bars()` function sets the error bar type
|
2027
|
+
* and value associated with the type:
|
2028
|
+
*
|
2029
|
+
* @code
|
2030
|
+
* lxw_chart_series *series = chart_add_series(chart,
|
2031
|
+
* "=Sheet1!$A$1:$A$5",
|
2032
|
+
* "=Sheet1!$B$1:$B$5");
|
2033
|
+
*
|
2034
|
+
* chart_series_set_error_bars(series->y_error_bars,
|
2035
|
+
* LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
|
2036
|
+
* @endcode
|
2037
|
+
*
|
2038
|
+
* @image html chart_error_bars1.png
|
2039
|
+
*
|
2040
|
+
* The error bar types that be used are:
|
2041
|
+
*
|
2042
|
+
* - #LXW_CHART_ERROR_BAR_TYPE_STD_ERROR: Standard error.
|
2043
|
+
* - #LXW_CHART_ERROR_BAR_TYPE_FIXED: Fixed value.
|
2044
|
+
* - #LXW_CHART_ERROR_BAR_TYPE_PERCENTAGE: Percentage.
|
2045
|
+
* - #LXW_CHART_ERROR_BAR_TYPE_STD_DEV: Standard deviation(s).
|
2046
|
+
*
|
2047
|
+
* @note Custom error bars are not currently supported.
|
2048
|
+
*
|
2049
|
+
* All error bar types, apart from Standard error, should have a valid
|
2050
|
+
* value to set the error range:
|
2051
|
+
*
|
2052
|
+
* @code
|
2053
|
+
* chart_series_set_error_bars(series1->y_error_bars,
|
2054
|
+
* LXW_CHART_ERROR_BAR_TYPE_FIXED, 2);
|
2055
|
+
*
|
2056
|
+
* chart_series_set_error_bars(series2->y_error_bars,
|
2057
|
+
* LXW_CHART_ERROR_BAR_TYPE_PERCENTAGE, 5);
|
2058
|
+
*
|
2059
|
+
* chart_series_set_error_bars(series3->y_error_bars,
|
2060
|
+
* LXW_CHART_ERROR_BAR_TYPE_STD_DEV, 1);
|
2061
|
+
* @endcode
|
2062
|
+
*
|
2063
|
+
* For the Standard error type the value is ignored.
|
2064
|
+
*
|
2065
|
+
* For more information see @ref chart_error_bars.
|
2066
|
+
*/
|
2067
|
+
void chart_series_set_error_bars(lxw_series_error_bars *error_bars,
|
2068
|
+
uint8_t type, double value);
|
2069
|
+
|
2070
|
+
/**
|
2071
|
+
* @brief Set the direction (up, down or both) of the error bars for a chart
|
2072
|
+
* series.
|
2073
|
+
*
|
2074
|
+
* @param error_bars A pointer to the series X or Y error bars.
|
2075
|
+
* @param direction The bar direction: #lxw_chart_error_bar_direction .
|
2076
|
+
*
|
2077
|
+
* The `%chart_series_set_error_bars_direction()` function sets the
|
2078
|
+
* direction of the error bars:
|
2079
|
+
*
|
2080
|
+
* @code
|
2081
|
+
* chart_series_set_error_bars(series->y_error_bars,
|
2082
|
+
* LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
|
2083
|
+
*
|
2084
|
+
* chart_series_set_error_bars_direction(series->y_error_bars,
|
2085
|
+
* LXW_CHART_ERROR_BAR_DIR_PLUS);
|
2086
|
+
* @endcode
|
2087
|
+
*
|
2088
|
+
* @image html chart_error_bars2.png
|
2089
|
+
*
|
2090
|
+
* The valid directions are:
|
2091
|
+
*
|
2092
|
+
* - #LXW_CHART_ERROR_BAR_DIR_BOTH: Error bar extends in both directions.
|
2093
|
+
* The default.
|
2094
|
+
* - #LXW_CHART_ERROR_BAR_DIR_PLUS: Error bar extends in positive direction.
|
2095
|
+
* - #LXW_CHART_ERROR_BAR_DIR_MINUS: Error bar extends in negative direction.
|
2096
|
+
*
|
2097
|
+
* For more information see @ref chart_error_bars.
|
2098
|
+
*/
|
2099
|
+
void chart_series_set_error_bars_direction(lxw_series_error_bars *error_bars,
|
2100
|
+
uint8_t direction);
|
2101
|
+
|
2102
|
+
/**
|
2103
|
+
* @brief Set the end cap type for the error bars of a chart series.
|
2104
|
+
*
|
2105
|
+
* @param error_bars A pointer to the series X or Y error bars.
|
2106
|
+
* @param endcap The error bar end cap type: #lxw_chart_error_bar_cap .
|
2107
|
+
*
|
2108
|
+
* The `%chart_series_set_error_bars_endcap()` function sets the end cap
|
2109
|
+
* type for the error bars:
|
2110
|
+
*
|
2111
|
+
* @code
|
2112
|
+
* chart_series_set_error_bars(series->y_error_bars,
|
2113
|
+
* LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
|
2114
|
+
*
|
2115
|
+
* chart_series_set_error_bars_endcap(series->y_error_bars,
|
2116
|
+
LXW_CHART_ERROR_BAR_NO_CAP);
|
2117
|
+
* @endcode
|
2118
|
+
*
|
2119
|
+
* @image html chart_error_bars3.png
|
2120
|
+
*
|
2121
|
+
* The valid values are:
|
2122
|
+
*
|
2123
|
+
* - #LXW_CHART_ERROR_BAR_END_CAP: Flat end cap. The default.
|
2124
|
+
* - #LXW_CHART_ERROR_BAR_NO_CAP: No end cap.
|
2125
|
+
*
|
2126
|
+
* For more information see @ref chart_error_bars.
|
2127
|
+
*/
|
2128
|
+
void chart_series_set_error_bars_endcap(lxw_series_error_bars *error_bars,
|
2129
|
+
uint8_t endcap);
|
2130
|
+
|
2131
|
+
/**
|
2132
|
+
* @brief Set the line properties for a chart series error bars.
|
2133
|
+
*
|
2134
|
+
* @param error_bars A pointer to the series X or Y error bars.
|
2135
|
+
* @param line A #lxw_chart_line struct.
|
2136
|
+
*
|
2137
|
+
* The `%chart_series_set_error_bars_line()` function sets the line
|
2138
|
+
* properties for the error bars:
|
2139
|
+
*
|
2140
|
+
* @code
|
2141
|
+
* lxw_chart_line line = {.color = LXW_COLOR_RED,
|
2142
|
+
* .dash_type = LXW_CHART_LINE_DASH_ROUND_DOT};
|
2143
|
+
*
|
2144
|
+
* chart_series_set_error_bars(series->y_error_bars,
|
2145
|
+
* LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
|
2146
|
+
*
|
2147
|
+
* chart_series_set_error_bars_line(series->y_error_bars, &line);
|
2148
|
+
* @endcode
|
2149
|
+
*
|
2150
|
+
* @image html chart_error_bars4.png
|
2151
|
+
*
|
2152
|
+
* For more information see @ref chart_lines and @ref chart_error_bars.
|
2153
|
+
*/
|
2154
|
+
void chart_series_set_error_bars_line(lxw_series_error_bars *error_bars,
|
2155
|
+
lxw_chart_line *line);
|
2156
|
+
|
2157
|
+
/**
|
2158
|
+
* @brief Set the name caption of the an axis.
|
2159
|
+
*
|
2160
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2161
|
+
* @param name The name caption of the axis.
|
2162
|
+
*
|
2163
|
+
* The `%chart_axis_set_name()` function sets the name (also known as title or
|
2164
|
+
* caption) for an axis. It can be used for the X or Y axes. The name is
|
2165
|
+
* displayed below an X axis and to the side of a Y axis.
|
2166
|
+
*
|
2167
|
+
* @code
|
2168
|
+
* chart_axis_set_name(chart->x_axis, "Earnings per Quarter");
|
2169
|
+
* chart_axis_set_name(chart->y_axis, "US Dollars (Millions)");
|
2170
|
+
* @endcode
|
2171
|
+
*
|
2172
|
+
* @image html chart_axis_set_name.png
|
2173
|
+
*
|
2174
|
+
* The name parameter can also be a formula such as `=Sheet1!$A$1` to point to
|
2175
|
+
* a cell in the workbook that contains the name:
|
2176
|
+
*
|
2177
|
+
* @code
|
2178
|
+
* chart_axis_set_name(chart->x_axis, "=Sheet1!$B1$1");
|
2179
|
+
* @endcode
|
2180
|
+
*
|
2181
|
+
* See also the `chart_axis_set_name_range()` function to see how to set the
|
2182
|
+
* name formula programmatically.
|
2183
|
+
*
|
2184
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2185
|
+
* See @ref ww_charts_axes.
|
2186
|
+
*/
|
2187
|
+
void chart_axis_set_name(lxw_chart_axis *axis, const char *name);
|
2188
|
+
|
2189
|
+
/**
|
2190
|
+
* @brief Set a chart axis name formula using row and column values.
|
2191
|
+
*
|
2192
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2193
|
+
* @param sheetname The name of the worksheet that contains the cell range.
|
2194
|
+
* @param row The zero indexed row number of the range.
|
2195
|
+
* @param col The zero indexed column number of the range.
|
2196
|
+
*
|
2197
|
+
* The `%chart_axis_set_name_range()` function can be used to set an axis name
|
2198
|
+
* range and is an alternative to using `chart_axis_set_name()` and a string
|
2199
|
+
* formula:
|
2200
|
+
*
|
2201
|
+
* @code
|
2202
|
+
* chart_axis_set_name_range(chart->x_axis, "Sheet1", 1, 0);
|
2203
|
+
* chart_axis_set_name_range(chart->y_axis, "Sheet1", 2, 0);
|
2204
|
+
* @endcode
|
2205
|
+
*
|
2206
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2207
|
+
* See @ref ww_charts_axes.
|
2208
|
+
*/
|
2209
|
+
void chart_axis_set_name_range(lxw_chart_axis *axis, const char *sheetname,
|
2210
|
+
lxw_row_t row, lxw_col_t col);
|
2211
|
+
|
2212
|
+
/**
|
2213
|
+
* @brief Set the font properties for a chart axis name.
|
2214
|
+
*
|
2215
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2216
|
+
* @param font A pointer to a chart #lxw_chart_font font struct.
|
2217
|
+
*
|
2218
|
+
* The `%chart_axis_set_name_font()` function is used to set the font of an
|
2219
|
+
* axis name:
|
2220
|
+
*
|
2221
|
+
* @code
|
2222
|
+
* lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE};
|
2223
|
+
*
|
2224
|
+
* chart_axis_set_name(chart->x_axis, "Yearly data");
|
2225
|
+
* chart_axis_set_name_font(chart->x_axis, &font);
|
2226
|
+
* @endcode
|
2227
|
+
*
|
2228
|
+
* @image html chart_axis_set_name_font.png
|
2229
|
+
*
|
2230
|
+
* For more information see @ref chart_fonts.
|
2231
|
+
*
|
2232
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2233
|
+
* See @ref ww_charts_axes.
|
2234
|
+
*/
|
2235
|
+
void chart_axis_set_name_font(lxw_chart_axis *axis, lxw_chart_font *font);
|
2236
|
+
|
2237
|
+
/**
|
2238
|
+
* @brief Set the font properties for the numbers of a chart axis.
|
2239
|
+
*
|
2240
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2241
|
+
* @param font A pointer to a chart #lxw_chart_font font struct.
|
2242
|
+
*
|
2243
|
+
* The `%chart_axis_set_num_font()` function is used to set the font of the
|
2244
|
+
* numbers on an axis:
|
2245
|
+
*
|
2246
|
+
* @code
|
2247
|
+
* lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE};
|
2248
|
+
*
|
2249
|
+
* chart_axis_set_num_font(chart->x_axis, &font1);
|
2250
|
+
* @endcode
|
2251
|
+
*
|
2252
|
+
* @image html chart_axis_set_num_font.png
|
2253
|
+
*
|
2254
|
+
* For more information see @ref chart_fonts.
|
2255
|
+
*
|
2256
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2257
|
+
* See @ref ww_charts_axes.
|
2258
|
+
*/
|
2259
|
+
void chart_axis_set_num_font(lxw_chart_axis *axis, lxw_chart_font *font);
|
2260
|
+
|
2261
|
+
/**
|
2262
|
+
* @brief Set the number format for a chart axis.
|
2263
|
+
*
|
2264
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2265
|
+
* @param num_format The number format string.
|
2266
|
+
*
|
2267
|
+
* The `%chart_axis_set_num_format()` function is used to set the format of
|
2268
|
+
* the numbers on an axis:
|
2269
|
+
*
|
2270
|
+
* @code
|
2271
|
+
* chart_axis_set_num_format(chart->x_axis, "0.00%");
|
2272
|
+
* chart_axis_set_num_format(chart->y_axis, "$#,##0.00");
|
2273
|
+
* @endcode
|
2274
|
+
*
|
2275
|
+
* The number format is similar to the Worksheet Cell Format num_format,
|
2276
|
+
* see `format_set_num_format()`.
|
2277
|
+
*
|
2278
|
+
* @image html chart_axis_num_format.png
|
2279
|
+
*
|
2280
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2281
|
+
* See @ref ww_charts_axes.
|
2282
|
+
*/
|
2283
|
+
void chart_axis_set_num_format(lxw_chart_axis *axis, const char *num_format);
|
2284
|
+
|
2285
|
+
/**
|
2286
|
+
* @brief Set the line properties for a chart axis.
|
2287
|
+
*
|
2288
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2289
|
+
* @param line A #lxw_chart_line struct.
|
2290
|
+
*
|
2291
|
+
* Set the line properties of a chart axis:
|
2292
|
+
*
|
2293
|
+
* @code
|
2294
|
+
* // Hide the Y axis.
|
2295
|
+
* lxw_chart_line line = {.none = LXW_TRUE};
|
2296
|
+
*
|
2297
|
+
* chart_axis_set_line(chart->y_axis, &line);
|
2298
|
+
* @endcode
|
2299
|
+
*
|
2300
|
+
* @image html chart_axis_set_line.png
|
2301
|
+
*
|
2302
|
+
* For more information see @ref chart_lines.
|
2303
|
+
*
|
2304
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2305
|
+
* See @ref ww_charts_axes.
|
2306
|
+
*/
|
2307
|
+
void chart_axis_set_line(lxw_chart_axis *axis, lxw_chart_line *line);
|
2308
|
+
|
787
2309
|
/**
|
788
|
-
* @brief Set the
|
2310
|
+
* @brief Set the fill properties for a chart axis.
|
789
2311
|
*
|
790
2312
|
* @param axis A pointer to a chart #lxw_chart_axis object.
|
791
|
-
* @param
|
2313
|
+
* @param fill A #lxw_chart_fill struct.
|
792
2314
|
*
|
793
|
-
*
|
794
|
-
* axis name:
|
2315
|
+
* Set the fill properties of a chart axis:
|
795
2316
|
*
|
796
2317
|
* @code
|
797
|
-
*
|
2318
|
+
* lxw_chart_fill fill = {.color = LXW_COLOR_YELLOW};
|
798
2319
|
*
|
799
|
-
*
|
800
|
-
* chart_axis_set_name_font(chart->x_axis, &font);
|
2320
|
+
* chart_axis_set_fill(chart->y_axis, &fill);
|
801
2321
|
* @endcode
|
802
2322
|
*
|
803
|
-
* @image html
|
2323
|
+
* @image html chart_axis_set_fill.png
|
804
2324
|
*
|
805
|
-
* For more information see @ref
|
2325
|
+
* For more information see @ref chart_fills.
|
2326
|
+
*
|
2327
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2328
|
+
* See @ref ww_charts_axes.
|
806
2329
|
*/
|
807
|
-
void
|
2330
|
+
void chart_axis_set_fill(lxw_chart_axis *axis, lxw_chart_fill *fill);
|
808
2331
|
|
809
2332
|
/**
|
810
|
-
* @brief Set the
|
2333
|
+
* @brief Set the pattern properties for a chart axis.
|
2334
|
+
*
|
2335
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2336
|
+
* @param pattern A #lxw_chart_pattern struct.
|
2337
|
+
*
|
2338
|
+
* Set the pattern properties of a chart axis:
|
2339
|
+
*
|
2340
|
+
* @code
|
2341
|
+
* chart_axis_set_pattern(chart->y_axis, &pattern);
|
2342
|
+
* @endcode
|
2343
|
+
*
|
2344
|
+
* For more information see #lxw_chart_pattern_type and @ref chart_patterns.
|
2345
|
+
*
|
2346
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2347
|
+
* See @ref ww_charts_axes.
|
2348
|
+
*/
|
2349
|
+
void chart_axis_set_pattern(lxw_chart_axis *axis, lxw_chart_pattern *pattern);
|
2350
|
+
|
2351
|
+
/**
|
2352
|
+
* @brief Reverse the order of the axis categories or values.
|
811
2353
|
*
|
812
2354
|
* @param axis A pointer to a chart #lxw_chart_axis object.
|
813
|
-
* @param font A pointer to a chart #lxw_chart_font font struct.
|
814
2355
|
*
|
815
|
-
*
|
816
|
-
*
|
2356
|
+
* Reverse the order of the axis categories or values:
|
2357
|
+
*
|
2358
|
+
* @code
|
2359
|
+
* chart_axis_set_reverse(chart->x_axis);
|
2360
|
+
* @endcode
|
2361
|
+
*
|
2362
|
+
* @image html chart_reverse.png
|
2363
|
+
*
|
2364
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2365
|
+
* See @ref ww_charts_axes.
|
2366
|
+
*/
|
2367
|
+
void chart_axis_set_reverse(lxw_chart_axis *axis);
|
2368
|
+
|
2369
|
+
/**
|
2370
|
+
* @brief Set the position that the axis will cross the opposite axis.
|
2371
|
+
*
|
2372
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2373
|
+
* @param value The category or value that the axis crosses at.
|
2374
|
+
*
|
2375
|
+
* Set the position that the axis will cross the opposite axis:
|
2376
|
+
*
|
2377
|
+
* @code
|
2378
|
+
* chart_axis_set_crossing(chart->x_axis, 3);
|
2379
|
+
* chart_axis_set_crossing(chart->y_axis, 8);
|
2380
|
+
* @endcode
|
2381
|
+
*
|
2382
|
+
* @image html chart_crossing1.png
|
2383
|
+
*
|
2384
|
+
* If crossing is omitted (the default) the crossing will be set automatically
|
2385
|
+
* by Excel based on the chart data.
|
2386
|
+
*
|
2387
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2388
|
+
* See @ref ww_charts_axes.
|
2389
|
+
*/
|
2390
|
+
void chart_axis_set_crossing(lxw_chart_axis *axis, double value);
|
2391
|
+
|
2392
|
+
/**
|
2393
|
+
* @brief Set the opposite axis crossing position as the axis maximum.
|
2394
|
+
*
|
2395
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2396
|
+
*
|
2397
|
+
* Set the position that the opposite axis will cross as the axis maximum.
|
2398
|
+
* The default axis crossing position is generally the axis minimum so this
|
2399
|
+
* function can be used to reverse the location of the axes without reversing
|
2400
|
+
* the number sequence:
|
2401
|
+
*
|
2402
|
+
* @code
|
2403
|
+
* chart_axis_set_crossing_max(chart->x_axis);
|
2404
|
+
* chart_axis_set_crossing_max(chart->y_axis);
|
2405
|
+
* @endcode
|
2406
|
+
*
|
2407
|
+
* @image html chart_crossing2.png
|
2408
|
+
*
|
2409
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2410
|
+
* See @ref ww_charts_axes.
|
2411
|
+
*/
|
2412
|
+
void chart_axis_set_crossing_max(lxw_chart_axis *axis);
|
2413
|
+
|
2414
|
+
/**
|
2415
|
+
* @brief Turn off/hide an axis.
|
2416
|
+
*
|
2417
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2418
|
+
*
|
2419
|
+
* Turn off, hide, a chart axis:
|
2420
|
+
*
|
2421
|
+
* @code
|
2422
|
+
* chart_axis_off(chart->x_axis);
|
2423
|
+
* @endcode
|
2424
|
+
*
|
2425
|
+
* @image html chart_axis_off.png
|
2426
|
+
*
|
2427
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2428
|
+
* See @ref ww_charts_axes.
|
2429
|
+
*/
|
2430
|
+
void chart_axis_off(lxw_chart_axis *axis);
|
2431
|
+
|
2432
|
+
/**
|
2433
|
+
* @brief Position a category axis on or between the axis tick marks.
|
2434
|
+
*
|
2435
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2436
|
+
* @param position A #lxw_chart_axis_tick_position value.
|
2437
|
+
*
|
2438
|
+
* Position a category axis horizontally on, or between, the axis tick marks.
|
2439
|
+
*
|
2440
|
+
* There are two allowable values:
|
2441
|
+
*
|
2442
|
+
* - #LXW_CHART_AXIS_POSITION_ON_TICK
|
2443
|
+
* - #LXW_CHART_AXIS_POSITION_BETWEEN
|
2444
|
+
*
|
2445
|
+
* @code
|
2446
|
+
* chart_axis_set_position(chart->x_axis, LXW_CHART_AXIS_POSITION_BETWEEN);
|
2447
|
+
* @endcode
|
2448
|
+
*
|
2449
|
+
* @image html chart_axis_set_position.png
|
2450
|
+
*
|
2451
|
+
* **Axis types**: This function is applicable to category axes only.
|
2452
|
+
* See @ref ww_charts_axes.
|
2453
|
+
*/
|
2454
|
+
void chart_axis_set_position(lxw_chart_axis *axis, uint8_t position);
|
2455
|
+
|
2456
|
+
/**
|
2457
|
+
* @brief Position the axis labels.
|
2458
|
+
*
|
2459
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2460
|
+
* @param position A #lxw_chart_axis_label_position value.
|
2461
|
+
*
|
2462
|
+
* Position the axis labels for the chart. The labels are the numbers, or
|
2463
|
+
* strings or dates, on the axis that indicate the categories or values of
|
2464
|
+
* the axis.
|
2465
|
+
*
|
2466
|
+
* For example:
|
2467
|
+
*
|
2468
|
+
* @code
|
2469
|
+
* chart_axis_set_label_position(chart->x_axis, LXW_CHART_AXIS_LABEL_POSITION_HIGH);
|
2470
|
+
chart_axis_set_label_position(chart->y_axis, LXW_CHART_AXIS_LABEL_POSITION_HIGH);
|
2471
|
+
* @endcode
|
2472
|
+
*
|
2473
|
+
* @image html chart_label_position2.png
|
2474
|
+
*
|
2475
|
+
* The allowable values:
|
2476
|
+
*
|
2477
|
+
* - #LXW_CHART_AXIS_LABEL_POSITION_NEXT_TO - The default.
|
2478
|
+
* - #LXW_CHART_AXIS_LABEL_POSITION_HIGH - Also right for vertical axes.
|
2479
|
+
* - #LXW_CHART_AXIS_LABEL_POSITION_LOW - Also left for vertical axes.
|
2480
|
+
* - #LXW_CHART_AXIS_LABEL_POSITION_NONE
|
2481
|
+
*
|
2482
|
+
* @image html chart_label_position1.png
|
2483
|
+
*
|
2484
|
+
* The #LXW_CHART_AXIS_LABEL_POSITION_NONE turns off the axis labels. This
|
2485
|
+
* is slightly different from `chart_axis_off()` which also turns off the
|
2486
|
+
* labels but also turns off tick marks.
|
2487
|
+
*
|
2488
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2489
|
+
* See @ref ww_charts_axes.
|
2490
|
+
*/
|
2491
|
+
void chart_axis_set_label_position(lxw_chart_axis *axis, uint8_t position);
|
2492
|
+
|
2493
|
+
/**
|
2494
|
+
* @brief Set the minimum value for a chart axis.
|
2495
|
+
*
|
2496
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2497
|
+
* @param min Minimum value for chart axis. Value axes only.
|
2498
|
+
*
|
2499
|
+
* Set the minimum value for the axis range.
|
2500
|
+
*
|
2501
|
+
* @code
|
2502
|
+
* chart_axis_set_min(chart->y_axis, -4);
|
2503
|
+
* chart_axis_set_max(chart->y_axis, 21);
|
2504
|
+
* @endcode
|
2505
|
+
*
|
2506
|
+
* @image html chart_max_min.png
|
2507
|
+
*
|
2508
|
+
* **Axis types**: This function is applicable to value and date axes only.
|
2509
|
+
* See @ref ww_charts_axes.
|
2510
|
+
*/
|
2511
|
+
void chart_axis_set_min(lxw_chart_axis *axis, double min);
|
2512
|
+
|
2513
|
+
/**
|
2514
|
+
* @brief Set the maximum value for a chart axis.
|
2515
|
+
*
|
2516
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2517
|
+
* @param max Maximum value for chart axis. Value axes only.
|
2518
|
+
*
|
2519
|
+
* Set the maximum value for the axis range.
|
2520
|
+
*
|
2521
|
+
* @code
|
2522
|
+
* chart_axis_set_min(chart->y_axis, -4);
|
2523
|
+
* chart_axis_set_max(chart->y_axis, 21);
|
2524
|
+
* @endcode
|
2525
|
+
*
|
2526
|
+
* See the above image.
|
2527
|
+
*
|
2528
|
+
* **Axis types**: This function is applicable to value and date axes only.
|
2529
|
+
* See @ref ww_charts_axes.
|
2530
|
+
*/
|
2531
|
+
void chart_axis_set_max(lxw_chart_axis *axis, double max);
|
2532
|
+
|
2533
|
+
/**
|
2534
|
+
* @brief Set the log base of the axis range.
|
2535
|
+
*
|
2536
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2537
|
+
* @param log_base The log base for value axis. Value axes only.
|
2538
|
+
*
|
2539
|
+
* Set the log base for the axis:
|
2540
|
+
*
|
2541
|
+
* @code
|
2542
|
+
* chart_axis_set_log_base(chart->y_axis, 10);
|
2543
|
+
* @endcode
|
2544
|
+
*
|
2545
|
+
* @image html chart_log_base.png
|
2546
|
+
*
|
2547
|
+
* The allowable range of values for the log base in Excel is between 2 and
|
2548
|
+
* 1000.
|
2549
|
+
*
|
2550
|
+
* **Axis types**: This function is applicable to value axes only.
|
2551
|
+
* See @ref ww_charts_axes.
|
2552
|
+
*/
|
2553
|
+
void chart_axis_set_log_base(lxw_chart_axis *axis, uint16_t log_base);
|
2554
|
+
|
2555
|
+
/**
|
2556
|
+
* @brief Set the major axis tick mark type.
|
2557
|
+
*
|
2558
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2559
|
+
* @param type The tick mark type, defined by #lxw_chart_tick_mark.
|
2560
|
+
*
|
2561
|
+
* Set the type of the major axis tick mark:
|
2562
|
+
*
|
2563
|
+
* @code
|
2564
|
+
* chart_axis_set_major_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_CROSSING);
|
2565
|
+
* chart_axis_set_minor_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_INSIDE);
|
2566
|
+
*
|
2567
|
+
* chart_axis_set_major_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_OUTSIDE);
|
2568
|
+
* chart_axis_set_minor_tick_mark(chart->y_axis, LXW_CHART_AXIS_TICK_MARK_INSIDE);
|
2569
|
+
*
|
2570
|
+
* // Hide the default gridlines so the tick marks are visible.
|
2571
|
+
* chart_axis_major_gridlines_set_visible(chart->y_axis, LXW_FALSE);
|
2572
|
+
* @endcode
|
2573
|
+
*
|
2574
|
+
* @image html chart_tick_marks.png
|
2575
|
+
*
|
2576
|
+
* The tick mark types are:
|
2577
|
+
*
|
2578
|
+
* - #LXW_CHART_AXIS_TICK_MARK_NONE
|
2579
|
+
* - #LXW_CHART_AXIS_TICK_MARK_INSIDE
|
2580
|
+
* - #LXW_CHART_AXIS_TICK_MARK_OUTSIDE
|
2581
|
+
* - #LXW_CHART_AXIS_TICK_MARK_CROSSING
|
2582
|
+
*
|
2583
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2584
|
+
* See @ref ww_charts_axes.
|
2585
|
+
*/
|
2586
|
+
void chart_axis_set_major_tick_mark(lxw_chart_axis *axis, uint8_t type);
|
2587
|
+
|
2588
|
+
/**
|
2589
|
+
* @brief Set the minor axis tick mark type.
|
2590
|
+
*
|
2591
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2592
|
+
* @param type The tick mark type, defined by #lxw_chart_tick_mark.
|
2593
|
+
*
|
2594
|
+
* Set the type of the minor axis tick mark:
|
2595
|
+
*
|
2596
|
+
* @code
|
2597
|
+
* chart_axis_set_minor_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_INSIDE);
|
2598
|
+
* @endcode
|
2599
|
+
*
|
2600
|
+
* See the image and example above.
|
2601
|
+
*
|
2602
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2603
|
+
* See @ref ww_charts_axes.
|
2604
|
+
*/
|
2605
|
+
void chart_axis_set_minor_tick_mark(lxw_chart_axis *axis, uint8_t type);
|
2606
|
+
|
2607
|
+
/**
|
2608
|
+
* @brief Set the interval between category values.
|
2609
|
+
*
|
2610
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2611
|
+
* @param unit The interval between the categories.
|
2612
|
+
*
|
2613
|
+
* Set the interval between the category values. The default interval is 1
|
2614
|
+
* which gives the intervals shown in the charts above:
|
2615
|
+
*
|
2616
|
+
* 1, 2, 3, 4, 5, etc.
|
2617
|
+
*
|
2618
|
+
* Setting it to 2 gives:
|
2619
|
+
*
|
2620
|
+
* 1, 3, 5, 7, etc.
|
2621
|
+
*
|
2622
|
+
* For example:
|
2623
|
+
*
|
2624
|
+
* @code
|
2625
|
+
* chart_axis_set_interval_unit(chart->x_axis, 2);
|
2626
|
+
* @endcode
|
2627
|
+
*
|
2628
|
+
* @image html chart_set_interval1.png
|
2629
|
+
*
|
2630
|
+
* **Axis types**: This function is applicable to category and date axes only.
|
2631
|
+
* See @ref ww_charts_axes.
|
2632
|
+
*/
|
2633
|
+
void chart_axis_set_interval_unit(lxw_chart_axis *axis, uint16_t unit);
|
2634
|
+
|
2635
|
+
/**
|
2636
|
+
* @brief Set the interval between category tick marks.
|
2637
|
+
*
|
2638
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2639
|
+
* @param unit The interval between the category ticks.
|
2640
|
+
*
|
2641
|
+
* Set the interval between the category tick marks. The default interval is 1
|
2642
|
+
* between each category but it can be set to other integer values:
|
2643
|
+
*
|
2644
|
+
* @code
|
2645
|
+
* chart_axis_set_interval_tick(chart->x_axis, 2);
|
2646
|
+
* @endcode
|
2647
|
+
*
|
2648
|
+
* @image html chart_set_interval2.png
|
2649
|
+
*
|
2650
|
+
* **Axis types**: This function is applicable to category and date axes only.
|
2651
|
+
* See @ref ww_charts_axes.
|
2652
|
+
*/
|
2653
|
+
void chart_axis_set_interval_tick(lxw_chart_axis *axis, uint16_t unit);
|
2654
|
+
|
2655
|
+
/**
|
2656
|
+
* @brief Set the increment of the major units in the axis.
|
2657
|
+
*
|
2658
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2659
|
+
* @param unit The increment of the major units.
|
2660
|
+
*
|
2661
|
+
* Set the increment of the major units in the axis range.
|
2662
|
+
*
|
2663
|
+
* @code
|
2664
|
+
* // Turn on the minor gridline (it is off by default).
|
2665
|
+
* chart_axis_minor_gridlines_set_visible(chart->y_axis, LXW_TRUE);
|
2666
|
+
*
|
2667
|
+
* chart_axis_set_major_unit(chart->y_axis, 4);
|
2668
|
+
* chart_axis_set_minor_unit(chart->y_axis, 2);
|
2669
|
+
* @endcode
|
2670
|
+
*
|
2671
|
+
* @image html chart_set_major_units.png
|
2672
|
+
*
|
2673
|
+
* **Axis types**: This function is applicable to value and date axes only.
|
2674
|
+
* See @ref ww_charts_axes.
|
2675
|
+
*/
|
2676
|
+
void chart_axis_set_major_unit(lxw_chart_axis *axis, double unit);
|
2677
|
+
|
2678
|
+
/**
|
2679
|
+
* @brief Set the increment of the minor units in the axis.
|
2680
|
+
*
|
2681
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2682
|
+
* @param unit The increment of the minor units.
|
2683
|
+
*
|
2684
|
+
* Set the increment of the minor units in the axis range.
|
2685
|
+
*
|
2686
|
+
* @code
|
2687
|
+
* chart_axis_set_minor_unit(chart->y_axis, 2);
|
2688
|
+
* @endcode
|
2689
|
+
*
|
2690
|
+
* See the image above
|
2691
|
+
*
|
2692
|
+
* **Axis types**: This function is applicable to value and date axes only.
|
2693
|
+
* See @ref ww_charts_axes.
|
2694
|
+
*/
|
2695
|
+
void chart_axis_set_minor_unit(lxw_chart_axis *axis, double unit);
|
2696
|
+
|
2697
|
+
/**
|
2698
|
+
* @brief Set the display units for a value axis.
|
2699
|
+
*
|
2700
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2701
|
+
* @param units The display units: #lxw_chart_axis_display_unit.
|
2702
|
+
*
|
2703
|
+
* Set the display units for the axis. This can be useful if the axis numbers
|
2704
|
+
* are very large but you don't want to represent them in scientific notation:
|
2705
|
+
*
|
2706
|
+
* @code
|
2707
|
+
* chart_axis_set_display_units(chart->x_axis, LXW_CHART_AXIS_UNITS_THOUSANDS);
|
2708
|
+
* chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_MILLIONS);
|
2709
|
+
* @endcode
|
2710
|
+
*
|
2711
|
+
* @image html chart_display_units.png
|
2712
|
+
*
|
2713
|
+
* **Axis types**: This function is applicable to value axes only.
|
2714
|
+
* See @ref ww_charts_axes.
|
2715
|
+
*/
|
2716
|
+
void chart_axis_set_display_units(lxw_chart_axis *axis, uint8_t units);
|
2717
|
+
|
2718
|
+
/**
|
2719
|
+
* @brief Turn on/off the display units for a value axis.
|
2720
|
+
|
2721
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2722
|
+
* @param visible Turn off/on the display units. (0/1)
|
2723
|
+
*
|
2724
|
+
* Turn on or off the display units for the axis. This option is set on
|
2725
|
+
* automatically by `chart_axis_set_display_units()`.
|
2726
|
+
*
|
2727
|
+
* @code
|
2728
|
+
* chart_axis_set_display_units_visible(chart->y_axis, LXW_TRUE);
|
2729
|
+
* @endcode
|
2730
|
+
*
|
2731
|
+
* **Axis types**: This function is applicable to value axes only.
|
2732
|
+
* See @ref ww_charts_axes.
|
2733
|
+
*/
|
2734
|
+
void chart_axis_set_display_units_visible(lxw_chart_axis *axis,
|
2735
|
+
uint8_t visible);
|
2736
|
+
|
2737
|
+
/**
|
2738
|
+
* @brief Turn on/off the major gridlines for an axis.
|
2739
|
+
*
|
2740
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2741
|
+
* @param visible Turn off/on the major gridline. (0/1)
|
2742
|
+
*
|
2743
|
+
* Turn on or off the major gridlines for an X or Y axis. In most Excel charts
|
2744
|
+
* the Y axis major gridlines are on by default and the X axis major
|
2745
|
+
* gridlines are off by default.
|
2746
|
+
*
|
2747
|
+
* Example:
|
2748
|
+
*
|
2749
|
+
* @code
|
2750
|
+
* // Reverse the normal visible/hidden gridlines for a column chart.
|
2751
|
+
* chart_axis_major_gridlines_set_visible(chart->x_axis, LXW_TRUE);
|
2752
|
+
* chart_axis_major_gridlines_set_visible(chart->y_axis, LXW_FALSE);
|
2753
|
+
* @endcode
|
2754
|
+
*
|
2755
|
+
* @image html chart_gridline1.png
|
2756
|
+
*
|
2757
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2758
|
+
* See @ref ww_charts_axes.
|
2759
|
+
*/
|
2760
|
+
void chart_axis_major_gridlines_set_visible(lxw_chart_axis *axis,
|
2761
|
+
uint8_t visible);
|
2762
|
+
|
2763
|
+
/**
|
2764
|
+
* @brief Turn on/off the minor gridlines for an axis.
|
2765
|
+
*
|
2766
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
2767
|
+
* @param visible Turn off/on the minor gridline. (0/1)
|
2768
|
+
*
|
2769
|
+
* Turn on or off the minor gridlines for an X or Y axis. In most Excel charts
|
2770
|
+
* the X and Y axis minor gridlines are off by default.
|
2771
|
+
*
|
2772
|
+
* Example, turn on all major and minor gridlines:
|
817
2773
|
*
|
818
2774
|
* @code
|
819
|
-
*
|
820
|
-
*
|
821
|
-
*
|
2775
|
+
* chart_axis_major_gridlines_set_visible(chart->x_axis, LXW_TRUE);
|
2776
|
+
* chart_axis_minor_gridlines_set_visible(chart->x_axis, LXW_TRUE);
|
2777
|
+
* chart_axis_major_gridlines_set_visible(chart->y_axis, LXW_TRUE);
|
2778
|
+
* chart_axis_minor_gridlines_set_visible(chart->y_axis, LXW_TRUE);
|
822
2779
|
* @endcode
|
823
2780
|
*
|
824
|
-
* @image html
|
2781
|
+
* @image html chart_gridline2.png
|
825
2782
|
*
|
826
|
-
*
|
2783
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2784
|
+
* See @ref ww_charts_axes.
|
827
2785
|
*/
|
828
|
-
void
|
2786
|
+
void chart_axis_minor_gridlines_set_visible(lxw_chart_axis *axis,
|
2787
|
+
uint8_t visible);
|
829
2788
|
|
830
2789
|
/**
|
831
|
-
* @brief Set the line properties for
|
2790
|
+
* @brief Set the line properties for the chart axis major gridlines.
|
832
2791
|
*
|
833
2792
|
* @param axis A pointer to a chart #lxw_chart_axis object.
|
834
2793
|
* @param line A #lxw_chart_line struct.
|
835
2794
|
*
|
836
|
-
*
|
2795
|
+
* Format the line properties of the major gridlines of a chart:
|
837
2796
|
*
|
838
2797
|
* @code
|
839
|
-
*
|
840
|
-
*
|
2798
|
+
* lxw_chart_line line1 = {.color = LXW_COLOR_RED,
|
2799
|
+
* .width = 0.5,
|
2800
|
+
* .dash_type = LXW_CHART_LINE_DASH_SQUARE_DOT};
|
841
2801
|
*
|
842
|
-
*
|
2802
|
+
* lxw_chart_line line2 = {.color = LXW_COLOR_YELLOW};
|
2803
|
+
*
|
2804
|
+
* lxw_chart_line line3 = {.width = 1.25,
|
2805
|
+
* .dash_type = LXW_CHART_LINE_DASH_DASH};
|
2806
|
+
*
|
2807
|
+
* lxw_chart_line line4 = {.color = 0x00B050};
|
2808
|
+
*
|
2809
|
+
* chart_axis_major_gridlines_set_line(chart->x_axis, &line1);
|
2810
|
+
* chart_axis_minor_gridlines_set_line(chart->x_axis, &line2);
|
2811
|
+
* chart_axis_major_gridlines_set_line(chart->y_axis, &line3);
|
2812
|
+
* chart_axis_minor_gridlines_set_line(chart->y_axis, &line4);
|
843
2813
|
* @endcode
|
844
2814
|
*
|
845
|
-
* @image html
|
2815
|
+
* @image html chart_gridline3.png
|
846
2816
|
*
|
847
2817
|
* For more information see @ref chart_lines.
|
2818
|
+
*
|
2819
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2820
|
+
* See @ref ww_charts_axes.
|
848
2821
|
*/
|
849
|
-
void
|
2822
|
+
void chart_axis_major_gridlines_set_line(lxw_chart_axis *axis,
|
2823
|
+
lxw_chart_line *line);
|
850
2824
|
|
851
2825
|
/**
|
852
|
-
* @brief Set the
|
2826
|
+
* @brief Set the line properties for the chart axis minor gridlines.
|
853
2827
|
*
|
854
2828
|
* @param axis A pointer to a chart #lxw_chart_axis object.
|
855
|
-
* @param
|
856
|
-
*
|
857
|
-
* Set the fill properties of a chart axis:
|
858
|
-
*
|
859
|
-
* @code
|
860
|
-
* lxw_chart_fill fill = {.color = LXW_COLOR_YELLOW};
|
2829
|
+
* @param line A #lxw_chart_line struct.
|
861
2830
|
*
|
862
|
-
*
|
863
|
-
*
|
2831
|
+
* Format the line properties of the minor gridlines of a chart, see the
|
2832
|
+
* example above.
|
864
2833
|
*
|
865
|
-
* @
|
2834
|
+
* For more information see @ref chart_lines.
|
866
2835
|
*
|
867
|
-
*
|
2836
|
+
* **Axis types**: This function is applicable to to all axes types.
|
2837
|
+
* See @ref ww_charts_axes.
|
868
2838
|
*/
|
869
|
-
void
|
2839
|
+
void chart_axis_minor_gridlines_set_line(lxw_chart_axis *axis,
|
2840
|
+
lxw_chart_line *line);
|
870
2841
|
|
871
2842
|
/**
|
872
2843
|
* @brief Set the title of the chart.
|
@@ -1040,6 +3011,124 @@ void chart_legend_set_font(lxw_chart *chart, lxw_chart_font *font);
|
|
1040
3011
|
lxw_error chart_legend_delete_series(lxw_chart *chart,
|
1041
3012
|
int16_t delete_series[]);
|
1042
3013
|
|
3014
|
+
/**
|
3015
|
+
* @brief Set the line properties for a chartarea.
|
3016
|
+
*
|
3017
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3018
|
+
* @param line A #lxw_chart_line struct.
|
3019
|
+
*
|
3020
|
+
* Set the line/border properties of a chartarea. In Excel the chartarea
|
3021
|
+
* is the background area behind the chart:
|
3022
|
+
*
|
3023
|
+
* @code
|
3024
|
+
* lxw_chart_line line = {.none = LXW_TRUE};
|
3025
|
+
* lxw_chart_fill fill = {.color = LXW_COLOR_RED};
|
3026
|
+
*
|
3027
|
+
* chart_chartarea_set_line(chart, &line);
|
3028
|
+
* chart_chartarea_set_fill(chart, &fill);
|
3029
|
+
* @endcode
|
3030
|
+
*
|
3031
|
+
* @image html chart_chartarea.png
|
3032
|
+
*
|
3033
|
+
* For more information see @ref chart_lines.
|
3034
|
+
*/
|
3035
|
+
void chart_chartarea_set_line(lxw_chart *chart, lxw_chart_line *line);
|
3036
|
+
|
3037
|
+
/**
|
3038
|
+
* @brief Set the fill properties for a chartarea.
|
3039
|
+
*
|
3040
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3041
|
+
* @param fill A #lxw_chart_fill struct.
|
3042
|
+
*
|
3043
|
+
* Set the fill properties of a chartarea:
|
3044
|
+
*
|
3045
|
+
* @code
|
3046
|
+
* chart_chartarea_set_fill(chart, &fill);
|
3047
|
+
* @endcode
|
3048
|
+
*
|
3049
|
+
* See the example and image above.
|
3050
|
+
*
|
3051
|
+
* For more information see @ref chart_fills.
|
3052
|
+
*/
|
3053
|
+
void chart_chartarea_set_fill(lxw_chart *chart, lxw_chart_fill *fill);
|
3054
|
+
|
3055
|
+
/**
|
3056
|
+
* @brief Set the pattern properties for a chartarea.
|
3057
|
+
*
|
3058
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3059
|
+
* @param pattern A #lxw_chart_pattern struct.
|
3060
|
+
*
|
3061
|
+
* Set the pattern properties of a chartarea:
|
3062
|
+
*
|
3063
|
+
* @code
|
3064
|
+
* chart_chartarea_set_pattern(series1, &pattern);
|
3065
|
+
* @endcode
|
3066
|
+
*
|
3067
|
+
* For more information see #lxw_chart_pattern_type and @ref chart_patterns.
|
3068
|
+
*/
|
3069
|
+
void chart_chartarea_set_pattern(lxw_chart *chart,
|
3070
|
+
lxw_chart_pattern *pattern);
|
3071
|
+
|
3072
|
+
/**
|
3073
|
+
* @brief Set the line properties for a plotarea.
|
3074
|
+
*
|
3075
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3076
|
+
* @param line A #lxw_chart_line struct.
|
3077
|
+
*
|
3078
|
+
* Set the line/border properties of a plotarea. In Excel the plotarea is
|
3079
|
+
* the area between the axes on which the chart series are plotted:
|
3080
|
+
*
|
3081
|
+
* @code
|
3082
|
+
* lxw_chart_line line = {.color = LXW_COLOR_RED,
|
3083
|
+
* .width = 2,
|
3084
|
+
* .dash_type = LXW_CHART_LINE_DASH_DASH};
|
3085
|
+
* lxw_chart_fill fill = {.color = 0xFFFFC2};
|
3086
|
+
*
|
3087
|
+
* chart_plotarea_set_line(chart, &line);
|
3088
|
+
* chart_plotarea_set_fill(chart, &fill);
|
3089
|
+
*
|
3090
|
+
* @endcode
|
3091
|
+
*
|
3092
|
+
* @image html chart_plotarea.png
|
3093
|
+
*
|
3094
|
+
* For more information see @ref chart_lines.
|
3095
|
+
*/
|
3096
|
+
void chart_plotarea_set_line(lxw_chart *chart, lxw_chart_line *line);
|
3097
|
+
|
3098
|
+
/**
|
3099
|
+
* @brief Set the fill properties for a plotarea.
|
3100
|
+
*
|
3101
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3102
|
+
* @param fill A #lxw_chart_fill struct.
|
3103
|
+
*
|
3104
|
+
* Set the fill properties of a plotarea:
|
3105
|
+
*
|
3106
|
+
* @code
|
3107
|
+
* chart_plotarea_set_fill(chart, &fill);
|
3108
|
+
* @endcode
|
3109
|
+
*
|
3110
|
+
* See the example and image above.
|
3111
|
+
*
|
3112
|
+
* For more information see @ref chart_fills.
|
3113
|
+
*/
|
3114
|
+
void chart_plotarea_set_fill(lxw_chart *chart, lxw_chart_fill *fill);
|
3115
|
+
|
3116
|
+
/**
|
3117
|
+
* @brief Set the pattern properties for a plotarea.
|
3118
|
+
*
|
3119
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3120
|
+
* @param pattern A #lxw_chart_pattern struct.
|
3121
|
+
*
|
3122
|
+
* Set the pattern properties of a plotarea:
|
3123
|
+
*
|
3124
|
+
* @code
|
3125
|
+
* chart_plotarea_set_pattern(series1, &pattern);
|
3126
|
+
* @endcode
|
3127
|
+
*
|
3128
|
+
* For more information see #lxw_chart_pattern_type and @ref chart_patterns.
|
3129
|
+
*/
|
3130
|
+
void chart_plotarea_set_pattern(lxw_chart *chart, lxw_chart_pattern *pattern);
|
3131
|
+
|
1043
3132
|
/**
|
1044
3133
|
* @brief Set the chart style type.
|
1045
3134
|
*
|
@@ -1066,15 +3155,310 @@ lxw_error chart_legend_delete_series(lxw_chart *chart,
|
|
1066
3155
|
* to the base chart type. They can not be defined by the `chart_set_style()``
|
1067
3156
|
* function.
|
1068
3157
|
*
|
1069
|
-
*
|
1070
3158
|
*/
|
1071
3159
|
void chart_set_style(lxw_chart *chart, uint8_t style_id);
|
1072
3160
|
|
3161
|
+
/**
|
3162
|
+
* @brief Turn on a data table below the horizontal axis.
|
3163
|
+
*
|
3164
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3165
|
+
*
|
3166
|
+
* The `%chart_set_table()` function adds a data table below the horizontal
|
3167
|
+
* axis with the data used to plot the chart:
|
3168
|
+
*
|
3169
|
+
* @code
|
3170
|
+
* // Turn on the data table with default options.
|
3171
|
+
* chart_set_table(chart);
|
3172
|
+
* @endcode
|
3173
|
+
*
|
3174
|
+
* @image html chart_data_table1.png
|
3175
|
+
*
|
3176
|
+
* The data table can only be shown with Bar, Column, Line and Area charts.
|
3177
|
+
*
|
3178
|
+
*/
|
3179
|
+
void chart_set_table(lxw_chart *chart);
|
3180
|
+
|
3181
|
+
/**
|
3182
|
+
* @brief Turn on/off grid options for a chart data table.
|
3183
|
+
*
|
3184
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3185
|
+
* @param horizontal Turn on/off the horizontal grid lines in the table.
|
3186
|
+
* @param vertical Turn on/off the vertical grid lines in the table.
|
3187
|
+
* @param outline Turn on/off the outline lines in the table.
|
3188
|
+
* @param legend_keys Turn on/off the legend keys in the table.
|
3189
|
+
*
|
3190
|
+
* The `%chart_set_table_grid()` function turns on/off grid options for a
|
3191
|
+
* chart data table. The data table grid options in Excel are shown in the
|
3192
|
+
* dialog below:
|
3193
|
+
*
|
3194
|
+
* @image html chart_data_table3.png
|
3195
|
+
*
|
3196
|
+
* These options can be passed to the `%chart_set_table_grid()` function.
|
3197
|
+
* The values for a default chart are:
|
3198
|
+
*
|
3199
|
+
* - `horizontal`: On.
|
3200
|
+
* - `vertical`: On.
|
3201
|
+
* - `outline`: On.
|
3202
|
+
* - `legend_keys`: Off.
|
3203
|
+
*
|
3204
|
+
* Example:
|
3205
|
+
*
|
3206
|
+
* @code
|
3207
|
+
* // Turn on the data table with default options.
|
3208
|
+
* chart_set_table(chart);
|
3209
|
+
*
|
3210
|
+
* // Turn on all grid lines and the grid legend.
|
3211
|
+
* chart_set_table_grid(chart, LXW_TRUE, LXW_TRUE, LXW_TRUE, LXW_TRUE);
|
3212
|
+
*
|
3213
|
+
* // Turn off the legend since it is show in the table.
|
3214
|
+
* chart_legend_set_position(chart, LXW_CHART_LEGEND_NONE);
|
3215
|
+
*
|
3216
|
+
* @endcode
|
3217
|
+
*
|
3218
|
+
* @image html chart_data_table2.png
|
3219
|
+
*
|
3220
|
+
* The data table can only be shown with Bar, Column, Line and Area charts.
|
3221
|
+
*
|
3222
|
+
*/
|
3223
|
+
void chart_set_table_grid(lxw_chart *chart, uint8_t horizontal,
|
3224
|
+
uint8_t vertical, uint8_t outline,
|
3225
|
+
uint8_t legend_keys);
|
3226
|
+
|
3227
|
+
void chart_set_table_font(lxw_chart *chart, lxw_chart_font *font);
|
3228
|
+
|
3229
|
+
/**
|
3230
|
+
* @brief Turn on up-down bars for the chart.
|
3231
|
+
*
|
3232
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3233
|
+
*
|
3234
|
+
* The `%chart_set_up_down_bars()` function adds Up-Down bars to Line charts
|
3235
|
+
* to indicate the difference between the first and last data series:
|
3236
|
+
*
|
3237
|
+
* @code
|
3238
|
+
* chart_set_up_down_bars(chart);
|
3239
|
+
* @endcode
|
3240
|
+
*
|
3241
|
+
* @image html chart_data_tools4.png
|
3242
|
+
*
|
3243
|
+
* Up-Down bars are only available in Line charts. By default Up-Down bars are
|
3244
|
+
* black and white like in the above example. To format the border or fill
|
3245
|
+
* of the bars see the `chart_set_up_down_bars_format()` function below.
|
3246
|
+
*/
|
3247
|
+
void chart_set_up_down_bars(lxw_chart *chart);
|
3248
|
+
|
3249
|
+
/**
|
3250
|
+
* @brief Turn on up-down bars for the chart, with formatting.
|
3251
|
+
*
|
3252
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3253
|
+
* @param up_bar_line A #lxw_chart_line struct for the up-bar border.
|
3254
|
+
* @param up_bar_fill A #lxw_chart_fill struct for the up-bar fill.
|
3255
|
+
* @param down_bar_line A #lxw_chart_line struct for the down-bar border.
|
3256
|
+
* @param down_bar_fill A #lxw_chart_fill struct for the down-bar fill.
|
3257
|
+
*
|
3258
|
+
* The `%chart_set_up_down_bars_format()` function adds Up-Down bars to Line
|
3259
|
+
* charts to indicate the difference between the first and last data series.
|
3260
|
+
* It also allows the up and down bars to be formatted:
|
3261
|
+
*
|
3262
|
+
* @code
|
3263
|
+
* lxw_chart_line line = {.color = LXW_COLOR_BLACK};
|
3264
|
+
* lxw_chart_fill up_fill = {.color = 0x00B050};
|
3265
|
+
* lxw_chart_fill down_fill = {.color = LXW_COLOR_RED};
|
3266
|
+
*
|
3267
|
+
* chart_set_up_down_bars_format(chart, &line, &up_fill, &line, &down_fill);
|
3268
|
+
* @endcode
|
3269
|
+
*
|
3270
|
+
* @image html chart_up_down_bars.png
|
3271
|
+
*
|
3272
|
+
* Up-Down bars are only available in Line charts.
|
3273
|
+
* For more format information see @ref chart_lines and @ref chart_fills.
|
3274
|
+
*/
|
3275
|
+
void chart_set_up_down_bars_format(lxw_chart *chart,
|
3276
|
+
lxw_chart_line *up_bar_line,
|
3277
|
+
lxw_chart_fill *up_bar_fill,
|
3278
|
+
lxw_chart_line *down_bar_line,
|
3279
|
+
lxw_chart_fill *down_bar_fill);
|
3280
|
+
|
3281
|
+
/**
|
3282
|
+
* @brief Turn on and format Drop Lines for a chart.
|
3283
|
+
*
|
3284
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3285
|
+
* @param line A #lxw_chart_line struct.
|
3286
|
+
*
|
3287
|
+
* The `%chart_set_drop_lines()` function adds Drop Lines to charts to
|
3288
|
+
* show the Category value of points in the data:
|
3289
|
+
*
|
3290
|
+
* @code
|
3291
|
+
* chart_set_drop_lines(chart, NULL);
|
3292
|
+
* @endcode
|
3293
|
+
*
|
3294
|
+
* @image html chart_data_tools6.png
|
3295
|
+
*
|
3296
|
+
* It is possible to format the Drop Line line properties if required:
|
3297
|
+
*
|
3298
|
+
* @code
|
3299
|
+
* lxw_chart_line line = {.color = LXW_COLOR_RED,
|
3300
|
+
* .dash_type = LXW_CHART_LINE_DASH_SQUARE_DOT};
|
3301
|
+
*
|
3302
|
+
* chart_set_drop_lines(chart, &line);
|
3303
|
+
* @endcode
|
3304
|
+
*
|
3305
|
+
* Drop Lines are only available in Line and Area charts.
|
3306
|
+
* For more format information see @ref chart_lines.
|
3307
|
+
*/
|
3308
|
+
void chart_set_drop_lines(lxw_chart *chart, lxw_chart_line *line);
|
3309
|
+
|
3310
|
+
/**
|
3311
|
+
* @brief Turn on and format high-low Lines for a chart.
|
3312
|
+
*
|
3313
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3314
|
+
* @param line A #lxw_chart_line struct.
|
3315
|
+
*
|
3316
|
+
* The `%chart_set_high_low_lines()` function adds High-Low Lines to charts
|
3317
|
+
* to show the Category value of points in the data:
|
3318
|
+
*
|
3319
|
+
* @code
|
3320
|
+
* chart_set_high_low_lines(chart, NULL);
|
3321
|
+
* @endcode
|
3322
|
+
*
|
3323
|
+
* @image html chart_data_tools5.png
|
3324
|
+
*
|
3325
|
+
* It is possible to format the High-Low Line line properties if required:
|
3326
|
+
*
|
3327
|
+
* @code
|
3328
|
+
* lxw_chart_line line = {.color = LXW_COLOR_RED,
|
3329
|
+
* .dash_type = LXW_CHART_LINE_DASH_SQUARE_DOT};
|
3330
|
+
*
|
3331
|
+
* chart_set_high_low_lines(chart, &line);
|
3332
|
+
* @endcode
|
3333
|
+
*
|
3334
|
+
* High-Low Lines are only available in Line charts.
|
3335
|
+
* For more format information see @ref chart_lines.
|
3336
|
+
*/
|
3337
|
+
void chart_set_high_low_lines(lxw_chart *chart, lxw_chart_line *line);
|
3338
|
+
|
3339
|
+
/**
|
3340
|
+
* @brief Set the overlap between series in a Bar/Column chart.
|
3341
|
+
*
|
3342
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3343
|
+
* @param overlap The overlap between the series. -100 to 100.
|
3344
|
+
*
|
3345
|
+
* The `%chart_set_series_overlap()` function sets the overlap between series
|
3346
|
+
* in Bar and Column charts.
|
3347
|
+
*
|
3348
|
+
* @code
|
3349
|
+
* chart_set_series_overlap(chart, -50);
|
3350
|
+
* @endcode
|
3351
|
+
*
|
3352
|
+
* @image html chart_overlap.png
|
3353
|
+
*
|
3354
|
+
* The overlap value must be in the range `0 <= overlap <= 500`.
|
3355
|
+
* The default value is 0.
|
3356
|
+
*
|
3357
|
+
* This option is only available for Bar/Column charts.
|
3358
|
+
*/
|
3359
|
+
void chart_set_series_overlap(lxw_chart *chart, int8_t overlap);
|
3360
|
+
|
3361
|
+
/**
|
3362
|
+
* @brief Set the gap between series in a Bar/Column chart.
|
3363
|
+
*
|
3364
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3365
|
+
* @param gap The gap between the series. 0 to 500.
|
3366
|
+
*
|
3367
|
+
* The `%chart_set_series_gap()` function sets the gap between series in
|
3368
|
+
* Bar and Column charts.
|
3369
|
+
*
|
3370
|
+
* @code
|
3371
|
+
* chart_set_series_gap(chart, 400);
|
3372
|
+
* @endcode
|
3373
|
+
*
|
3374
|
+
* @image html chart_gap.png
|
3375
|
+
*
|
3376
|
+
* The gap value must be in the range `0 <= gap <= 500`. The default value
|
3377
|
+
* is 150.
|
3378
|
+
*
|
3379
|
+
* This option is only available for Bar/Column charts.
|
3380
|
+
*/
|
3381
|
+
void chart_set_series_gap(lxw_chart *chart, uint16_t gap);
|
3382
|
+
|
3383
|
+
/**
|
3384
|
+
* @brief Set the option for displaying blank data in a chart.
|
3385
|
+
*
|
3386
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3387
|
+
* @param option The display option. A #lxw_chart_blank option.
|
3388
|
+
*
|
3389
|
+
* The `%chart_show_blanks_as()` function controls how blank data is displayed
|
3390
|
+
* in a chart:
|
3391
|
+
*
|
3392
|
+
* @code
|
3393
|
+
* chart_show_blanks_as(chart, LXW_CHART_BLANKS_AS_CONNECTED);
|
3394
|
+
* @endcode
|
3395
|
+
*
|
3396
|
+
* The `option` parameter can have one of the following values:
|
3397
|
+
*
|
3398
|
+
* - #LXW_CHART_BLANKS_AS_GAP: Show empty chart cells as gaps in the data.
|
3399
|
+
* This is the default option for Excel charts.
|
3400
|
+
* - #LXW_CHART_BLANKS_AS_ZERO: Show empty chart cells as zeros.
|
3401
|
+
* - #LXW_CHART_BLANKS_AS_CONNECTED: Show empty chart cells as connected.
|
3402
|
+
* Only for charts with lines.
|
3403
|
+
*/
|
3404
|
+
void chart_show_blanks_as(lxw_chart *chart, uint8_t option);
|
3405
|
+
|
3406
|
+
/**
|
3407
|
+
* @brief Display data on charts from hidden rows or columns.
|
3408
|
+
*
|
3409
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3410
|
+
*
|
3411
|
+
* Display data that is in hidden rows or columns on the chart:
|
3412
|
+
*
|
3413
|
+
* @code
|
3414
|
+
* chart_show_hidden_data(chart);
|
3415
|
+
* @endcode
|
3416
|
+
*/
|
3417
|
+
void chart_show_hidden_data(lxw_chart *chart);
|
3418
|
+
|
3419
|
+
/**
|
3420
|
+
* @brief Set the Pie/Doughnut chart rotation.
|
3421
|
+
*
|
3422
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3423
|
+
* @param rotation The angle of rotation.
|
3424
|
+
*
|
3425
|
+
* The `chart_set_rotation()` function is used to set the rotation of the
|
3426
|
+
* first segment of a Pie/Doughnut chart. This has the effect of rotating
|
3427
|
+
* the entire chart:
|
3428
|
+
*
|
3429
|
+
* @code
|
3430
|
+
* chart_set_rotation(chart, 28);
|
3431
|
+
* @endcode
|
3432
|
+
*
|
3433
|
+
* The angle of rotation must be in the range `0 <= rotation <= 360`.
|
3434
|
+
*
|
3435
|
+
* This option is only available for Pie/Doughnut charts.
|
3436
|
+
*
|
3437
|
+
*/
|
1073
3438
|
void chart_set_rotation(lxw_chart *chart, uint16_t rotation);
|
3439
|
+
|
3440
|
+
/**
|
3441
|
+
* @brief Set the Doughnut chart hole size.
|
3442
|
+
*
|
3443
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
3444
|
+
* @param size The hole size as a percentage.
|
3445
|
+
*
|
3446
|
+
* The `chart_set_hole_size()` function is used to set the hole size of a
|
3447
|
+
* Doughnut chart:
|
3448
|
+
*
|
3449
|
+
* @code
|
3450
|
+
* chart_set_hole_size(chart, 33);
|
3451
|
+
* @endcode
|
3452
|
+
*
|
3453
|
+
* The hole size must be in the range `10 <= size <= 90`.
|
3454
|
+
*
|
3455
|
+
* This option is only available for Doughnut charts.
|
3456
|
+
*
|
3457
|
+
*/
|
1074
3458
|
void chart_set_hole_size(lxw_chart *chart, uint8_t size);
|
1075
3459
|
|
1076
|
-
|
1077
|
-
|
3460
|
+
lxw_error lxw_chart_add_data_cache(lxw_series_range *range, uint8_t *data,
|
3461
|
+
uint16_t rows, uint8_t cols, uint8_t col);
|
1078
3462
|
|
1079
3463
|
/* Declarations required for unit testing. */
|
1080
3464
|
#ifdef TESTING
|