kmadej_fast_excel_fork 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.travis.yml +28 -0
- data/CHANGELOG.md +13 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +70 -0
- data/Makefile +14 -0
- data/README.md +95 -0
- data/Rakefile +24 -0
- data/appveyor.yml +25 -0
- data/benchmarks/1k_rows.rb +59 -0
- data/benchmarks/20k_rows.rb +26 -0
- data/benchmarks/init.rb +59 -0
- data/benchmarks/memory.rb +49 -0
- data/examples/example.rb +42 -0
- data/examples/example_align.rb +23 -0
- data/examples/example_chart.rb +21 -0
- data/examples/example_colors.rb +37 -0
- data/examples/example_formula.rb +18 -0
- data/examples/example_image.rb +13 -0
- data/examples/example_styles.rb +27 -0
- data/examples/logo.png +0 -0
- data/extconf.rb +0 -0
- data/fast_excel.gemspec +20 -0
- data/lib/fast_excel.rb +600 -0
- data/lib/fast_excel/binding.rb +2819 -0
- data/lib/fast_excel/binding/chart.rb +2666 -0
- data/lib/fast_excel/binding/format.rb +1177 -0
- data/lib/fast_excel/binding/workbook.rb +338 -0
- data/lib/fast_excel/binding/worksheet.rb +1555 -0
- data/libxlsxwriter/.gitignore +49 -0
- data/libxlsxwriter/.indent.pro +125 -0
- data/libxlsxwriter/.travis.yml +25 -0
- data/libxlsxwriter/CONTRIBUTING.md +226 -0
- data/libxlsxwriter/Changes.txt +557 -0
- data/libxlsxwriter/LICENSE.txt +89 -0
- data/libxlsxwriter/Makefile +156 -0
- data/libxlsxwriter/Readme.md +78 -0
- data/libxlsxwriter/cocoapods/libxlsxwriter-umbrella.h +30 -0
- data/libxlsxwriter/cocoapods/libxlsxwriter.modulemap +7 -0
- data/libxlsxwriter/include/xlsxwriter.h +23 -0
- data/libxlsxwriter/include/xlsxwriter/app.h +79 -0
- data/libxlsxwriter/include/xlsxwriter/chart.h +3476 -0
- data/libxlsxwriter/include/xlsxwriter/common.h +372 -0
- data/libxlsxwriter/include/xlsxwriter/content_types.h +74 -0
- data/libxlsxwriter/include/xlsxwriter/core.h +51 -0
- data/libxlsxwriter/include/xlsxwriter/custom.h +52 -0
- data/libxlsxwriter/include/xlsxwriter/drawing.h +111 -0
- data/libxlsxwriter/include/xlsxwriter/format.h +1214 -0
- data/libxlsxwriter/include/xlsxwriter/hash_table.h +76 -0
- data/libxlsxwriter/include/xlsxwriter/packager.h +80 -0
- data/libxlsxwriter/include/xlsxwriter/relationships.h +77 -0
- data/libxlsxwriter/include/xlsxwriter/shared_strings.h +83 -0
- data/libxlsxwriter/include/xlsxwriter/styles.h +77 -0
- data/libxlsxwriter/include/xlsxwriter/theme.h +47 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/ioapi.h +214 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/queue.h +694 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/tmpfileplus.h +53 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/tree.h +801 -0
- data/libxlsxwriter/include/xlsxwriter/third_party/zip.h +375 -0
- data/libxlsxwriter/include/xlsxwriter/utility.h +166 -0
- data/libxlsxwriter/include/xlsxwriter/workbook.h +757 -0
- data/libxlsxwriter/include/xlsxwriter/worksheet.h +2641 -0
- data/libxlsxwriter/include/xlsxwriter/xmlwriter.h +178 -0
- data/libxlsxwriter/lib/.gitignore +0 -0
- data/libxlsxwriter/libxlsxwriter.podspec +47 -0
- data/libxlsxwriter/src/Makefile +130 -0
- data/libxlsxwriter/src/app.c +443 -0
- data/libxlsxwriter/src/chart.c +6346 -0
- data/libxlsxwriter/src/content_types.c +345 -0
- data/libxlsxwriter/src/core.c +293 -0
- data/libxlsxwriter/src/custom.c +224 -0
- data/libxlsxwriter/src/drawing.c +746 -0
- data/libxlsxwriter/src/format.c +729 -0
- data/libxlsxwriter/src/hash_table.c +223 -0
- data/libxlsxwriter/src/packager.c +948 -0
- data/libxlsxwriter/src/relationships.c +245 -0
- data/libxlsxwriter/src/shared_strings.c +266 -0
- data/libxlsxwriter/src/styles.c +1088 -0
- data/libxlsxwriter/src/theme.c +348 -0
- data/libxlsxwriter/src/utility.c +515 -0
- data/libxlsxwriter/src/workbook.c +1930 -0
- data/libxlsxwriter/src/worksheet.c +5022 -0
- data/libxlsxwriter/src/xmlwriter.c +355 -0
- data/libxlsxwriter/third_party/minizip/Makefile +44 -0
- data/libxlsxwriter/third_party/minizip/Makefile.am +45 -0
- data/libxlsxwriter/third_party/minizip/Makefile.orig +25 -0
- data/libxlsxwriter/third_party/minizip/MiniZip64_Changes.txt +6 -0
- data/libxlsxwriter/third_party/minizip/MiniZip64_info.txt +74 -0
- data/libxlsxwriter/third_party/minizip/README.txt +5 -0
- data/libxlsxwriter/third_party/minizip/configure.ac +32 -0
- data/libxlsxwriter/third_party/minizip/crypt.h +131 -0
- data/libxlsxwriter/third_party/minizip/ioapi.c +247 -0
- data/libxlsxwriter/third_party/minizip/ioapi.h +208 -0
- data/libxlsxwriter/third_party/minizip/iowin32.c +456 -0
- data/libxlsxwriter/third_party/minizip/iowin32.h +28 -0
- data/libxlsxwriter/third_party/minizip/make_vms.com +25 -0
- data/libxlsxwriter/third_party/minizip/miniunz.c +660 -0
- data/libxlsxwriter/third_party/minizip/miniunzip.1 +63 -0
- data/libxlsxwriter/third_party/minizip/minizip.1 +46 -0
- data/libxlsxwriter/third_party/minizip/minizip.c +520 -0
- data/libxlsxwriter/third_party/minizip/minizip.pc.in +12 -0
- data/libxlsxwriter/third_party/minizip/mztools.c +291 -0
- data/libxlsxwriter/third_party/minizip/mztools.h +37 -0
- data/libxlsxwriter/third_party/minizip/unzip.c +2125 -0
- data/libxlsxwriter/third_party/minizip/unzip.h +437 -0
- data/libxlsxwriter/third_party/minizip/zip.c +2007 -0
- data/libxlsxwriter/third_party/minizip/zip.h +367 -0
- data/libxlsxwriter/third_party/tmpfileplus/Makefile +42 -0
- data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.c +342 -0
- data/libxlsxwriter/third_party/tmpfileplus/tmpfileplus.h +53 -0
- data/libxlsxwriter/version.txt +1 -0
- data/test/date_test.rb +22 -0
- data/test/default_format_test.rb +19 -0
- data/test/format_test.rb +171 -0
- data/test/test_helper.rb +52 -0
- data/test/tmpfile_test.rb +23 -0
- data/test/worksheet_test.rb +86 -0
- metadata +182 -0
|
@@ -0,0 +1,3476 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* libxlsxwriter
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2014-2017, John McNamara, jmcnamara@cpan.org. See LICENSE.txt.
|
|
5
|
+
*
|
|
6
|
+
* chart - A libxlsxwriter library for creating Excel XLSX chart files.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @page chart_page The Chart object
|
|
12
|
+
*
|
|
13
|
+
* The Chart object represents an Excel chart. It provides functions for
|
|
14
|
+
* adding data series to the chart and for configuring the chart.
|
|
15
|
+
*
|
|
16
|
+
* See @ref chart.h for full details of the functionality.
|
|
17
|
+
*
|
|
18
|
+
* @file chart.h
|
|
19
|
+
*
|
|
20
|
+
* @brief Functions related to adding data to and configuring a chart.
|
|
21
|
+
*
|
|
22
|
+
* The Chart object represents an Excel chart. It provides functions for
|
|
23
|
+
* adding data series to the chart and for configuring the chart.
|
|
24
|
+
*
|
|
25
|
+
* A Chart object isn't created directly. Instead a chart is created by
|
|
26
|
+
* calling the `workbook_add_chart()` function from a Workbook object. For
|
|
27
|
+
* example:
|
|
28
|
+
*
|
|
29
|
+
* @code
|
|
30
|
+
*
|
|
31
|
+
* #include "xlsxwriter.h"
|
|
32
|
+
*
|
|
33
|
+
* int main() {
|
|
34
|
+
*
|
|
35
|
+
* lxw_workbook *workbook = new_workbook("chart.xlsx");
|
|
36
|
+
* lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
|
|
37
|
+
*
|
|
38
|
+
* // User function to add data to worksheet, not shown here.
|
|
39
|
+
* write_worksheet_data(worksheet);
|
|
40
|
+
*
|
|
41
|
+
* // Create a chart object.
|
|
42
|
+
* lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
|
|
43
|
+
*
|
|
44
|
+
* // In the simplest case we just add some value data series.
|
|
45
|
+
* // The NULL categories will default to 1 to 5 like in Excel.
|
|
46
|
+
* chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
|
|
47
|
+
* chart_add_series(chart, NULL, "=Sheet1!$B$1:$B$5");
|
|
48
|
+
* chart_add_series(chart, NULL, "=Sheet1!$C$1:$C$5");
|
|
49
|
+
*
|
|
50
|
+
* // Insert the chart into the worksheet
|
|
51
|
+
* worksheet_insert_chart(worksheet, CELL("B7"), chart);
|
|
52
|
+
*
|
|
53
|
+
* return workbook_close(workbook);
|
|
54
|
+
* }
|
|
55
|
+
*
|
|
56
|
+
* @endcode
|
|
57
|
+
*
|
|
58
|
+
* The chart in the worksheet will look like this:
|
|
59
|
+
* @image html chart_simple.png
|
|
60
|
+
*
|
|
61
|
+
* The basic procedure for adding a chart to a worksheet is:
|
|
62
|
+
*
|
|
63
|
+
* 1. Create the chart with `workbook_add_chart()`.
|
|
64
|
+
* 2. Add one or more data series to the chart which refers to data in the
|
|
65
|
+
* workbook using `chart_add_series()`.
|
|
66
|
+
* 3. Configure the chart with the other available functions shown below.
|
|
67
|
+
* 4. Insert the chart into a worksheet using `worksheet_insert_chart()`.
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
#ifndef __LXW_CHART_H__
|
|
72
|
+
#define __LXW_CHART_H__
|
|
73
|
+
|
|
74
|
+
#include <stdint.h>
|
|
75
|
+
#include <string.h>
|
|
76
|
+
|
|
77
|
+
#include "common.h"
|
|
78
|
+
#include "format.h"
|
|
79
|
+
|
|
80
|
+
STAILQ_HEAD(lxw_chart_series_list, lxw_chart_series);
|
|
81
|
+
STAILQ_HEAD(lxw_series_data_points, lxw_series_data_point);
|
|
82
|
+
|
|
83
|
+
#define LXW_CHART_NUM_FORMAT_LEN 128
|
|
84
|
+
#define LXW_CHART_DEFAULT_GAP 501
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @brief Available chart types.
|
|
88
|
+
*/
|
|
89
|
+
typedef enum lxw_chart_type {
|
|
90
|
+
|
|
91
|
+
/** None. */
|
|
92
|
+
LXW_CHART_NONE = 0,
|
|
93
|
+
|
|
94
|
+
/** Area chart. */
|
|
95
|
+
LXW_CHART_AREA,
|
|
96
|
+
|
|
97
|
+
/** Area chart - stacked. */
|
|
98
|
+
LXW_CHART_AREA_STACKED,
|
|
99
|
+
|
|
100
|
+
/** Area chart - percentage stacked. */
|
|
101
|
+
LXW_CHART_AREA_STACKED_PERCENT,
|
|
102
|
+
|
|
103
|
+
/** Bar chart. */
|
|
104
|
+
LXW_CHART_BAR,
|
|
105
|
+
|
|
106
|
+
/** Bar chart - stacked. */
|
|
107
|
+
LXW_CHART_BAR_STACKED,
|
|
108
|
+
|
|
109
|
+
/** Bar chart - percentage stacked. */
|
|
110
|
+
LXW_CHART_BAR_STACKED_PERCENT,
|
|
111
|
+
|
|
112
|
+
/** Column chart. */
|
|
113
|
+
LXW_CHART_COLUMN,
|
|
114
|
+
|
|
115
|
+
/** Column chart - stacked. */
|
|
116
|
+
LXW_CHART_COLUMN_STACKED,
|
|
117
|
+
|
|
118
|
+
/** Column chart - percentage stacked. */
|
|
119
|
+
LXW_CHART_COLUMN_STACKED_PERCENT,
|
|
120
|
+
|
|
121
|
+
/** Doughnut chart. */
|
|
122
|
+
LXW_CHART_DOUGHNUT,
|
|
123
|
+
|
|
124
|
+
/** Line chart. */
|
|
125
|
+
LXW_CHART_LINE,
|
|
126
|
+
|
|
127
|
+
/** Pie chart. */
|
|
128
|
+
LXW_CHART_PIE,
|
|
129
|
+
|
|
130
|
+
/** Scatter chart. */
|
|
131
|
+
LXW_CHART_SCATTER,
|
|
132
|
+
|
|
133
|
+
/** Scatter chart - straight. */
|
|
134
|
+
LXW_CHART_SCATTER_STRAIGHT,
|
|
135
|
+
|
|
136
|
+
/** Scatter chart - straight with markers. */
|
|
137
|
+
LXW_CHART_SCATTER_STRAIGHT_WITH_MARKERS,
|
|
138
|
+
|
|
139
|
+
/** Scatter chart - smooth. */
|
|
140
|
+
LXW_CHART_SCATTER_SMOOTH,
|
|
141
|
+
|
|
142
|
+
/** Scatter chart - smooth with markers. */
|
|
143
|
+
LXW_CHART_SCATTER_SMOOTH_WITH_MARKERS,
|
|
144
|
+
|
|
145
|
+
/** Radar chart. */
|
|
146
|
+
LXW_CHART_RADAR,
|
|
147
|
+
|
|
148
|
+
/** Radar chart - with markers. */
|
|
149
|
+
LXW_CHART_RADAR_WITH_MARKERS,
|
|
150
|
+
|
|
151
|
+
/** Radar chart - filled. */
|
|
152
|
+
LXW_CHART_RADAR_FILLED
|
|
153
|
+
} lxw_chart_type;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* @brief Chart legend positions.
|
|
157
|
+
*/
|
|
158
|
+
typedef enum lxw_chart_legend_position {
|
|
159
|
+
|
|
160
|
+
/** No chart legend. */
|
|
161
|
+
LXW_CHART_LEGEND_NONE = 0,
|
|
162
|
+
|
|
163
|
+
/** Chart legend positioned at right side. */
|
|
164
|
+
LXW_CHART_LEGEND_RIGHT,
|
|
165
|
+
|
|
166
|
+
/** Chart legend positioned at left side. */
|
|
167
|
+
LXW_CHART_LEGEND_LEFT,
|
|
168
|
+
|
|
169
|
+
/** Chart legend positioned at top. */
|
|
170
|
+
LXW_CHART_LEGEND_TOP,
|
|
171
|
+
|
|
172
|
+
/** Chart legend positioned at bottom. */
|
|
173
|
+
LXW_CHART_LEGEND_BOTTOM,
|
|
174
|
+
|
|
175
|
+
/** Chart legend overlaid at right side. */
|
|
176
|
+
LXW_CHART_LEGEND_OVERLAY_RIGHT,
|
|
177
|
+
|
|
178
|
+
/** Chart legend overlaid at left side. */
|
|
179
|
+
LXW_CHART_LEGEND_OVERLAY_LEFT
|
|
180
|
+
} lxw_chart_legend_position;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* @brief Chart line dash types.
|
|
184
|
+
*
|
|
185
|
+
* The dash types are shown in the order that they appear in the Excel dialog.
|
|
186
|
+
* See @ref chart_lines.
|
|
187
|
+
*/
|
|
188
|
+
typedef enum lxw_chart_line_dash_type {
|
|
189
|
+
|
|
190
|
+
/** Solid. */
|
|
191
|
+
LXW_CHART_LINE_DASH_SOLID = 0,
|
|
192
|
+
|
|
193
|
+
/** Round Dot. */
|
|
194
|
+
LXW_CHART_LINE_DASH_ROUND_DOT,
|
|
195
|
+
|
|
196
|
+
/** Square Dot. */
|
|
197
|
+
LXW_CHART_LINE_DASH_SQUARE_DOT,
|
|
198
|
+
|
|
199
|
+
/** Dash. */
|
|
200
|
+
LXW_CHART_LINE_DASH_DASH,
|
|
201
|
+
|
|
202
|
+
/** Dash Dot. */
|
|
203
|
+
LXW_CHART_LINE_DASH_DASH_DOT,
|
|
204
|
+
|
|
205
|
+
/** Long Dash. */
|
|
206
|
+
LXW_CHART_LINE_DASH_LONG_DASH,
|
|
207
|
+
|
|
208
|
+
/** Long Dash Dot. */
|
|
209
|
+
LXW_CHART_LINE_DASH_LONG_DASH_DOT,
|
|
210
|
+
|
|
211
|
+
/** Long Dash Dot Dot. */
|
|
212
|
+
LXW_CHART_LINE_DASH_LONG_DASH_DOT_DOT,
|
|
213
|
+
|
|
214
|
+
/* These aren't available in the dialog but are used by Excel. */
|
|
215
|
+
LXW_CHART_LINE_DASH_DOT,
|
|
216
|
+
LXW_CHART_LINE_DASH_SYSTEM_DASH_DOT,
|
|
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,
|
|
389
|
+
|
|
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;
|
|
466
|
+
|
|
467
|
+
enum lxw_chart_subtype {
|
|
468
|
+
|
|
469
|
+
LXW_CHART_SUBTYPE_NONE = 0,
|
|
470
|
+
LXW_CHART_SUBTYPE_STACKED,
|
|
471
|
+
LXW_CHART_SUBTYPE_STACKED_PERCENT
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
enum lxw_chart_grouping {
|
|
475
|
+
LXW_GROUPING_CLUSTERED,
|
|
476
|
+
LXW_GROUPING_STANDARD,
|
|
477
|
+
LXW_GROUPING_PERCENTSTACKED,
|
|
478
|
+
LXW_GROUPING_STACKED
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* @brief Axis positions for category axes.
|
|
483
|
+
*/
|
|
484
|
+
typedef enum lxw_chart_axis_tick_position {
|
|
485
|
+
|
|
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;
|
|
571
|
+
|
|
572
|
+
typedef struct lxw_series_range {
|
|
573
|
+
char *formula;
|
|
574
|
+
char *sheetname;
|
|
575
|
+
lxw_row_t first_row;
|
|
576
|
+
lxw_row_t last_row;
|
|
577
|
+
lxw_col_t first_col;
|
|
578
|
+
lxw_col_t last_col;
|
|
579
|
+
uint8_t ignore_cache;
|
|
580
|
+
|
|
581
|
+
uint8_t has_string_cache;
|
|
582
|
+
uint16_t num_data_points;
|
|
583
|
+
struct lxw_series_data_points *data_cache;
|
|
584
|
+
|
|
585
|
+
} lxw_series_range;
|
|
586
|
+
|
|
587
|
+
typedef struct lxw_series_data_point {
|
|
588
|
+
uint8_t is_string;
|
|
589
|
+
double number;
|
|
590
|
+
char *string;
|
|
591
|
+
uint8_t no_data;
|
|
592
|
+
|
|
593
|
+
STAILQ_ENTRY (lxw_series_data_point) list_pointers;
|
|
594
|
+
|
|
595
|
+
} lxw_series_data_point;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* @brief Struct to represent a chart line.
|
|
599
|
+
*
|
|
600
|
+
* See @ref chart_lines.
|
|
601
|
+
*/
|
|
602
|
+
typedef struct lxw_chart_line {
|
|
603
|
+
|
|
604
|
+
/** The chart font color. See @ref working_with_colors. */
|
|
605
|
+
lxw_color_t color;
|
|
606
|
+
|
|
607
|
+
/** Turn off/hide line. Set to 0 or 1.*/
|
|
608
|
+
uint8_t none;
|
|
609
|
+
|
|
610
|
+
/** Width of the line in increments of 0.25. Default is 2.25. */
|
|
611
|
+
float width;
|
|
612
|
+
|
|
613
|
+
/** The line dash type. See #lxw_chart_line_dash_type. */
|
|
614
|
+
uint8_t dash_type;
|
|
615
|
+
|
|
616
|
+
/* Transparency for lines isn't generally useful. Undocumented for now. */
|
|
617
|
+
uint8_t transparency;
|
|
618
|
+
|
|
619
|
+
/* Members for internal use only. */
|
|
620
|
+
uint8_t has_color;
|
|
621
|
+
|
|
622
|
+
} lxw_chart_line;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* @brief Struct to represent a chart fill.
|
|
626
|
+
*
|
|
627
|
+
* See @ref chart_fills.
|
|
628
|
+
*/
|
|
629
|
+
typedef struct lxw_chart_fill {
|
|
630
|
+
|
|
631
|
+
/** The chart font color. See @ref working_with_colors. */
|
|
632
|
+
lxw_color_t color;
|
|
633
|
+
|
|
634
|
+
/** Turn off/hide line. Set to 0 or 1.*/
|
|
635
|
+
uint8_t none;
|
|
636
|
+
|
|
637
|
+
/** Set the transparency of the fill. 0 - 100. Default 0. */
|
|
638
|
+
uint8_t transparency;
|
|
639
|
+
|
|
640
|
+
/* Members for internal use only. */
|
|
641
|
+
uint8_t has_color;
|
|
642
|
+
|
|
643
|
+
} lxw_chart_fill;
|
|
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
|
+
|
|
667
|
+
/**
|
|
668
|
+
* @brief Struct to represent a chart font.
|
|
669
|
+
*
|
|
670
|
+
* See @ref chart_fonts.
|
|
671
|
+
*/
|
|
672
|
+
typedef struct lxw_chart_font {
|
|
673
|
+
|
|
674
|
+
/** The chart font name, such as "Arial" or "Calibri". */
|
|
675
|
+
char *name;
|
|
676
|
+
|
|
677
|
+
/** The chart font size. The default is 11. */
|
|
678
|
+
uint16_t size;
|
|
679
|
+
|
|
680
|
+
/** The chart font bold property. Set to 0 or 1. */
|
|
681
|
+
uint8_t bold;
|
|
682
|
+
|
|
683
|
+
/** The chart font italic property. Set to 0 or 1. */
|
|
684
|
+
uint8_t italic;
|
|
685
|
+
|
|
686
|
+
/** The chart font underline property. Set to 0 or 1. */
|
|
687
|
+
uint8_t underline;
|
|
688
|
+
|
|
689
|
+
/** The chart font rotation property. Range: -90 to 90. */
|
|
690
|
+
int32_t rotation;
|
|
691
|
+
|
|
692
|
+
/** The chart font color. See @ref working_with_colors. */
|
|
693
|
+
lxw_color_t color;
|
|
694
|
+
|
|
695
|
+
/* Members for internal use only. */
|
|
696
|
+
uint8_t pitch_family;
|
|
697
|
+
uint8_t charset;
|
|
698
|
+
int8_t baseline;
|
|
699
|
+
uint8_t has_color;
|
|
700
|
+
|
|
701
|
+
} lxw_chart_font;
|
|
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
|
+
|
|
713
|
+
typedef struct lxw_chart_legend {
|
|
714
|
+
|
|
715
|
+
lxw_chart_font *font;
|
|
716
|
+
uint8_t position;
|
|
717
|
+
|
|
718
|
+
} lxw_chart_legend;
|
|
719
|
+
|
|
720
|
+
typedef struct lxw_chart_title {
|
|
721
|
+
|
|
722
|
+
char *name;
|
|
723
|
+
lxw_row_t row;
|
|
724
|
+
lxw_col_t col;
|
|
725
|
+
lxw_chart_font *font;
|
|
726
|
+
uint8_t off;
|
|
727
|
+
uint8_t is_horizontal;
|
|
728
|
+
uint8_t ignore_cache;
|
|
729
|
+
|
|
730
|
+
/* We use a range to hold the title formula properties even though it
|
|
731
|
+
* will only have 1 point in order to re-use similar functions.*/
|
|
732
|
+
lxw_series_range *range;
|
|
733
|
+
|
|
734
|
+
struct lxw_series_data_point data_point;
|
|
735
|
+
|
|
736
|
+
} lxw_chart_title;
|
|
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
|
+
|
|
858
|
+
/**
|
|
859
|
+
* @brief Struct to represent an Excel chart data series.
|
|
860
|
+
*
|
|
861
|
+
* The lxw_chart_series is created using the chart_add_series function. It is
|
|
862
|
+
* used in functions that modify a chart series but the members of the struct
|
|
863
|
+
* aren't modified directly.
|
|
864
|
+
*/
|
|
865
|
+
typedef struct lxw_chart_series {
|
|
866
|
+
|
|
867
|
+
lxw_series_range *categories;
|
|
868
|
+
lxw_series_range *values;
|
|
869
|
+
lxw_chart_title title;
|
|
870
|
+
lxw_chart_line *line;
|
|
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;
|
|
910
|
+
|
|
911
|
+
STAILQ_ENTRY (lxw_chart_series) list_pointers;
|
|
912
|
+
|
|
913
|
+
} lxw_chart_series;
|
|
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
|
+
|
|
923
|
+
/**
|
|
924
|
+
* @brief Struct to represent an Excel chart axis.
|
|
925
|
+
*
|
|
926
|
+
* The lxw_chart_axis struct is used in functions that modify a chart axis
|
|
927
|
+
* but the members of the struct aren't modified directly.
|
|
928
|
+
*/
|
|
929
|
+
typedef struct lxw_chart_axis {
|
|
930
|
+
|
|
931
|
+
lxw_chart_title title;
|
|
932
|
+
|
|
933
|
+
char *num_format;
|
|
934
|
+
char *default_num_format;
|
|
935
|
+
uint8_t source_linked;
|
|
936
|
+
|
|
937
|
+
uint8_t major_tick_mark;
|
|
938
|
+
uint8_t minor_tick_mark;
|
|
939
|
+
uint8_t is_horizontal;
|
|
940
|
+
|
|
941
|
+
lxw_chart_gridline major_gridlines;
|
|
942
|
+
lxw_chart_gridline minor_gridlines;
|
|
943
|
+
|
|
944
|
+
lxw_chart_font *num_font;
|
|
945
|
+
lxw_chart_line *line;
|
|
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;
|
|
979
|
+
|
|
980
|
+
} lxw_chart_axis;
|
|
981
|
+
|
|
982
|
+
/**
|
|
983
|
+
* @brief Struct to represent an Excel chart.
|
|
984
|
+
*
|
|
985
|
+
* The members of the lxw_chart struct aren't modified directly. Instead
|
|
986
|
+
* the chart properties are set by calling the functions shown in chart.h.
|
|
987
|
+
*/
|
|
988
|
+
typedef struct lxw_chart {
|
|
989
|
+
|
|
990
|
+
FILE *file;
|
|
991
|
+
|
|
992
|
+
uint8_t type;
|
|
993
|
+
uint8_t subtype;
|
|
994
|
+
uint16_t series_index;
|
|
995
|
+
|
|
996
|
+
void (*write_chart_type) (struct lxw_chart *);
|
|
997
|
+
void (*write_plot_area) (struct lxw_chart *);
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* A pointer to the chart x_axis object which can be used in functions
|
|
1001
|
+
* that configures the X axis.
|
|
1002
|
+
*/
|
|
1003
|
+
lxw_chart_axis *x_axis;
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* A pointer to the chart y_axis object which can be used in functions
|
|
1007
|
+
* that configures the Y axis.
|
|
1008
|
+
*/
|
|
1009
|
+
lxw_chart_axis *y_axis;
|
|
1010
|
+
|
|
1011
|
+
lxw_chart_title title;
|
|
1012
|
+
|
|
1013
|
+
uint32_t id;
|
|
1014
|
+
uint32_t axis_id_1;
|
|
1015
|
+
uint32_t axis_id_2;
|
|
1016
|
+
uint32_t axis_id_3;
|
|
1017
|
+
uint32_t axis_id_4;
|
|
1018
|
+
|
|
1019
|
+
uint8_t in_use;
|
|
1020
|
+
uint8_t chart_group;
|
|
1021
|
+
uint8_t cat_has_num_fmt;
|
|
1022
|
+
|
|
1023
|
+
uint8_t has_horiz_cat_axis;
|
|
1024
|
+
uint8_t has_horiz_val_axis;
|
|
1025
|
+
|
|
1026
|
+
uint8_t style_id;
|
|
1027
|
+
uint16_t rotation;
|
|
1028
|
+
uint16_t hole_size;
|
|
1029
|
+
|
|
1030
|
+
uint8_t no_title;
|
|
1031
|
+
uint8_t has_overlap;
|
|
1032
|
+
int8_t overlap_y1;
|
|
1033
|
+
int8_t overlap_y2;
|
|
1034
|
+
uint16_t gap_y1;
|
|
1035
|
+
uint16_t gap_y2;
|
|
1036
|
+
|
|
1037
|
+
uint8_t grouping;
|
|
1038
|
+
uint8_t default_cross_between;
|
|
1039
|
+
|
|
1040
|
+
lxw_chart_legend legend;
|
|
1041
|
+
int16_t *delete_series;
|
|
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;
|
|
1057
|
+
|
|
1058
|
+
struct lxw_chart_series_list *series_list;
|
|
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
|
+
|
|
1078
|
+
STAILQ_ENTRY (lxw_chart) ordered_list_pointers;
|
|
1079
|
+
STAILQ_ENTRY (lxw_chart) list_pointers;
|
|
1080
|
+
|
|
1081
|
+
} lxw_chart;
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
/* *INDENT-OFF* */
|
|
1085
|
+
#ifdef __cplusplus
|
|
1086
|
+
extern "C" {
|
|
1087
|
+
#endif
|
|
1088
|
+
/* *INDENT-ON* */
|
|
1089
|
+
|
|
1090
|
+
lxw_chart *lxw_chart_new(uint8_t type);
|
|
1091
|
+
void lxw_chart_free(lxw_chart *chart);
|
|
1092
|
+
void lxw_chart_assemble_xml_file(lxw_chart *chart);
|
|
1093
|
+
|
|
1094
|
+
/**
|
|
1095
|
+
* @brief Add a data series to a chart.
|
|
1096
|
+
*
|
|
1097
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
1098
|
+
* @param categories The range of categories in the data series.
|
|
1099
|
+
* @param values The range of values in the data series.
|
|
1100
|
+
*
|
|
1101
|
+
* @return A lxw_chart_series object pointer.
|
|
1102
|
+
*
|
|
1103
|
+
* In Excel a chart **series** is a collection of information that defines
|
|
1104
|
+
* which data is plotted such as the categories and values. It is also used to
|
|
1105
|
+
* define the formatting for the data.
|
|
1106
|
+
*
|
|
1107
|
+
* For an libxlsxwriter chart object the `%chart_add_series()` function is
|
|
1108
|
+
* used to set the categories and values of the series:
|
|
1109
|
+
*
|
|
1110
|
+
* @code
|
|
1111
|
+
* chart_add_series(chart, "=Sheet1!$A$2:$A$7", "=Sheet1!$C$2:$C$7");
|
|
1112
|
+
* @endcode
|
|
1113
|
+
*
|
|
1114
|
+
*
|
|
1115
|
+
* The series parameters are:
|
|
1116
|
+
*
|
|
1117
|
+
* - `categories`: This sets the chart category labels. The category is more
|
|
1118
|
+
* or less the same as the X axis. In most Excel chart types the
|
|
1119
|
+
* `categories` property is optional and the chart will just assume a
|
|
1120
|
+
* sequential series from `1..n`:
|
|
1121
|
+
*
|
|
1122
|
+
* @code
|
|
1123
|
+
* // The NULL category will default to 1 to 5 like in Excel.
|
|
1124
|
+
* chart_add_series(chart, NULL, "Sheet1!$A$1:$A$5");
|
|
1125
|
+
* @endcode
|
|
1126
|
+
*
|
|
1127
|
+
* - `values`: This is the most important property of a series and is the
|
|
1128
|
+
* only mandatory option for every chart object. This parameter links the
|
|
1129
|
+
* chart with the worksheet data that it displays.
|
|
1130
|
+
*
|
|
1131
|
+
* The `categories` and `values` should be a string formula like
|
|
1132
|
+
* `"=Sheet1!$A$2:$A$7"` in the same way it is represented in Excel. This is
|
|
1133
|
+
* convenient when recreating a chart from an example in Excel but it is
|
|
1134
|
+
* trickier to generate programmatically. For these cases you can set the
|
|
1135
|
+
* `categories` and `values` to `NULL` and use the
|
|
1136
|
+
* `chart_series_set_categories()` and `chart_series_set_values()` functions:
|
|
1137
|
+
*
|
|
1138
|
+
* @code
|
|
1139
|
+
* lxw_chart_series *series = chart_add_series(chart, NULL, NULL);
|
|
1140
|
+
*
|
|
1141
|
+
* // Configure the series using a syntax that is easier to define programmatically.
|
|
1142
|
+
* chart_series_set_categories(series, "Sheet1", 1, 0, 6, 0); // "=Sheet1!$A$2:$A$7"
|
|
1143
|
+
* chart_series_set_values( series, "Sheet1", 1, 2, 6, 2); // "=Sheet1!$C$2:$C$7"
|
|
1144
|
+
* @endcode
|
|
1145
|
+
*
|
|
1146
|
+
* As shown in the previous example the return value from
|
|
1147
|
+
* `%chart_add_series()` is a lxw_chart_series pointer. This can be used in
|
|
1148
|
+
* other functions that configure a series.
|
|
1149
|
+
*
|
|
1150
|
+
*
|
|
1151
|
+
* More than one series can be added to a chart. The series numbering and
|
|
1152
|
+
* order in the Excel chart will be the same as the order in which they are
|
|
1153
|
+
* added in libxlsxwriter:
|
|
1154
|
+
*
|
|
1155
|
+
* @code
|
|
1156
|
+
* chart_add_series(chart, NULL, "Sheet1!$A$1:$A$5");
|
|
1157
|
+
* chart_add_series(chart, NULL, "Sheet1!$B$1:$B$5");
|
|
1158
|
+
* chart_add_series(chart, NULL, "Sheet1!$C$1:$C$5");
|
|
1159
|
+
* @endcode
|
|
1160
|
+
*
|
|
1161
|
+
* It is also possible to specify non-contiguous ranges:
|
|
1162
|
+
*
|
|
1163
|
+
* @code
|
|
1164
|
+
* chart_add_series(
|
|
1165
|
+
* chart,
|
|
1166
|
+
* "=(Sheet1!$A$1:$A$9,Sheet1!$A$14:$A$25)",
|
|
1167
|
+
* "=(Sheet1!$B$1:$B$9,Sheet1!$B$14:$B$25)"
|
|
1168
|
+
* );
|
|
1169
|
+
* @endcode
|
|
1170
|
+
*
|
|
1171
|
+
*/
|
|
1172
|
+
lxw_chart_series *chart_add_series(lxw_chart *chart,
|
|
1173
|
+
const char *categories,
|
|
1174
|
+
const char *values);
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* @brief Set a series "categories" range using row and column values.
|
|
1178
|
+
*
|
|
1179
|
+
* @param series A series object created via `chart_add_series()`.
|
|
1180
|
+
* @param sheetname The name of the worksheet that contains the data range.
|
|
1181
|
+
* @param first_row The first row of the range. (All zero indexed.)
|
|
1182
|
+
* @param first_col The first column of the range.
|
|
1183
|
+
* @param last_row The last row of the range.
|
|
1184
|
+
* @param last_col The last col of the range.
|
|
1185
|
+
*
|
|
1186
|
+
* The `categories` and `values` of a chart data series are generally set
|
|
1187
|
+
* using the `chart_add_series()` function and Excel range formulas like
|
|
1188
|
+
* `"=Sheet1!$A$2:$A$7"`.
|
|
1189
|
+
*
|
|
1190
|
+
* The `%chart_series_set_categories()` function is an alternative method that
|
|
1191
|
+
* is easier to generate programmatically. It requires that you set the
|
|
1192
|
+
* `categories` and `values` parameters in `chart_add_series()`to `NULL` and
|
|
1193
|
+
* then set them using row and column values in
|
|
1194
|
+
* `chart_series_set_categories()` and `chart_series_set_values()`:
|
|
1195
|
+
*
|
|
1196
|
+
* @code
|
|
1197
|
+
* lxw_chart_series *series = chart_add_series(chart, NULL, NULL);
|
|
1198
|
+
*
|
|
1199
|
+
* // Configure the series ranges programmatically.
|
|
1200
|
+
* chart_series_set_categories(series, "Sheet1", 1, 0, 6, 0); // "=Sheet1!$A$2:$A$7"
|
|
1201
|
+
* chart_series_set_values( series, "Sheet1", 1, 2, 6, 2); // "=Sheet1!$C$2:$C$7"
|
|
1202
|
+
* @endcode
|
|
1203
|
+
*
|
|
1204
|
+
*/
|
|
1205
|
+
void chart_series_set_categories(lxw_chart_series *series,
|
|
1206
|
+
const char *sheetname, lxw_row_t first_row,
|
|
1207
|
+
lxw_col_t first_col, lxw_row_t last_row,
|
|
1208
|
+
lxw_col_t last_col);
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* @brief Set a series "values" range using row and column values.
|
|
1212
|
+
*
|
|
1213
|
+
* @param series A series object created via `chart_add_series()`.
|
|
1214
|
+
* @param sheetname The name of the worksheet that contains the data range.
|
|
1215
|
+
* @param first_row The first row of the range. (All zero indexed.)
|
|
1216
|
+
* @param first_col The first column of the range.
|
|
1217
|
+
* @param last_row The last row of the range.
|
|
1218
|
+
* @param last_col The last col of the range.
|
|
1219
|
+
*
|
|
1220
|
+
* The `categories` and `values` of a chart data series are generally set
|
|
1221
|
+
* using the `chart_add_series()` function and Excel range formulas like
|
|
1222
|
+
* `"=Sheet1!$A$2:$A$7"`.
|
|
1223
|
+
*
|
|
1224
|
+
* The `%chart_series_set_values()` function is an alternative method that is
|
|
1225
|
+
* easier to generate programmatically. See the documentation for
|
|
1226
|
+
* `chart_series_set_categories()` above.
|
|
1227
|
+
*/
|
|
1228
|
+
void chart_series_set_values(lxw_chart_series *series, const char *sheetname,
|
|
1229
|
+
lxw_row_t first_row, lxw_col_t first_col,
|
|
1230
|
+
lxw_row_t last_row, lxw_col_t last_col);
|
|
1231
|
+
|
|
1232
|
+
/**
|
|
1233
|
+
* @brief Set the name of a chart series range.
|
|
1234
|
+
*
|
|
1235
|
+
* @param series A series object created via `chart_add_series()`.
|
|
1236
|
+
* @param name The series name.
|
|
1237
|
+
*
|
|
1238
|
+
* The `%chart_series_set_name` function is used to set the name for a chart
|
|
1239
|
+
* data series. The series name in Excel is displayed in the chart legend and
|
|
1240
|
+
* in the formula bar. The name property is optional and if it isn't supplied
|
|
1241
|
+
* it will default to `Series 1..n`.
|
|
1242
|
+
*
|
|
1243
|
+
* The function applies to a #lxw_chart_series object created using
|
|
1244
|
+
* `chart_add_series()`:
|
|
1245
|
+
*
|
|
1246
|
+
* @code
|
|
1247
|
+
* lxw_chart_series *series = chart_add_series(chart, NULL, "=Sheet1!$B$2:$B$7");
|
|
1248
|
+
*
|
|
1249
|
+
* chart_series_set_name(series, "Quarterly budget data");
|
|
1250
|
+
* @endcode
|
|
1251
|
+
*
|
|
1252
|
+
* The name parameter can also be a formula such as `=Sheet1!$A$1` to point to
|
|
1253
|
+
* a cell in the workbook that contains the name:
|
|
1254
|
+
*
|
|
1255
|
+
* @code
|
|
1256
|
+
* lxw_chart_series *series = chart_add_series(chart, NULL, "=Sheet1!$B$2:$B$7");
|
|
1257
|
+
*
|
|
1258
|
+
* chart_series_set_name(series, "=Sheet1!$B1$1");
|
|
1259
|
+
* @endcode
|
|
1260
|
+
*
|
|
1261
|
+
* See also the `chart_series_set_name_range()` function to see how to set the
|
|
1262
|
+
* name formula programmatically.
|
|
1263
|
+
*/
|
|
1264
|
+
void chart_series_set_name(lxw_chart_series *series, const char *name);
|
|
1265
|
+
|
|
1266
|
+
/**
|
|
1267
|
+
* @brief Set a series name formula using row and column values.
|
|
1268
|
+
*
|
|
1269
|
+
* @param series A series object created via `chart_add_series()`.
|
|
1270
|
+
* @param sheetname The name of the worksheet that contains the cell range.
|
|
1271
|
+
* @param row The zero indexed row number of the range.
|
|
1272
|
+
* @param col The zero indexed column number of the range.
|
|
1273
|
+
*
|
|
1274
|
+
* The `%chart_series_set_name_range()` function can be used to set a series
|
|
1275
|
+
* name range and is an alternative to using `chart_series_set_name()` and a
|
|
1276
|
+
* string formula:
|
|
1277
|
+
*
|
|
1278
|
+
* @code
|
|
1279
|
+
* lxw_chart_series *series = chart_add_series(chart, NULL, "=Sheet1!$B$2:$B$7");
|
|
1280
|
+
*
|
|
1281
|
+
* chart_series_set_name_range(series, "Sheet1", 0, 2); // "=Sheet1!$C$1"
|
|
1282
|
+
* @endcode
|
|
1283
|
+
*/
|
|
1284
|
+
void chart_series_set_name_range(lxw_chart_series *series,
|
|
1285
|
+
const char *sheetname, lxw_row_t row,
|
|
1286
|
+
lxw_col_t col);
|
|
1287
|
+
/**
|
|
1288
|
+
* @brief Set the line properties for a chart series.
|
|
1289
|
+
*
|
|
1290
|
+
* @param series A series object created via `chart_add_series()`.
|
|
1291
|
+
* @param line A #lxw_chart_line struct.
|
|
1292
|
+
*
|
|
1293
|
+
* Set the line/border properties of a chart series:
|
|
1294
|
+
*
|
|
1295
|
+
* @code
|
|
1296
|
+
* lxw_chart_line line = {.color = LXW_COLOR_RED};
|
|
1297
|
+
*
|
|
1298
|
+
* chart_series_set_line(series1, &line);
|
|
1299
|
+
* chart_series_set_line(series2, &line);
|
|
1300
|
+
* chart_series_set_line(series3, &line);
|
|
1301
|
+
* @endcode
|
|
1302
|
+
*
|
|
1303
|
+
* @image html chart_series_set_line.png
|
|
1304
|
+
*
|
|
1305
|
+
* For more information see @ref chart_lines.
|
|
1306
|
+
*/
|
|
1307
|
+
void chart_series_set_line(lxw_chart_series *series, lxw_chart_line *line);
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* @brief Set the fill properties for a chart series.
|
|
1311
|
+
*
|
|
1312
|
+
* @param series A series object created via `chart_add_series()`.
|
|
1313
|
+
* @param fill A #lxw_chart_fill struct.
|
|
1314
|
+
*
|
|
1315
|
+
* Set the fill properties of a chart series:
|
|
1316
|
+
*
|
|
1317
|
+
* @code
|
|
1318
|
+
* lxw_chart_fill fill1 = {.color = LXW_COLOR_RED};
|
|
1319
|
+
* lxw_chart_fill fill2 = {.color = LXW_COLOR_YELLOW};
|
|
1320
|
+
* lxw_chart_fill fill3 = {.color = LXW_COLOR_GREEN};
|
|
1321
|
+
*
|
|
1322
|
+
* chart_series_set_fill(series1, &fill1);
|
|
1323
|
+
* chart_series_set_fill(series2, &fill2);
|
|
1324
|
+
* chart_series_set_fill(series3, &fill3);
|
|
1325
|
+
* @endcode
|
|
1326
|
+
*
|
|
1327
|
+
* @image html chart_series_set_fill.png
|
|
1328
|
+
*
|
|
1329
|
+
* For more information see @ref chart_fills.
|
|
1330
|
+
*/
|
|
1331
|
+
void chart_series_set_fill(lxw_chart_series *series, lxw_chart_fill *fill);
|
|
1332
|
+
|
|
1333
|
+
/**
|
|
1334
|
+
* @brief Invert the fill color for negative series values.
|
|
1335
|
+
*
|
|
1336
|
+
* @param series A series object created via `chart_add_series()`.
|
|
1337
|
+
*
|
|
1338
|
+
* Invert the fill color for negative values. Usually only applicable to
|
|
1339
|
+
* column and bar charts.
|
|
1340
|
+
*
|
|
1341
|
+
* @code
|
|
1342
|
+
* chart_series_set_invert_if_negative(series);
|
|
1343
|
+
* @endcode
|
|
1344
|
+
*
|
|
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.
|
|
1350
|
+
*
|
|
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:
|
|
1355
|
+
*
|
|
1356
|
+
* @code
|
|
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
|
+
*
|
|
1368
|
+
* @endcode
|
|
1369
|
+
*
|
|
1370
|
+
* @image html chart_pattern.png
|
|
1371
|
+
*
|
|
1372
|
+
* For more information see #lxw_chart_pattern_type and @ref chart_patterns.
|
|
1373
|
+
*/
|
|
1374
|
+
void chart_series_set_pattern(lxw_chart_series *series,
|
|
1375
|
+
lxw_chart_pattern *pattern);
|
|
1376
|
+
|
|
1377
|
+
/**
|
|
1378
|
+
* @brief Set the data marker type for a series.
|
|
1379
|
+
*
|
|
1380
|
+
* @param series A series object created via `chart_add_series()`.
|
|
1381
|
+
* @param type The marker type, see #lxw_chart_marker_type.
|
|
1382
|
+
*
|
|
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:
|
|
1403
|
+
*
|
|
1404
|
+
* @code
|
|
1405
|
+
* chart_series_set_marker_type(series, LXW_CHART_MARKER_DIAMOND);
|
|
1406
|
+
* @endcode
|
|
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
|
+
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, char *name);
|
|
1987
|
+
|
|
1988
|
+
/**
|
|
1989
|
+
* @brief Set the trendline line properties for a chart data series.
|
|
1990
|
+
*
|
|
1991
|
+
* @param series A series object created via `chart_add_series()`.
|
|
1992
|
+
* @param line A #lxw_chart_line struct.
|
|
1993
|
+
*
|
|
1994
|
+
* The `%chart_series_set_trendline_line()` function is used to set the line
|
|
1995
|
+
* properties of a trendline:
|
|
1996
|
+
*
|
|
1997
|
+
* @code
|
|
1998
|
+
* lxw_chart_line line = {.color = LXW_COLOR_RED,
|
|
1999
|
+
* .dash_type = LXW_CHART_LINE_DASH_LONG_DASH};
|
|
2000
|
+
*
|
|
2001
|
+
* chart_series_set_trendline(series, LXW_CHART_TRENDLINE_TYPE_LINEAR, 0);
|
|
2002
|
+
* chart_series_set_trendline_line(series, &line);
|
|
2003
|
+
* @endcode
|
|
2004
|
+
*
|
|
2005
|
+
* @image html chart_trendline10.png
|
|
2006
|
+
*
|
|
2007
|
+
* For more information see @ref chart_trendlines and @ref chart_lines.
|
|
2008
|
+
*/
|
|
2009
|
+
void chart_series_set_trendline_line(lxw_chart_series *series,
|
|
2010
|
+
lxw_chart_line *line);
|
|
2011
|
+
|
|
2012
|
+
/**
|
|
2013
|
+
* Set the X or Y error bars for a chart series.
|
|
2014
|
+
*
|
|
2015
|
+
* @param error_bars A pointer to the series X or Y error bars.
|
|
2016
|
+
* @param type The type of error bar: #lxw_chart_error_bar_type.
|
|
2017
|
+
* @param value The error value.
|
|
2018
|
+
*
|
|
2019
|
+
* Error bars can be added to a chart series to indicate error bounds in the
|
|
2020
|
+
* data. The error bars can be vertical `y_error_bars` (the most common type)
|
|
2021
|
+
* or horizontal `x_error_bars` (for Bar and Scatter charts only).
|
|
2022
|
+
*
|
|
2023
|
+
* @image html chart_error_bars0.png
|
|
2024
|
+
*
|
|
2025
|
+
* The `%chart_series_set_error_bars()` function sets the error bar type
|
|
2026
|
+
* and value associated with the type:
|
|
2027
|
+
*
|
|
2028
|
+
* @code
|
|
2029
|
+
* lxw_chart_series *series = chart_add_series(chart,
|
|
2030
|
+
* "=Sheet1!$A$1:$A$5",
|
|
2031
|
+
* "=Sheet1!$B$1:$B$5");
|
|
2032
|
+
*
|
|
2033
|
+
* chart_series_set_error_bars(series->y_error_bars,
|
|
2034
|
+
* LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
|
|
2035
|
+
* @endcode
|
|
2036
|
+
*
|
|
2037
|
+
* @image html chart_error_bars1.png
|
|
2038
|
+
*
|
|
2039
|
+
* The error bar types that be used are:
|
|
2040
|
+
*
|
|
2041
|
+
* - #LXW_CHART_ERROR_BAR_TYPE_STD_ERROR: Standard error.
|
|
2042
|
+
* - #LXW_CHART_ERROR_BAR_TYPE_FIXED: Fixed value.
|
|
2043
|
+
* - #LXW_CHART_ERROR_BAR_TYPE_PERCENTAGE: Percentage.
|
|
2044
|
+
* - #LXW_CHART_ERROR_BAR_TYPE_STD_DEV: Standard deviation(s).
|
|
2045
|
+
*
|
|
2046
|
+
* @note Custom error bars are not currently supported.
|
|
2047
|
+
*
|
|
2048
|
+
* All error bar types, apart from Standard error, should have a valid
|
|
2049
|
+
* value to set the error range:
|
|
2050
|
+
*
|
|
2051
|
+
* @code
|
|
2052
|
+
* chart_series_set_error_bars(series1->y_error_bars,
|
|
2053
|
+
* LXW_CHART_ERROR_BAR_TYPE_FIXED, 2);
|
|
2054
|
+
*
|
|
2055
|
+
* chart_series_set_error_bars(series2->y_error_bars,
|
|
2056
|
+
* LXW_CHART_ERROR_BAR_TYPE_PERCENTAGE, 5);
|
|
2057
|
+
*
|
|
2058
|
+
* chart_series_set_error_bars(series3->y_error_bars,
|
|
2059
|
+
* LXW_CHART_ERROR_BAR_TYPE_STD_DEV, 1);
|
|
2060
|
+
* @endcode
|
|
2061
|
+
*
|
|
2062
|
+
* For the Standard error type the value is ignored.
|
|
2063
|
+
*
|
|
2064
|
+
* For more information see @ref chart_error_bars.
|
|
2065
|
+
*/
|
|
2066
|
+
void chart_series_set_error_bars(lxw_series_error_bars *error_bars,
|
|
2067
|
+
uint8_t type, double value);
|
|
2068
|
+
|
|
2069
|
+
/**
|
|
2070
|
+
* @brief Set the direction (up, down or both) of the error bars for a chart
|
|
2071
|
+
* series.
|
|
2072
|
+
*
|
|
2073
|
+
* @param error_bars A pointer to the series X or Y error bars.
|
|
2074
|
+
* @param direction The bar direction: #lxw_chart_error_bar_direction .
|
|
2075
|
+
*
|
|
2076
|
+
* The `%chart_series_set_error_bars_direction()` function sets the
|
|
2077
|
+
* direction of the error bars:
|
|
2078
|
+
*
|
|
2079
|
+
* @code
|
|
2080
|
+
* chart_series_set_error_bars(series->y_error_bars,
|
|
2081
|
+
* LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
|
|
2082
|
+
*
|
|
2083
|
+
* chart_series_set_error_bars_direction(series->y_error_bars,
|
|
2084
|
+
* LXW_CHART_ERROR_BAR_DIR_PLUS);
|
|
2085
|
+
* @endcode
|
|
2086
|
+
*
|
|
2087
|
+
* @image html chart_error_bars2.png
|
|
2088
|
+
*
|
|
2089
|
+
* The valid directions are:
|
|
2090
|
+
*
|
|
2091
|
+
* - #LXW_CHART_ERROR_BAR_DIR_BOTH: Error bar extends in both directions.
|
|
2092
|
+
* The default.
|
|
2093
|
+
* - #LXW_CHART_ERROR_BAR_DIR_PLUS: Error bar extends in positive direction.
|
|
2094
|
+
* - #LXW_CHART_ERROR_BAR_DIR_MINUS: Error bar extends in negative direction.
|
|
2095
|
+
*
|
|
2096
|
+
* For more information see @ref chart_error_bars.
|
|
2097
|
+
*/
|
|
2098
|
+
void chart_series_set_error_bars_direction(lxw_series_error_bars *error_bars,
|
|
2099
|
+
uint8_t direction);
|
|
2100
|
+
|
|
2101
|
+
/**
|
|
2102
|
+
* @brief Set the end cap type for the error bars of a chart series.
|
|
2103
|
+
*
|
|
2104
|
+
* @param error_bars A pointer to the series X or Y error bars.
|
|
2105
|
+
* @param endcap The error bar end cap type: #lxw_chart_error_bar_cap .
|
|
2106
|
+
*
|
|
2107
|
+
* The `%chart_series_set_error_bars_endcap()` function sets the end cap
|
|
2108
|
+
* type for the error bars:
|
|
2109
|
+
*
|
|
2110
|
+
* @code
|
|
2111
|
+
* chart_series_set_error_bars(series->y_error_bars,
|
|
2112
|
+
* LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
|
|
2113
|
+
*
|
|
2114
|
+
* chart_series_set_error_bars_endcap(series->y_error_bars,
|
|
2115
|
+
LXW_CHART_ERROR_BAR_NO_CAP);
|
|
2116
|
+
* @endcode
|
|
2117
|
+
*
|
|
2118
|
+
* @image html chart_error_bars3.png
|
|
2119
|
+
*
|
|
2120
|
+
* The valid values are:
|
|
2121
|
+
*
|
|
2122
|
+
* - #LXW_CHART_ERROR_BAR_END_CAP: Flat end cap. The default.
|
|
2123
|
+
* - #LXW_CHART_ERROR_BAR_NO_CAP: No end cap.
|
|
2124
|
+
*
|
|
2125
|
+
* For more information see @ref chart_error_bars.
|
|
2126
|
+
*/
|
|
2127
|
+
void chart_series_set_error_bars_endcap(lxw_series_error_bars *error_bars,
|
|
2128
|
+
uint8_t endcap);
|
|
2129
|
+
|
|
2130
|
+
/**
|
|
2131
|
+
* @brief Set the line properties for a chart series error bars.
|
|
2132
|
+
*
|
|
2133
|
+
* @param error_bars A pointer to the series X or Y error bars.
|
|
2134
|
+
* @param line A #lxw_chart_line struct.
|
|
2135
|
+
*
|
|
2136
|
+
* The `%chart_series_set_error_bars_line()` function sets the line
|
|
2137
|
+
* properties for the error bars:
|
|
2138
|
+
*
|
|
2139
|
+
* @code
|
|
2140
|
+
* lxw_chart_line line = {.color = LXW_COLOR_RED,
|
|
2141
|
+
* .dash_type = LXW_CHART_LINE_DASH_ROUND_DOT};
|
|
2142
|
+
*
|
|
2143
|
+
* chart_series_set_error_bars(series->y_error_bars,
|
|
2144
|
+
* LXW_CHART_ERROR_BAR_TYPE_STD_ERROR, 0);
|
|
2145
|
+
*
|
|
2146
|
+
* chart_series_set_error_bars_line(series->y_error_bars, &line);
|
|
2147
|
+
* @endcode
|
|
2148
|
+
*
|
|
2149
|
+
* @image html chart_error_bars4.png
|
|
2150
|
+
*
|
|
2151
|
+
* For more information see @ref chart_lines and @ref chart_error_bars.
|
|
2152
|
+
*/
|
|
2153
|
+
void chart_series_set_error_bars_line(lxw_series_error_bars *error_bars,
|
|
2154
|
+
lxw_chart_line *line);
|
|
2155
|
+
|
|
2156
|
+
/**
|
|
2157
|
+
* @brief Set the name caption of the an axis.
|
|
2158
|
+
*
|
|
2159
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2160
|
+
* @param name The name caption of the axis.
|
|
2161
|
+
*
|
|
2162
|
+
* The `%chart_axis_set_name()` function sets the name (also known as title or
|
|
2163
|
+
* caption) for an axis. It can be used for the X or Y axes. The name is
|
|
2164
|
+
* displayed below an X axis and to the side of a Y axis.
|
|
2165
|
+
*
|
|
2166
|
+
* @code
|
|
2167
|
+
* chart_axis_set_name(chart->x_axis, "Earnings per Quarter");
|
|
2168
|
+
* chart_axis_set_name(chart->y_axis, "US Dollars (Millions)");
|
|
2169
|
+
* @endcode
|
|
2170
|
+
*
|
|
2171
|
+
* @image html chart_axis_set_name.png
|
|
2172
|
+
*
|
|
2173
|
+
* The name parameter can also be a formula such as `=Sheet1!$A$1` to point to
|
|
2174
|
+
* a cell in the workbook that contains the name:
|
|
2175
|
+
*
|
|
2176
|
+
* @code
|
|
2177
|
+
* chart_axis_set_name(chart->x_axis, "=Sheet1!$B1$1");
|
|
2178
|
+
* @endcode
|
|
2179
|
+
*
|
|
2180
|
+
* See also the `chart_axis_set_name_range()` function to see how to set the
|
|
2181
|
+
* name formula programmatically.
|
|
2182
|
+
*
|
|
2183
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2184
|
+
* See @ref ww_charts_axes.
|
|
2185
|
+
*/
|
|
2186
|
+
void chart_axis_set_name(lxw_chart_axis *axis, const char *name);
|
|
2187
|
+
|
|
2188
|
+
/**
|
|
2189
|
+
* @brief Set a chart axis name formula using row and column values.
|
|
2190
|
+
*
|
|
2191
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2192
|
+
* @param sheetname The name of the worksheet that contains the cell range.
|
|
2193
|
+
* @param row The zero indexed row number of the range.
|
|
2194
|
+
* @param col The zero indexed column number of the range.
|
|
2195
|
+
*
|
|
2196
|
+
* The `%chart_axis_set_name_range()` function can be used to set an axis name
|
|
2197
|
+
* range and is an alternative to using `chart_axis_set_name()` and a string
|
|
2198
|
+
* formula:
|
|
2199
|
+
*
|
|
2200
|
+
* @code
|
|
2201
|
+
* chart_axis_set_name_range(chart->x_axis, "Sheet1", 1, 0);
|
|
2202
|
+
* chart_axis_set_name_range(chart->y_axis, "Sheet1", 2, 0);
|
|
2203
|
+
* @endcode
|
|
2204
|
+
*
|
|
2205
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2206
|
+
* See @ref ww_charts_axes.
|
|
2207
|
+
*/
|
|
2208
|
+
void chart_axis_set_name_range(lxw_chart_axis *axis, const char *sheetname,
|
|
2209
|
+
lxw_row_t row, lxw_col_t col);
|
|
2210
|
+
|
|
2211
|
+
/**
|
|
2212
|
+
* @brief Set the font properties for a chart axis name.
|
|
2213
|
+
*
|
|
2214
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2215
|
+
* @param font A pointer to a chart #lxw_chart_font font struct.
|
|
2216
|
+
*
|
|
2217
|
+
* The `%chart_axis_set_name_font()` function is used to set the font of an
|
|
2218
|
+
* axis name:
|
|
2219
|
+
*
|
|
2220
|
+
* @code
|
|
2221
|
+
* lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE};
|
|
2222
|
+
*
|
|
2223
|
+
* chart_axis_set_name(chart->x_axis, "Yearly data");
|
|
2224
|
+
* chart_axis_set_name_font(chart->x_axis, &font);
|
|
2225
|
+
* @endcode
|
|
2226
|
+
*
|
|
2227
|
+
* @image html chart_axis_set_name_font.png
|
|
2228
|
+
*
|
|
2229
|
+
* For more information see @ref chart_fonts.
|
|
2230
|
+
*
|
|
2231
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2232
|
+
* See @ref ww_charts_axes.
|
|
2233
|
+
*/
|
|
2234
|
+
void chart_axis_set_name_font(lxw_chart_axis *axis, lxw_chart_font *font);
|
|
2235
|
+
|
|
2236
|
+
/**
|
|
2237
|
+
* @brief Set the font properties for the numbers of a chart axis.
|
|
2238
|
+
*
|
|
2239
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2240
|
+
* @param font A pointer to a chart #lxw_chart_font font struct.
|
|
2241
|
+
*
|
|
2242
|
+
* The `%chart_axis_set_num_font()` function is used to set the font of the
|
|
2243
|
+
* numbers on an axis:
|
|
2244
|
+
*
|
|
2245
|
+
* @code
|
|
2246
|
+
* lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE};
|
|
2247
|
+
*
|
|
2248
|
+
* chart_axis_set_num_font(chart->x_axis, &font1);
|
|
2249
|
+
* @endcode
|
|
2250
|
+
*
|
|
2251
|
+
* @image html chart_axis_set_num_font.png
|
|
2252
|
+
*
|
|
2253
|
+
* For more information see @ref chart_fonts.
|
|
2254
|
+
*
|
|
2255
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2256
|
+
* See @ref ww_charts_axes.
|
|
2257
|
+
*/
|
|
2258
|
+
void chart_axis_set_num_font(lxw_chart_axis *axis, lxw_chart_font *font);
|
|
2259
|
+
|
|
2260
|
+
/**
|
|
2261
|
+
* @brief Set the number format for a chart axis.
|
|
2262
|
+
*
|
|
2263
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2264
|
+
* @param num_format The number format string.
|
|
2265
|
+
*
|
|
2266
|
+
* The `%chart_axis_set_num_format()` function is used to set the format of
|
|
2267
|
+
* the numbers on an axis:
|
|
2268
|
+
*
|
|
2269
|
+
* @code
|
|
2270
|
+
* chart_axis_set_num_format(chart->x_axis, "0.00%");
|
|
2271
|
+
* chart_axis_set_num_format(chart->y_axis, "$#,##0.00");
|
|
2272
|
+
* @endcode
|
|
2273
|
+
*
|
|
2274
|
+
* The number format is similar to the Worksheet Cell Format num_format,
|
|
2275
|
+
* see `format_set_num_format()`.
|
|
2276
|
+
*
|
|
2277
|
+
* @image html chart_axis_num_format.png
|
|
2278
|
+
*
|
|
2279
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2280
|
+
* See @ref ww_charts_axes.
|
|
2281
|
+
*/
|
|
2282
|
+
void chart_axis_set_num_format(lxw_chart_axis *axis, char *num_format);
|
|
2283
|
+
|
|
2284
|
+
/**
|
|
2285
|
+
* @brief Set the line properties for a chart axis.
|
|
2286
|
+
*
|
|
2287
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2288
|
+
* @param line A #lxw_chart_line struct.
|
|
2289
|
+
*
|
|
2290
|
+
* Set the line properties of a chart axis:
|
|
2291
|
+
*
|
|
2292
|
+
* @code
|
|
2293
|
+
* // Hide the Y axis.
|
|
2294
|
+
* lxw_chart_line line = {.none = LXW_TRUE};
|
|
2295
|
+
*
|
|
2296
|
+
* chart_axis_set_line(chart->y_axis, &line);
|
|
2297
|
+
* @endcode
|
|
2298
|
+
*
|
|
2299
|
+
* @image html chart_axis_set_line.png
|
|
2300
|
+
*
|
|
2301
|
+
* For more information see @ref chart_lines.
|
|
2302
|
+
*
|
|
2303
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2304
|
+
* See @ref ww_charts_axes.
|
|
2305
|
+
*/
|
|
2306
|
+
void chart_axis_set_line(lxw_chart_axis *axis, lxw_chart_line *line);
|
|
2307
|
+
|
|
2308
|
+
/**
|
|
2309
|
+
* @brief Set the fill properties for a chart axis.
|
|
2310
|
+
*
|
|
2311
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2312
|
+
* @param fill A #lxw_chart_fill struct.
|
|
2313
|
+
*
|
|
2314
|
+
* Set the fill properties of a chart axis:
|
|
2315
|
+
*
|
|
2316
|
+
* @code
|
|
2317
|
+
* lxw_chart_fill fill = {.color = LXW_COLOR_YELLOW};
|
|
2318
|
+
*
|
|
2319
|
+
* chart_axis_set_fill(chart->y_axis, &fill);
|
|
2320
|
+
* @endcode
|
|
2321
|
+
*
|
|
2322
|
+
* @image html chart_axis_set_fill.png
|
|
2323
|
+
*
|
|
2324
|
+
* For more information see @ref chart_fills.
|
|
2325
|
+
*
|
|
2326
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2327
|
+
* See @ref ww_charts_axes.
|
|
2328
|
+
*/
|
|
2329
|
+
void chart_axis_set_fill(lxw_chart_axis *axis, lxw_chart_fill *fill);
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* @brief Set the pattern properties for a chart axis.
|
|
2333
|
+
*
|
|
2334
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2335
|
+
* @param pattern A #lxw_chart_pattern struct.
|
|
2336
|
+
*
|
|
2337
|
+
* Set the pattern properties of a chart axis:
|
|
2338
|
+
*
|
|
2339
|
+
* @code
|
|
2340
|
+
* chart_axis_set_pattern(chart->y_axis, &pattern);
|
|
2341
|
+
* @endcode
|
|
2342
|
+
*
|
|
2343
|
+
* For more information see #lxw_chart_pattern_type and @ref chart_patterns.
|
|
2344
|
+
*
|
|
2345
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2346
|
+
* See @ref ww_charts_axes.
|
|
2347
|
+
*/
|
|
2348
|
+
void chart_axis_set_pattern(lxw_chart_axis *axis, lxw_chart_pattern *pattern);
|
|
2349
|
+
|
|
2350
|
+
/**
|
|
2351
|
+
* @brief Reverse the order of the axis categories or values.
|
|
2352
|
+
*
|
|
2353
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2354
|
+
*
|
|
2355
|
+
* Reverse the order of the axis categories or values:
|
|
2356
|
+
*
|
|
2357
|
+
* @code
|
|
2358
|
+
* chart_axis_set_reverse(chart->x_axis);
|
|
2359
|
+
* @endcode
|
|
2360
|
+
*
|
|
2361
|
+
* @image html chart_reverse.png
|
|
2362
|
+
*
|
|
2363
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2364
|
+
* See @ref ww_charts_axes.
|
|
2365
|
+
*/
|
|
2366
|
+
void chart_axis_set_reverse(lxw_chart_axis *axis);
|
|
2367
|
+
|
|
2368
|
+
/**
|
|
2369
|
+
* @brief Set the position that the axis will cross the opposite axis.
|
|
2370
|
+
*
|
|
2371
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2372
|
+
* @param value The category or value that the axis crosses at.
|
|
2373
|
+
*
|
|
2374
|
+
* Set the position that the axis will cross the opposite axis:
|
|
2375
|
+
*
|
|
2376
|
+
* @code
|
|
2377
|
+
* chart_axis_set_crossing(chart->x_axis, 3);
|
|
2378
|
+
* chart_axis_set_crossing(chart->y_axis, 8);
|
|
2379
|
+
* @endcode
|
|
2380
|
+
*
|
|
2381
|
+
* @image html chart_crossing1.png
|
|
2382
|
+
*
|
|
2383
|
+
* If crossing is omitted (the default) the crossing will be set automatically
|
|
2384
|
+
* by Excel based on the chart data.
|
|
2385
|
+
*
|
|
2386
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2387
|
+
* See @ref ww_charts_axes.
|
|
2388
|
+
*/
|
|
2389
|
+
void chart_axis_set_crossing(lxw_chart_axis *axis, double value);
|
|
2390
|
+
|
|
2391
|
+
/**
|
|
2392
|
+
* @brief Set the opposite axis crossing position as the axis maximum.
|
|
2393
|
+
*
|
|
2394
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2395
|
+
*
|
|
2396
|
+
* Set the position that the opposite axis will cross as the axis maximum.
|
|
2397
|
+
* The default axis crossing position is generally the axis minimum so this
|
|
2398
|
+
* function can be used to reverse the location of the axes without reversing
|
|
2399
|
+
* the number sequence:
|
|
2400
|
+
*
|
|
2401
|
+
* @code
|
|
2402
|
+
* chart_axis_set_crossing_max(chart->x_axis);
|
|
2403
|
+
* chart_axis_set_crossing_max(chart->y_axis);
|
|
2404
|
+
* @endcode
|
|
2405
|
+
*
|
|
2406
|
+
* @image html chart_crossing2.png
|
|
2407
|
+
*
|
|
2408
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2409
|
+
* See @ref ww_charts_axes.
|
|
2410
|
+
*/
|
|
2411
|
+
void chart_axis_set_crossing_max(lxw_chart_axis *axis);
|
|
2412
|
+
|
|
2413
|
+
/**
|
|
2414
|
+
* @brief Turn off/hide an axis.
|
|
2415
|
+
*
|
|
2416
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2417
|
+
*
|
|
2418
|
+
* Turn off, hide, a chart axis:
|
|
2419
|
+
*
|
|
2420
|
+
* @code
|
|
2421
|
+
* chart_axis_off(chart->x_axis);
|
|
2422
|
+
* @endcode
|
|
2423
|
+
*
|
|
2424
|
+
* @image html chart_axis_off.png
|
|
2425
|
+
*
|
|
2426
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2427
|
+
* See @ref ww_charts_axes.
|
|
2428
|
+
*/
|
|
2429
|
+
void chart_axis_off(lxw_chart_axis *axis);
|
|
2430
|
+
|
|
2431
|
+
/**
|
|
2432
|
+
* @brief Position a category axis on or between the axis tick marks.
|
|
2433
|
+
*
|
|
2434
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2435
|
+
* @param position A #lxw_chart_axis_tick_position value.
|
|
2436
|
+
*
|
|
2437
|
+
* Position a category axis horizontally on, or between, the axis tick marks.
|
|
2438
|
+
*
|
|
2439
|
+
* There are two allowable values:
|
|
2440
|
+
*
|
|
2441
|
+
* - #LXW_CHART_AXIS_POSITION_ON_TICK
|
|
2442
|
+
* - #LXW_CHART_AXIS_POSITION_BETWEEN
|
|
2443
|
+
*
|
|
2444
|
+
* @code
|
|
2445
|
+
* chart_axis_set_position(chart->x_axis, LXW_CHART_AXIS_POSITION_BETWEEN);
|
|
2446
|
+
* @endcode
|
|
2447
|
+
*
|
|
2448
|
+
* @image html chart_axis_set_position.png
|
|
2449
|
+
*
|
|
2450
|
+
* **Axis types**: This function is applicable to category axes only.
|
|
2451
|
+
* See @ref ww_charts_axes.
|
|
2452
|
+
*/
|
|
2453
|
+
void chart_axis_set_position(lxw_chart_axis *axis, uint8_t position);
|
|
2454
|
+
|
|
2455
|
+
/**
|
|
2456
|
+
* @brief Position the axis labels.
|
|
2457
|
+
*
|
|
2458
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2459
|
+
* @param position A #lxw_chart_axis_label_position value.
|
|
2460
|
+
*
|
|
2461
|
+
* Position the axis labels for the chart. The labels are the numbers, or
|
|
2462
|
+
* strings or dates, on the axis that indicate the categories or values of
|
|
2463
|
+
* the axis.
|
|
2464
|
+
*
|
|
2465
|
+
* For example:
|
|
2466
|
+
*
|
|
2467
|
+
* @code
|
|
2468
|
+
* chart_axis_set_label_position(chart->x_axis, LXW_CHART_AXIS_LABEL_POSITION_HIGH);
|
|
2469
|
+
chart_axis_set_label_position(chart->y_axis, LXW_CHART_AXIS_LABEL_POSITION_HIGH);
|
|
2470
|
+
* @endcode
|
|
2471
|
+
*
|
|
2472
|
+
* @image html chart_label_position2.png
|
|
2473
|
+
*
|
|
2474
|
+
* The allowable values:
|
|
2475
|
+
*
|
|
2476
|
+
* - #LXW_CHART_AXIS_LABEL_POSITION_NEXT_TO - The default.
|
|
2477
|
+
* - #LXW_CHART_AXIS_LABEL_POSITION_HIGH - Also right for vertical axes.
|
|
2478
|
+
* - #LXW_CHART_AXIS_LABEL_POSITION_LOW - Also left for vertical axes.
|
|
2479
|
+
* - #LXW_CHART_AXIS_LABEL_POSITION_NONE
|
|
2480
|
+
*
|
|
2481
|
+
* @image html chart_label_position1.png
|
|
2482
|
+
*
|
|
2483
|
+
* The #LXW_CHART_AXIS_LABEL_POSITION_NONE turns off the axis labels. This
|
|
2484
|
+
* is slightly different from `chart_axis_off()` which also turns off the
|
|
2485
|
+
* labels but also turns off tick marks.
|
|
2486
|
+
*
|
|
2487
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2488
|
+
* See @ref ww_charts_axes.
|
|
2489
|
+
*/
|
|
2490
|
+
void chart_axis_set_label_position(lxw_chart_axis *axis, uint8_t position);
|
|
2491
|
+
|
|
2492
|
+
/**
|
|
2493
|
+
* @brief Set the minimum value for a chart axis.
|
|
2494
|
+
*
|
|
2495
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2496
|
+
* @param min Minimum value for chart axis. Value axes only.
|
|
2497
|
+
*
|
|
2498
|
+
* Set the minimum value for the axis range.
|
|
2499
|
+
*
|
|
2500
|
+
* @code
|
|
2501
|
+
* chart_axis_set_min(chart->y_axis, -4);
|
|
2502
|
+
* chart_axis_set_max(chart->y_axis, 21);
|
|
2503
|
+
* @endcode
|
|
2504
|
+
*
|
|
2505
|
+
* @image html chart_max_min.png
|
|
2506
|
+
*
|
|
2507
|
+
* **Axis types**: This function is applicable to value and date axes only.
|
|
2508
|
+
* See @ref ww_charts_axes.
|
|
2509
|
+
*/
|
|
2510
|
+
void chart_axis_set_min(lxw_chart_axis *axis, double min);
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* @brief Set the maximum value for a chart axis.
|
|
2514
|
+
*
|
|
2515
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2516
|
+
* @param max Maximum value for chart axis. Value axes only.
|
|
2517
|
+
*
|
|
2518
|
+
* Set the maximum value for the axis range.
|
|
2519
|
+
*
|
|
2520
|
+
* @code
|
|
2521
|
+
* chart_axis_set_min(chart->y_axis, -4);
|
|
2522
|
+
* chart_axis_set_max(chart->y_axis, 21);
|
|
2523
|
+
* @endcode
|
|
2524
|
+
*
|
|
2525
|
+
* See the above image.
|
|
2526
|
+
*
|
|
2527
|
+
* **Axis types**: This function is applicable to value and date axes only.
|
|
2528
|
+
* See @ref ww_charts_axes.
|
|
2529
|
+
*/
|
|
2530
|
+
void chart_axis_set_max(lxw_chart_axis *axis, double max);
|
|
2531
|
+
|
|
2532
|
+
/**
|
|
2533
|
+
* @brief Set the log base of the axis range.
|
|
2534
|
+
*
|
|
2535
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2536
|
+
* @param log_base The log base for value axis. Value axes only.
|
|
2537
|
+
*
|
|
2538
|
+
* Set the log base for the axis:
|
|
2539
|
+
*
|
|
2540
|
+
* @code
|
|
2541
|
+
* chart_axis_set_log_base(chart->y_axis, 10);
|
|
2542
|
+
* @endcode
|
|
2543
|
+
*
|
|
2544
|
+
* @image html chart_log_base.png
|
|
2545
|
+
*
|
|
2546
|
+
* The allowable range of values for the log base in Excel is between 2 and
|
|
2547
|
+
* 1000.
|
|
2548
|
+
*
|
|
2549
|
+
* **Axis types**: This function is applicable to value axes only.
|
|
2550
|
+
* See @ref ww_charts_axes.
|
|
2551
|
+
*/
|
|
2552
|
+
void chart_axis_set_log_base(lxw_chart_axis *axis, uint16_t log_base);
|
|
2553
|
+
|
|
2554
|
+
/**
|
|
2555
|
+
* @brief Set the major axis tick mark type.
|
|
2556
|
+
*
|
|
2557
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2558
|
+
* @param type The tick mark type, defined by #lxw_chart_tick_mark.
|
|
2559
|
+
*
|
|
2560
|
+
* Set the type of the major axis tick mark:
|
|
2561
|
+
*
|
|
2562
|
+
* @code
|
|
2563
|
+
* chart_axis_set_major_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_CROSSING);
|
|
2564
|
+
* chart_axis_set_minor_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_INSIDE);
|
|
2565
|
+
*
|
|
2566
|
+
* chart_axis_set_major_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_OUTSIDE);
|
|
2567
|
+
* chart_axis_set_minor_tick_mark(chart->y_axis, LXW_CHART_AXIS_TICK_MARK_INSIDE);
|
|
2568
|
+
*
|
|
2569
|
+
* // Hide the default gridlines so the tick marks are visible.
|
|
2570
|
+
* chart_axis_major_gridlines_set_visible(chart->y_axis, LXW_FALSE);
|
|
2571
|
+
* @endcode
|
|
2572
|
+
*
|
|
2573
|
+
* @image html chart_tick_marks.png
|
|
2574
|
+
*
|
|
2575
|
+
* The tick mark types are:
|
|
2576
|
+
*
|
|
2577
|
+
* - #LXW_CHART_AXIS_TICK_MARK_NONE
|
|
2578
|
+
* - #LXW_CHART_AXIS_TICK_MARK_INSIDE
|
|
2579
|
+
* - #LXW_CHART_AXIS_TICK_MARK_OUTSIDE
|
|
2580
|
+
* - #LXW_CHART_AXIS_TICK_MARK_CROSSING
|
|
2581
|
+
*
|
|
2582
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2583
|
+
* See @ref ww_charts_axes.
|
|
2584
|
+
*/
|
|
2585
|
+
void chart_axis_set_major_tick_mark(lxw_chart_axis *axis, uint8_t type);
|
|
2586
|
+
|
|
2587
|
+
/**
|
|
2588
|
+
* @brief Set the minor axis tick mark type.
|
|
2589
|
+
*
|
|
2590
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2591
|
+
* @param type The tick mark type, defined by #lxw_chart_tick_mark.
|
|
2592
|
+
*
|
|
2593
|
+
* Set the type of the minor axis tick mark:
|
|
2594
|
+
*
|
|
2595
|
+
* @code
|
|
2596
|
+
* chart_axis_set_minor_tick_mark(chart->x_axis, LXW_CHART_AXIS_TICK_MARK_INSIDE);
|
|
2597
|
+
* @endcode
|
|
2598
|
+
*
|
|
2599
|
+
* See the image and example above.
|
|
2600
|
+
*
|
|
2601
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2602
|
+
* See @ref ww_charts_axes.
|
|
2603
|
+
*/
|
|
2604
|
+
void chart_axis_set_minor_tick_mark(lxw_chart_axis *axis, uint8_t type);
|
|
2605
|
+
|
|
2606
|
+
/**
|
|
2607
|
+
* @brief Set the interval between category values.
|
|
2608
|
+
*
|
|
2609
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2610
|
+
* @param unit The interval between the categories.
|
|
2611
|
+
*
|
|
2612
|
+
* Set the interval between the category values. The default interval is 1
|
|
2613
|
+
* which gives the intervals shown in the charts above:
|
|
2614
|
+
*
|
|
2615
|
+
* 1, 2, 3, 4, 5, etc.
|
|
2616
|
+
*
|
|
2617
|
+
* Setting it to 2 gives:
|
|
2618
|
+
*
|
|
2619
|
+
* 1, 3, 5, 7, etc.
|
|
2620
|
+
*
|
|
2621
|
+
* For example:
|
|
2622
|
+
*
|
|
2623
|
+
* @code
|
|
2624
|
+
* chart_axis_set_interval_unit(chart->x_axis, 2);
|
|
2625
|
+
* @endcode
|
|
2626
|
+
*
|
|
2627
|
+
* @image html chart_set_interval1.png
|
|
2628
|
+
*
|
|
2629
|
+
* **Axis types**: This function is applicable to category and date axes only.
|
|
2630
|
+
* See @ref ww_charts_axes.
|
|
2631
|
+
*/
|
|
2632
|
+
void chart_axis_set_interval_unit(lxw_chart_axis *axis, uint16_t unit);
|
|
2633
|
+
|
|
2634
|
+
/**
|
|
2635
|
+
* @brief Set the interval between category tick marks.
|
|
2636
|
+
*
|
|
2637
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2638
|
+
* @param unit The interval between the category ticks.
|
|
2639
|
+
*
|
|
2640
|
+
* Set the interval between the category tick marks. The default interval is 1
|
|
2641
|
+
* between each category but it can be set to other integer values:
|
|
2642
|
+
*
|
|
2643
|
+
* @code
|
|
2644
|
+
* chart_axis_set_interval_tick(chart->x_axis, 2);
|
|
2645
|
+
* @endcode
|
|
2646
|
+
*
|
|
2647
|
+
* @image html chart_set_interval2.png
|
|
2648
|
+
*
|
|
2649
|
+
* **Axis types**: This function is applicable to category and date axes only.
|
|
2650
|
+
* See @ref ww_charts_axes.
|
|
2651
|
+
*/
|
|
2652
|
+
void chart_axis_set_interval_tick(lxw_chart_axis *axis, uint16_t unit);
|
|
2653
|
+
|
|
2654
|
+
/**
|
|
2655
|
+
* @brief Set the increment of the major units in the axis.
|
|
2656
|
+
*
|
|
2657
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2658
|
+
* @param unit The increment of the major units.
|
|
2659
|
+
*
|
|
2660
|
+
* Set the increment of the major units in the axis range.
|
|
2661
|
+
*
|
|
2662
|
+
* @code
|
|
2663
|
+
* // Turn on the minor gridline (it is off by default).
|
|
2664
|
+
* chart_axis_minor_gridlines_set_visible(chart->y_axis, LXW_TRUE);
|
|
2665
|
+
*
|
|
2666
|
+
* chart_axis_set_major_unit(chart->y_axis, 4);
|
|
2667
|
+
* chart_axis_set_minor_unit(chart->y_axis, 2);
|
|
2668
|
+
* @endcode
|
|
2669
|
+
*
|
|
2670
|
+
* @image html chart_set_major_units.png
|
|
2671
|
+
*
|
|
2672
|
+
* **Axis types**: This function is applicable to value and date axes only.
|
|
2673
|
+
* See @ref ww_charts_axes.
|
|
2674
|
+
*/
|
|
2675
|
+
void chart_axis_set_major_unit(lxw_chart_axis *axis, double unit);
|
|
2676
|
+
|
|
2677
|
+
/**
|
|
2678
|
+
* @brief Set the increment of the minor units in the axis.
|
|
2679
|
+
*
|
|
2680
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2681
|
+
* @param unit The increment of the minor units.
|
|
2682
|
+
*
|
|
2683
|
+
* Set the increment of the minor units in the axis range.
|
|
2684
|
+
*
|
|
2685
|
+
* @code
|
|
2686
|
+
* chart_axis_set_minor_unit(chart->y_axis, 2);
|
|
2687
|
+
* @endcode
|
|
2688
|
+
*
|
|
2689
|
+
* See the image above
|
|
2690
|
+
*
|
|
2691
|
+
* **Axis types**: This function is applicable to value and date axes only.
|
|
2692
|
+
* See @ref ww_charts_axes.
|
|
2693
|
+
*/
|
|
2694
|
+
void chart_axis_set_minor_unit(lxw_chart_axis *axis, double unit);
|
|
2695
|
+
|
|
2696
|
+
/**
|
|
2697
|
+
* @brief Set the display units for a value axis.
|
|
2698
|
+
*
|
|
2699
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2700
|
+
* @param units The display units: #lxw_chart_axis_display_unit.
|
|
2701
|
+
*
|
|
2702
|
+
* Set the display units for the axis. This can be useful if the axis numbers
|
|
2703
|
+
* are very large but you don't want to represent them in scientific notation:
|
|
2704
|
+
*
|
|
2705
|
+
* @code
|
|
2706
|
+
* chart_axis_set_display_units(chart->x_axis, LXW_CHART_AXIS_UNITS_THOUSANDS);
|
|
2707
|
+
* chart_axis_set_display_units(chart->y_axis, LXW_CHART_AXIS_UNITS_MILLIONS);
|
|
2708
|
+
* @endcode
|
|
2709
|
+
*
|
|
2710
|
+
* @image html chart_display_units.png
|
|
2711
|
+
*
|
|
2712
|
+
* **Axis types**: This function is applicable to value axes only.
|
|
2713
|
+
* See @ref ww_charts_axes.
|
|
2714
|
+
*/
|
|
2715
|
+
void chart_axis_set_display_units(lxw_chart_axis *axis, uint8_t units);
|
|
2716
|
+
|
|
2717
|
+
/**
|
|
2718
|
+
* @brief Turn on/off the display units for a value axis.
|
|
2719
|
+
|
|
2720
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2721
|
+
* @param visible Turn off/on the display units. (0/1)
|
|
2722
|
+
*
|
|
2723
|
+
* Turn on or off the display units for the axis. This option is set on
|
|
2724
|
+
* automatically by `chart_axis_set_display_units()`.
|
|
2725
|
+
*
|
|
2726
|
+
* @code
|
|
2727
|
+
* chart_axis_set_display_units_visible(chart->y_axis, LXW_TRUE);
|
|
2728
|
+
* @endcode
|
|
2729
|
+
*
|
|
2730
|
+
* **Axis types**: This function is applicable to value axes only.
|
|
2731
|
+
* See @ref ww_charts_axes.
|
|
2732
|
+
*/
|
|
2733
|
+
void chart_axis_set_display_units_visible(lxw_chart_axis *axis,
|
|
2734
|
+
uint8_t visible);
|
|
2735
|
+
|
|
2736
|
+
/**
|
|
2737
|
+
* @brief Turn on/off the major gridlines for an axis.
|
|
2738
|
+
*
|
|
2739
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2740
|
+
* @param visible Turn off/on the major gridline. (0/1)
|
|
2741
|
+
*
|
|
2742
|
+
* Turn on or off the major gridlines for an X or Y axis. In most Excel charts
|
|
2743
|
+
* the Y axis major gridlines are on by default and the X axis major
|
|
2744
|
+
* gridlines are off by default.
|
|
2745
|
+
*
|
|
2746
|
+
* Example:
|
|
2747
|
+
*
|
|
2748
|
+
* @code
|
|
2749
|
+
* // Reverse the normal visible/hidden gridlines for a column chart.
|
|
2750
|
+
* chart_axis_major_gridlines_set_visible(chart->x_axis, LXW_TRUE);
|
|
2751
|
+
* chart_axis_major_gridlines_set_visible(chart->y_axis, LXW_FALSE);
|
|
2752
|
+
* @endcode
|
|
2753
|
+
*
|
|
2754
|
+
* @image html chart_gridline1.png
|
|
2755
|
+
*
|
|
2756
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2757
|
+
* See @ref ww_charts_axes.
|
|
2758
|
+
*/
|
|
2759
|
+
void chart_axis_major_gridlines_set_visible(lxw_chart_axis *axis,
|
|
2760
|
+
uint8_t visible);
|
|
2761
|
+
|
|
2762
|
+
/**
|
|
2763
|
+
* @brief Turn on/off the minor gridlines for an axis.
|
|
2764
|
+
*
|
|
2765
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2766
|
+
* @param visible Turn off/on the minor gridline. (0/1)
|
|
2767
|
+
*
|
|
2768
|
+
* Turn on or off the minor gridlines for an X or Y axis. In most Excel charts
|
|
2769
|
+
* the X and Y axis minor gridlines are off by default.
|
|
2770
|
+
*
|
|
2771
|
+
* Example, turn on all major and minor gridlines:
|
|
2772
|
+
*
|
|
2773
|
+
* @code
|
|
2774
|
+
* chart_axis_major_gridlines_set_visible(chart->x_axis, LXW_TRUE);
|
|
2775
|
+
* chart_axis_minor_gridlines_set_visible(chart->x_axis, LXW_TRUE);
|
|
2776
|
+
* chart_axis_major_gridlines_set_visible(chart->y_axis, LXW_TRUE);
|
|
2777
|
+
* chart_axis_minor_gridlines_set_visible(chart->y_axis, LXW_TRUE);
|
|
2778
|
+
* @endcode
|
|
2779
|
+
*
|
|
2780
|
+
* @image html chart_gridline2.png
|
|
2781
|
+
*
|
|
2782
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2783
|
+
* See @ref ww_charts_axes.
|
|
2784
|
+
*/
|
|
2785
|
+
void chart_axis_minor_gridlines_set_visible(lxw_chart_axis *axis,
|
|
2786
|
+
uint8_t visible);
|
|
2787
|
+
|
|
2788
|
+
/**
|
|
2789
|
+
* @brief Set the line properties for the chart axis major gridlines.
|
|
2790
|
+
*
|
|
2791
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2792
|
+
* @param line A #lxw_chart_line struct.
|
|
2793
|
+
*
|
|
2794
|
+
* Format the line properties of the major gridlines of a chart:
|
|
2795
|
+
*
|
|
2796
|
+
* @code
|
|
2797
|
+
* lxw_chart_line line1 = {.color = LXW_COLOR_RED,
|
|
2798
|
+
* .width = 0.5,
|
|
2799
|
+
* .dash_type = LXW_CHART_LINE_DASH_SQUARE_DOT};
|
|
2800
|
+
*
|
|
2801
|
+
* lxw_chart_line line2 = {.color = LXW_COLOR_YELLOW};
|
|
2802
|
+
*
|
|
2803
|
+
* lxw_chart_line line3 = {.width = 1.25,
|
|
2804
|
+
* .dash_type = LXW_CHART_LINE_DASH_DASH};
|
|
2805
|
+
*
|
|
2806
|
+
* lxw_chart_line line4 = {.color = 0x00B050};
|
|
2807
|
+
*
|
|
2808
|
+
* chart_axis_major_gridlines_set_line(chart->x_axis, &line1);
|
|
2809
|
+
* chart_axis_minor_gridlines_set_line(chart->x_axis, &line2);
|
|
2810
|
+
* chart_axis_major_gridlines_set_line(chart->y_axis, &line3);
|
|
2811
|
+
* chart_axis_minor_gridlines_set_line(chart->y_axis, &line4);
|
|
2812
|
+
* @endcode
|
|
2813
|
+
*
|
|
2814
|
+
* @image html chart_gridline3.png
|
|
2815
|
+
*
|
|
2816
|
+
* For more information see @ref chart_lines.
|
|
2817
|
+
*
|
|
2818
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2819
|
+
* See @ref ww_charts_axes.
|
|
2820
|
+
*/
|
|
2821
|
+
void chart_axis_major_gridlines_set_line(lxw_chart_axis *axis,
|
|
2822
|
+
lxw_chart_line *line);
|
|
2823
|
+
|
|
2824
|
+
/**
|
|
2825
|
+
* @brief Set the line properties for the chart axis minor gridlines.
|
|
2826
|
+
*
|
|
2827
|
+
* @param axis A pointer to a chart #lxw_chart_axis object.
|
|
2828
|
+
* @param line A #lxw_chart_line struct.
|
|
2829
|
+
*
|
|
2830
|
+
* Format the line properties of the minor gridlines of a chart, see the
|
|
2831
|
+
* example above.
|
|
2832
|
+
*
|
|
2833
|
+
* For more information see @ref chart_lines.
|
|
2834
|
+
*
|
|
2835
|
+
* **Axis types**: This function is applicable to to all axes types.
|
|
2836
|
+
* See @ref ww_charts_axes.
|
|
2837
|
+
*/
|
|
2838
|
+
void chart_axis_minor_gridlines_set_line(lxw_chart_axis *axis,
|
|
2839
|
+
lxw_chart_line *line);
|
|
2840
|
+
|
|
2841
|
+
/**
|
|
2842
|
+
* @brief Set the title of the chart.
|
|
2843
|
+
*
|
|
2844
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
2845
|
+
* @param name The chart title name.
|
|
2846
|
+
*
|
|
2847
|
+
* The `%chart_title_set_name()` function sets the name (title) for the
|
|
2848
|
+
* chart. The name is displayed above the chart.
|
|
2849
|
+
*
|
|
2850
|
+
* @code
|
|
2851
|
+
* chart_title_set_name(chart, "Year End Results");
|
|
2852
|
+
* @endcode
|
|
2853
|
+
*
|
|
2854
|
+
* @image html chart_title_set_name.png
|
|
2855
|
+
*
|
|
2856
|
+
* The name parameter can also be a formula such as `=Sheet1!$A$1` to point to
|
|
2857
|
+
* a cell in the workbook that contains the name:
|
|
2858
|
+
*
|
|
2859
|
+
* @code
|
|
2860
|
+
* chart_title_set_name(chart, "=Sheet1!$B1$1");
|
|
2861
|
+
* @endcode
|
|
2862
|
+
*
|
|
2863
|
+
* See also the `chart_title_set_name_range()` function to see how to set the
|
|
2864
|
+
* name formula programmatically.
|
|
2865
|
+
*
|
|
2866
|
+
* The Excel default is to have no chart title.
|
|
2867
|
+
*/
|
|
2868
|
+
void chart_title_set_name(lxw_chart *chart, const char *name);
|
|
2869
|
+
|
|
2870
|
+
/**
|
|
2871
|
+
* @brief Set a chart title formula using row and column values.
|
|
2872
|
+
*
|
|
2873
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
2874
|
+
* @param sheetname The name of the worksheet that contains the cell range.
|
|
2875
|
+
* @param row The zero indexed row number of the range.
|
|
2876
|
+
* @param col The zero indexed column number of the range.
|
|
2877
|
+
*
|
|
2878
|
+
* The `%chart_title_set_name_range()` function can be used to set a chart
|
|
2879
|
+
* title range and is an alternative to using `chart_title_set_name()` and a
|
|
2880
|
+
* string formula:
|
|
2881
|
+
*
|
|
2882
|
+
* @code
|
|
2883
|
+
* chart_title_set_name_range(chart, "Sheet1", 1, 0);
|
|
2884
|
+
* @endcode
|
|
2885
|
+
*/
|
|
2886
|
+
void chart_title_set_name_range(lxw_chart *chart, const char *sheetname,
|
|
2887
|
+
lxw_row_t row, lxw_col_t col);
|
|
2888
|
+
|
|
2889
|
+
/**
|
|
2890
|
+
* @brief Set the font properties for a chart title.
|
|
2891
|
+
*
|
|
2892
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
2893
|
+
* @param font A pointer to a chart #lxw_chart_font font struct.
|
|
2894
|
+
*
|
|
2895
|
+
* The `%chart_title_set_name_font()` function is used to set the font of a
|
|
2896
|
+
* chart title:
|
|
2897
|
+
*
|
|
2898
|
+
* @code
|
|
2899
|
+
* lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE};
|
|
2900
|
+
*
|
|
2901
|
+
* chart_title_set_name(chart, "Year End Results");
|
|
2902
|
+
* chart_title_set_name_font(chart, &font);
|
|
2903
|
+
* @endcode
|
|
2904
|
+
*
|
|
2905
|
+
* @image html chart_title_set_name_font.png
|
|
2906
|
+
*
|
|
2907
|
+
* For more information see @ref chart_fonts.
|
|
2908
|
+
*/
|
|
2909
|
+
void chart_title_set_name_font(lxw_chart *chart, lxw_chart_font *font);
|
|
2910
|
+
|
|
2911
|
+
/**
|
|
2912
|
+
* @brief Turn off an automatic chart title.
|
|
2913
|
+
*
|
|
2914
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
2915
|
+
*
|
|
2916
|
+
* In general in Excel a chart title isn't displayed unless the user
|
|
2917
|
+
* explicitly adds one. However, Excel adds an automatic chart title to charts
|
|
2918
|
+
* with a single series and a user defined series name. The
|
|
2919
|
+
* `chart_title_off()` function allows you to turn off this automatic chart
|
|
2920
|
+
* title:
|
|
2921
|
+
*
|
|
2922
|
+
* @code
|
|
2923
|
+
* chart_title_off(chart);
|
|
2924
|
+
* @endcode
|
|
2925
|
+
*/
|
|
2926
|
+
void chart_title_off(lxw_chart *chart);
|
|
2927
|
+
|
|
2928
|
+
/**
|
|
2929
|
+
* @brief Set the position of the chart legend.
|
|
2930
|
+
*
|
|
2931
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
2932
|
+
* @param position The #lxw_chart_legend_position value for the legend.
|
|
2933
|
+
*
|
|
2934
|
+
* The `%chart_legend_set_position()` function is used to set the chart
|
|
2935
|
+
* legend to one of the #lxw_chart_legend_position values:
|
|
2936
|
+
*
|
|
2937
|
+
* LXW_CHART_LEGEND_NONE
|
|
2938
|
+
* LXW_CHART_LEGEND_RIGHT
|
|
2939
|
+
* LXW_CHART_LEGEND_LEFT
|
|
2940
|
+
* LXW_CHART_LEGEND_TOP
|
|
2941
|
+
* LXW_CHART_LEGEND_BOTTOM
|
|
2942
|
+
* LXW_CHART_LEGEND_OVERLAY_RIGHT
|
|
2943
|
+
* LXW_CHART_LEGEND_OVERLAY_LEFT
|
|
2944
|
+
*
|
|
2945
|
+
* For example:
|
|
2946
|
+
*
|
|
2947
|
+
* @code
|
|
2948
|
+
* chart_legend_set_position(chart, LXW_CHART_LEGEND_BOTTOM);
|
|
2949
|
+
* @endcode
|
|
2950
|
+
*
|
|
2951
|
+
* @image html chart_legend_bottom.png
|
|
2952
|
+
*
|
|
2953
|
+
* This function can also be used to turn off a chart legend:
|
|
2954
|
+
*
|
|
2955
|
+
* @code
|
|
2956
|
+
* chart_legend_set_position(chart, LXW_CHART_LEGEND_NONE);
|
|
2957
|
+
* @endcode
|
|
2958
|
+
*
|
|
2959
|
+
* @image html chart_legend_none.png
|
|
2960
|
+
*
|
|
2961
|
+
*/
|
|
2962
|
+
void chart_legend_set_position(lxw_chart *chart, uint8_t position);
|
|
2963
|
+
|
|
2964
|
+
/**
|
|
2965
|
+
* @brief Set the font properties for a chart legend.
|
|
2966
|
+
*
|
|
2967
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
2968
|
+
* @param font A pointer to a chart #lxw_chart_font font struct.
|
|
2969
|
+
*
|
|
2970
|
+
* The `%chart_legend_set_font()` function is used to set the font of a
|
|
2971
|
+
* chart legend:
|
|
2972
|
+
*
|
|
2973
|
+
* @code
|
|
2974
|
+
* lxw_chart_font font = {.bold = LXW_TRUE, .color = LXW_COLOR_BLUE};
|
|
2975
|
+
*
|
|
2976
|
+
* chart_legend_set_font(chart, &font);
|
|
2977
|
+
* @endcode
|
|
2978
|
+
*
|
|
2979
|
+
* @image html chart_legend_set_font.png
|
|
2980
|
+
*
|
|
2981
|
+
* For more information see @ref chart_fonts.
|
|
2982
|
+
*/
|
|
2983
|
+
void chart_legend_set_font(lxw_chart *chart, lxw_chart_font *font);
|
|
2984
|
+
|
|
2985
|
+
/**
|
|
2986
|
+
* @brief Remove one or more series from the the legend.
|
|
2987
|
+
*
|
|
2988
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
2989
|
+
* @param delete_series An array of zero-indexed values to delete from series.
|
|
2990
|
+
*
|
|
2991
|
+
* @return A #lxw_error.
|
|
2992
|
+
*
|
|
2993
|
+
* The `%chart_legend_delete_series()` function allows you to remove/hide one
|
|
2994
|
+
* or more series in a chart legend (the series will still display on the chart).
|
|
2995
|
+
*
|
|
2996
|
+
* This function takes an array of one or more zero indexed series
|
|
2997
|
+
* numbers. The array should be terminated with -1.
|
|
2998
|
+
*
|
|
2999
|
+
* For example to remove the first and third zero-indexed series from the
|
|
3000
|
+
* legend of a chart with 3 series:
|
|
3001
|
+
*
|
|
3002
|
+
* @code
|
|
3003
|
+
* int16_t series[] = {0, 2, -1};
|
|
3004
|
+
*
|
|
3005
|
+
* chart_legend_delete_series(chart, series);
|
|
3006
|
+
* @endcode
|
|
3007
|
+
*
|
|
3008
|
+
* @image html chart_legend_delete.png
|
|
3009
|
+
*/
|
|
3010
|
+
lxw_error chart_legend_delete_series(lxw_chart *chart,
|
|
3011
|
+
int16_t delete_series[]);
|
|
3012
|
+
|
|
3013
|
+
/**
|
|
3014
|
+
* @brief Set the line properties for a chartarea.
|
|
3015
|
+
*
|
|
3016
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3017
|
+
* @param line A #lxw_chart_line struct.
|
|
3018
|
+
*
|
|
3019
|
+
* Set the line/border properties of a chartarea. In Excel the chartarea
|
|
3020
|
+
* is the background area behind the chart:
|
|
3021
|
+
*
|
|
3022
|
+
* @code
|
|
3023
|
+
* lxw_chart_line line = {.none = LXW_TRUE};
|
|
3024
|
+
* lxw_chart_fill fill = {.color = LXW_COLOR_RED};
|
|
3025
|
+
*
|
|
3026
|
+
* chart_chartarea_set_line(chart, &line);
|
|
3027
|
+
* chart_chartarea_set_fill(chart, &fill);
|
|
3028
|
+
* @endcode
|
|
3029
|
+
*
|
|
3030
|
+
* @image html chart_chartarea.png
|
|
3031
|
+
*
|
|
3032
|
+
* For more information see @ref chart_lines.
|
|
3033
|
+
*/
|
|
3034
|
+
void chart_chartarea_set_line(lxw_chart *chart, lxw_chart_line *line);
|
|
3035
|
+
|
|
3036
|
+
/**
|
|
3037
|
+
* @brief Set the fill properties for a chartarea.
|
|
3038
|
+
*
|
|
3039
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3040
|
+
* @param fill A #lxw_chart_fill struct.
|
|
3041
|
+
*
|
|
3042
|
+
* Set the fill properties of a chartarea:
|
|
3043
|
+
*
|
|
3044
|
+
* @code
|
|
3045
|
+
* chart_chartarea_set_fill(chart, &fill);
|
|
3046
|
+
* @endcode
|
|
3047
|
+
*
|
|
3048
|
+
* See the example and image above.
|
|
3049
|
+
*
|
|
3050
|
+
* For more information see @ref chart_fills.
|
|
3051
|
+
*/
|
|
3052
|
+
void chart_chartarea_set_fill(lxw_chart *chart, lxw_chart_fill *fill);
|
|
3053
|
+
|
|
3054
|
+
/**
|
|
3055
|
+
* @brief Set the pattern properties for a chartarea.
|
|
3056
|
+
*
|
|
3057
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3058
|
+
* @param pattern A #lxw_chart_pattern struct.
|
|
3059
|
+
*
|
|
3060
|
+
* Set the pattern properties of a chartarea:
|
|
3061
|
+
*
|
|
3062
|
+
* @code
|
|
3063
|
+
* chart_chartarea_set_pattern(series1, &pattern);
|
|
3064
|
+
* @endcode
|
|
3065
|
+
*
|
|
3066
|
+
* For more information see #lxw_chart_pattern_type and @ref chart_patterns.
|
|
3067
|
+
*/
|
|
3068
|
+
void chart_chartarea_set_pattern(lxw_chart *chart,
|
|
3069
|
+
lxw_chart_pattern *pattern);
|
|
3070
|
+
|
|
3071
|
+
/**
|
|
3072
|
+
* @brief Set the line properties for a plotarea.
|
|
3073
|
+
*
|
|
3074
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3075
|
+
* @param line A #lxw_chart_line struct.
|
|
3076
|
+
*
|
|
3077
|
+
* Set the line/border properties of a plotarea. In Excel the plotarea is
|
|
3078
|
+
* the area between the axes on which the chart series are plotted:
|
|
3079
|
+
*
|
|
3080
|
+
* @code
|
|
3081
|
+
* lxw_chart_line line = {.color = LXW_COLOR_RED,
|
|
3082
|
+
* .width = 2,
|
|
3083
|
+
* .dash_type = LXW_CHART_LINE_DASH_DASH};
|
|
3084
|
+
* lxw_chart_fill fill = {.color = 0xFFFFC2};
|
|
3085
|
+
*
|
|
3086
|
+
* chart_plotarea_set_line(chart, &line);
|
|
3087
|
+
* chart_plotarea_set_fill(chart, &fill);
|
|
3088
|
+
*
|
|
3089
|
+
* @endcode
|
|
3090
|
+
*
|
|
3091
|
+
* @image html chart_plotarea.png
|
|
3092
|
+
*
|
|
3093
|
+
* For more information see @ref chart_lines.
|
|
3094
|
+
*/
|
|
3095
|
+
void chart_plotarea_set_line(lxw_chart *chart, lxw_chart_line *line);
|
|
3096
|
+
|
|
3097
|
+
/**
|
|
3098
|
+
* @brief Set the fill properties for a plotarea.
|
|
3099
|
+
*
|
|
3100
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3101
|
+
* @param fill A #lxw_chart_fill struct.
|
|
3102
|
+
*
|
|
3103
|
+
* Set the fill properties of a plotarea:
|
|
3104
|
+
*
|
|
3105
|
+
* @code
|
|
3106
|
+
* chart_plotarea_set_fill(chart, &fill);
|
|
3107
|
+
* @endcode
|
|
3108
|
+
*
|
|
3109
|
+
* See the example and image above.
|
|
3110
|
+
*
|
|
3111
|
+
* For more information see @ref chart_fills.
|
|
3112
|
+
*/
|
|
3113
|
+
void chart_plotarea_set_fill(lxw_chart *chart, lxw_chart_fill *fill);
|
|
3114
|
+
|
|
3115
|
+
/**
|
|
3116
|
+
* @brief Set the pattern properties for a plotarea.
|
|
3117
|
+
*
|
|
3118
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3119
|
+
* @param pattern A #lxw_chart_pattern struct.
|
|
3120
|
+
*
|
|
3121
|
+
* Set the pattern properties of a plotarea:
|
|
3122
|
+
*
|
|
3123
|
+
* @code
|
|
3124
|
+
* chart_plotarea_set_pattern(series1, &pattern);
|
|
3125
|
+
* @endcode
|
|
3126
|
+
*
|
|
3127
|
+
* For more information see #lxw_chart_pattern_type and @ref chart_patterns.
|
|
3128
|
+
*/
|
|
3129
|
+
void chart_plotarea_set_pattern(lxw_chart *chart, lxw_chart_pattern *pattern);
|
|
3130
|
+
|
|
3131
|
+
/**
|
|
3132
|
+
* @brief Set the chart style type.
|
|
3133
|
+
*
|
|
3134
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3135
|
+
* @param style_id An index representing the chart style, 1 - 48.
|
|
3136
|
+
*
|
|
3137
|
+
* The `%chart_set_style()` function is used to set the style of the chart to
|
|
3138
|
+
* one of the 48 built-in styles available on the "Design" tab in Excel 2007:
|
|
3139
|
+
*
|
|
3140
|
+
* @code
|
|
3141
|
+
* chart_set_style(chart, 37)
|
|
3142
|
+
* @endcode
|
|
3143
|
+
*
|
|
3144
|
+
* @image html chart_style.png
|
|
3145
|
+
*
|
|
3146
|
+
* The style index number is counted from 1 on the top left in the Excel
|
|
3147
|
+
* dialog. The default style is 2.
|
|
3148
|
+
*
|
|
3149
|
+
* **Note:**
|
|
3150
|
+
*
|
|
3151
|
+
* In Excel 2013 the Styles section of the "Design" tab in Excel shows what
|
|
3152
|
+
* were referred to as "Layouts" in previous versions of Excel. These layouts
|
|
3153
|
+
* are not defined in the file format. They are a collection of modifications
|
|
3154
|
+
* to the base chart type. They can not be defined by the `chart_set_style()``
|
|
3155
|
+
* function.
|
|
3156
|
+
*
|
|
3157
|
+
*/
|
|
3158
|
+
void chart_set_style(lxw_chart *chart, uint8_t style_id);
|
|
3159
|
+
|
|
3160
|
+
/**
|
|
3161
|
+
* @brief Turn on a data table below the horizontal axis.
|
|
3162
|
+
*
|
|
3163
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3164
|
+
*
|
|
3165
|
+
* The `%chart_set_table()` function adds a data table below the horizontal
|
|
3166
|
+
* axis with the data used to plot the chart:
|
|
3167
|
+
*
|
|
3168
|
+
* @code
|
|
3169
|
+
* // Turn on the data table with default options.
|
|
3170
|
+
* chart_set_table(chart);
|
|
3171
|
+
* @endcode
|
|
3172
|
+
*
|
|
3173
|
+
* @image html chart_data_table1.png
|
|
3174
|
+
*
|
|
3175
|
+
* The data table can only be shown with Bar, Column, Line and Area charts.
|
|
3176
|
+
*
|
|
3177
|
+
*/
|
|
3178
|
+
void chart_set_table(lxw_chart *chart);
|
|
3179
|
+
|
|
3180
|
+
/**
|
|
3181
|
+
* @brief Turn on/off grid options for a chart data table.
|
|
3182
|
+
*
|
|
3183
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3184
|
+
* @param horizontal Turn on/off the horizontal grid lines in the table.
|
|
3185
|
+
* @param vertical Turn on/off the vertical grid lines in the table.
|
|
3186
|
+
* @param outline Turn on/off the outline lines in the table.
|
|
3187
|
+
* @param legend_keys Turn on/off the legend keys in the table.
|
|
3188
|
+
*
|
|
3189
|
+
* The `%chart_set_table_grid()` function turns on/off grid options for a
|
|
3190
|
+
* chart data table. The data table grid options in Excel are shown in the
|
|
3191
|
+
* dialog below:
|
|
3192
|
+
*
|
|
3193
|
+
* @image html chart_data_table3.png
|
|
3194
|
+
*
|
|
3195
|
+
* These options can be passed to the `%chart_set_table_grid()` function.
|
|
3196
|
+
* The values for a default chart are:
|
|
3197
|
+
*
|
|
3198
|
+
* - `horizontal`: On.
|
|
3199
|
+
* - `vertical`: On.
|
|
3200
|
+
* - `outline`: On.
|
|
3201
|
+
* - `legend_keys`: Off.
|
|
3202
|
+
*
|
|
3203
|
+
* Example:
|
|
3204
|
+
*
|
|
3205
|
+
* @code
|
|
3206
|
+
* // Turn on the data table with default options.
|
|
3207
|
+
* chart_set_table(chart);
|
|
3208
|
+
*
|
|
3209
|
+
* // Turn on all grid lines and the grid legend.
|
|
3210
|
+
* chart_set_table_grid(chart, LXW_TRUE, LXW_TRUE, LXW_TRUE, LXW_TRUE);
|
|
3211
|
+
*
|
|
3212
|
+
* // Turn off the legend since it is show in the table.
|
|
3213
|
+
* chart_legend_set_position(chart, LXW_CHART_LEGEND_NONE);
|
|
3214
|
+
*
|
|
3215
|
+
* @endcode
|
|
3216
|
+
*
|
|
3217
|
+
* @image html chart_data_table2.png
|
|
3218
|
+
*
|
|
3219
|
+
* The data table can only be shown with Bar, Column, Line and Area charts.
|
|
3220
|
+
*
|
|
3221
|
+
*/
|
|
3222
|
+
void chart_set_table_grid(lxw_chart *chart, uint8_t horizontal,
|
|
3223
|
+
uint8_t vertical, uint8_t outline,
|
|
3224
|
+
uint8_t legend_keys);
|
|
3225
|
+
|
|
3226
|
+
void chart_set_table_font(lxw_chart *chart, lxw_chart_font *font);
|
|
3227
|
+
|
|
3228
|
+
/**
|
|
3229
|
+
* @brief Turn on up-down bars for the chart.
|
|
3230
|
+
*
|
|
3231
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3232
|
+
*
|
|
3233
|
+
* The `%chart_set_up_down_bars()` function adds Up-Down bars to Line charts
|
|
3234
|
+
* to indicate the difference between the first and last data series:
|
|
3235
|
+
*
|
|
3236
|
+
* @code
|
|
3237
|
+
* chart_set_up_down_bars(chart);
|
|
3238
|
+
* @endcode
|
|
3239
|
+
*
|
|
3240
|
+
* @image html chart_data_tools4.png
|
|
3241
|
+
*
|
|
3242
|
+
* Up-Down bars are only available in Line charts. By default Up-Down bars are
|
|
3243
|
+
* black and white like in the above example. To format the border or fill
|
|
3244
|
+
* of the bars see the `chart_set_up_down_bars_format()` function below.
|
|
3245
|
+
*/
|
|
3246
|
+
void chart_set_up_down_bars(lxw_chart *chart);
|
|
3247
|
+
|
|
3248
|
+
/**
|
|
3249
|
+
* @brief Turn on up-down bars for the chart, with formatting.
|
|
3250
|
+
*
|
|
3251
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3252
|
+
* @param up_bar_line A #lxw_chart_line struct for the up-bar border.
|
|
3253
|
+
* @param up_bar_fill A #lxw_chart_fill struct for the up-bar fill.
|
|
3254
|
+
* @param down_bar_line A #lxw_chart_line struct for the down-bar border.
|
|
3255
|
+
* @param down_bar_fill A #lxw_chart_fill struct for the down-bar fill.
|
|
3256
|
+
*
|
|
3257
|
+
* The `%chart_set_up_down_bars_format()` function adds Up-Down bars to Line
|
|
3258
|
+
* charts to indicate the difference between the first and last data series.
|
|
3259
|
+
* It also allows the up and down bars to be formatted:
|
|
3260
|
+
*
|
|
3261
|
+
* @code
|
|
3262
|
+
* lxw_chart_line line = {.color = LXW_COLOR_BLACK};
|
|
3263
|
+
* lxw_chart_fill up_fill = {.color = 0x00B050};
|
|
3264
|
+
* lxw_chart_fill down_fill = {.color = LXW_COLOR_RED};
|
|
3265
|
+
*
|
|
3266
|
+
* chart_set_up_down_bars_format(chart, &line, &up_fill, &line, &down_fill);
|
|
3267
|
+
* @endcode
|
|
3268
|
+
*
|
|
3269
|
+
* @image html chart_up_down_bars.png
|
|
3270
|
+
*
|
|
3271
|
+
* Up-Down bars are only available in Line charts.
|
|
3272
|
+
* For more format information see @ref chart_lines and @ref chart_fills.
|
|
3273
|
+
*/
|
|
3274
|
+
void chart_set_up_down_bars_format(lxw_chart *chart,
|
|
3275
|
+
lxw_chart_line *up_bar_line,
|
|
3276
|
+
lxw_chart_fill *up_bar_fill,
|
|
3277
|
+
lxw_chart_line *down_bar_line,
|
|
3278
|
+
lxw_chart_fill *down_bar_fill);
|
|
3279
|
+
|
|
3280
|
+
/**
|
|
3281
|
+
* @brief Turn on and format Drop Lines for a chart.
|
|
3282
|
+
*
|
|
3283
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3284
|
+
* @param line A #lxw_chart_line struct.
|
|
3285
|
+
*
|
|
3286
|
+
* The `%chart_set_drop_lines()` function adds Drop Lines to charts to
|
|
3287
|
+
* show the Category value of points in the data:
|
|
3288
|
+
*
|
|
3289
|
+
* @code
|
|
3290
|
+
* chart_set_drop_lines(chart, NULL);
|
|
3291
|
+
* @endcode
|
|
3292
|
+
*
|
|
3293
|
+
* @image html chart_data_tools6.png
|
|
3294
|
+
*
|
|
3295
|
+
* It is possible to format the Drop Line line properties if required:
|
|
3296
|
+
*
|
|
3297
|
+
* @code
|
|
3298
|
+
* lxw_chart_line line = {.color = LXW_COLOR_RED,
|
|
3299
|
+
* .dash_type = LXW_CHART_LINE_DASH_SQUARE_DOT};
|
|
3300
|
+
*
|
|
3301
|
+
* chart_set_drop_lines(chart, &line);
|
|
3302
|
+
* @endcode
|
|
3303
|
+
*
|
|
3304
|
+
* Drop Lines are only available in Line and Area charts.
|
|
3305
|
+
* For more format information see @ref chart_lines.
|
|
3306
|
+
*/
|
|
3307
|
+
void chart_set_drop_lines(lxw_chart *chart, lxw_chart_line *line);
|
|
3308
|
+
|
|
3309
|
+
/**
|
|
3310
|
+
* @brief Turn on and format high-low Lines for a chart.
|
|
3311
|
+
*
|
|
3312
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3313
|
+
* @param line A #lxw_chart_line struct.
|
|
3314
|
+
*
|
|
3315
|
+
* The `%chart_set_high_low_lines()` function adds High-Low Lines to charts
|
|
3316
|
+
* to show the Category value of points in the data:
|
|
3317
|
+
*
|
|
3318
|
+
* @code
|
|
3319
|
+
* chart_set_high_low_lines(chart, NULL);
|
|
3320
|
+
* @endcode
|
|
3321
|
+
*
|
|
3322
|
+
* @image html chart_data_tools5.png
|
|
3323
|
+
*
|
|
3324
|
+
* It is possible to format the High-Low Line line properties if required:
|
|
3325
|
+
*
|
|
3326
|
+
* @code
|
|
3327
|
+
* lxw_chart_line line = {.color = LXW_COLOR_RED,
|
|
3328
|
+
* .dash_type = LXW_CHART_LINE_DASH_SQUARE_DOT};
|
|
3329
|
+
*
|
|
3330
|
+
* chart_set_high_low_lines(chart, &line);
|
|
3331
|
+
* @endcode
|
|
3332
|
+
*
|
|
3333
|
+
* High-Low Lines are only available in Line charts.
|
|
3334
|
+
* For more format information see @ref chart_lines.
|
|
3335
|
+
*/
|
|
3336
|
+
void chart_set_high_low_lines(lxw_chart *chart, lxw_chart_line *line);
|
|
3337
|
+
|
|
3338
|
+
/**
|
|
3339
|
+
* @brief Set the overlap between series in a Bar/Column chart.
|
|
3340
|
+
*
|
|
3341
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3342
|
+
* @param overlap The overlap between the series. -100 to 100.
|
|
3343
|
+
*
|
|
3344
|
+
* The `%chart_set_series_overlap()` function sets the overlap between series
|
|
3345
|
+
* in Bar and Column charts.
|
|
3346
|
+
*
|
|
3347
|
+
* @code
|
|
3348
|
+
* chart_set_series_overlap(chart, -50);
|
|
3349
|
+
* @endcode
|
|
3350
|
+
*
|
|
3351
|
+
* @image html chart_overlap.png
|
|
3352
|
+
*
|
|
3353
|
+
* The overlap value must be in the range `0 <= overlap <= 500`.
|
|
3354
|
+
* The default value is 0.
|
|
3355
|
+
*
|
|
3356
|
+
* This option is only available for Bar/Column charts.
|
|
3357
|
+
*/
|
|
3358
|
+
void chart_set_series_overlap(lxw_chart *chart, int8_t overlap);
|
|
3359
|
+
|
|
3360
|
+
/**
|
|
3361
|
+
* @brief Set the gap between series in a Bar/Column chart.
|
|
3362
|
+
*
|
|
3363
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3364
|
+
* @param gap The gap between the series. 0 to 500.
|
|
3365
|
+
*
|
|
3366
|
+
* The `%chart_set_series_gap()` function sets the gap between series in
|
|
3367
|
+
* Bar and Column charts.
|
|
3368
|
+
*
|
|
3369
|
+
* @code
|
|
3370
|
+
* chart_set_series_gap(chart, 400);
|
|
3371
|
+
* @endcode
|
|
3372
|
+
*
|
|
3373
|
+
* @image html chart_gap.png
|
|
3374
|
+
*
|
|
3375
|
+
* The gap value must be in the range `0 <= gap <= 500`. The default value
|
|
3376
|
+
* is 150.
|
|
3377
|
+
*
|
|
3378
|
+
* This option is only available for Bar/Column charts.
|
|
3379
|
+
*/
|
|
3380
|
+
void chart_set_series_gap(lxw_chart *chart, uint16_t gap);
|
|
3381
|
+
|
|
3382
|
+
/**
|
|
3383
|
+
* @brief Set the option for displaying blank data in a chart.
|
|
3384
|
+
*
|
|
3385
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3386
|
+
* @param option The display option. A #lxw_chart_blank option.
|
|
3387
|
+
*
|
|
3388
|
+
* The `%chart_show_blanks_as()` function controls how blank data is displayed
|
|
3389
|
+
* in a chart:
|
|
3390
|
+
*
|
|
3391
|
+
* @code
|
|
3392
|
+
* chart_show_blanks_as(chart, LXW_CHART_BLANKS_AS_CONNECTED);
|
|
3393
|
+
* @endcode
|
|
3394
|
+
*
|
|
3395
|
+
* The `option` parameter can have one of the following values:
|
|
3396
|
+
*
|
|
3397
|
+
* - #LXW_CHART_BLANKS_AS_GAP: Show empty chart cells as gaps in the data.
|
|
3398
|
+
* This is the default option for Excel charts.
|
|
3399
|
+
* - #LXW_CHART_BLANKS_AS_ZERO: Show empty chart cells as zeros.
|
|
3400
|
+
* - #LXW_CHART_BLANKS_AS_CONNECTED: Show empty chart cells as connected.
|
|
3401
|
+
* Only for charts with lines.
|
|
3402
|
+
*/
|
|
3403
|
+
void chart_show_blanks_as(lxw_chart *chart, uint8_t option);
|
|
3404
|
+
|
|
3405
|
+
/**
|
|
3406
|
+
* @brief Display data on charts from hidden rows or columns.
|
|
3407
|
+
*
|
|
3408
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3409
|
+
*
|
|
3410
|
+
* Display data that is in hidden rows or columns on the chart:
|
|
3411
|
+
*
|
|
3412
|
+
* @code
|
|
3413
|
+
* chart_show_hidden_data(chart);
|
|
3414
|
+
* @endcode
|
|
3415
|
+
*/
|
|
3416
|
+
void chart_show_hidden_data(lxw_chart *chart);
|
|
3417
|
+
|
|
3418
|
+
/**
|
|
3419
|
+
* @brief Set the Pie/Doughnut chart rotation.
|
|
3420
|
+
*
|
|
3421
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3422
|
+
* @param rotation The angle of rotation.
|
|
3423
|
+
*
|
|
3424
|
+
* The `chart_set_rotation()` function is used to set the rotation of the
|
|
3425
|
+
* first segment of a Pie/Doughnut chart. This has the effect of rotating
|
|
3426
|
+
* the entire chart:
|
|
3427
|
+
*
|
|
3428
|
+
* @code
|
|
3429
|
+
* chart_set_rotation(chart, 28);
|
|
3430
|
+
* @endcode
|
|
3431
|
+
*
|
|
3432
|
+
* The angle of rotation must be in the range `0 <= rotation <= 360`.
|
|
3433
|
+
*
|
|
3434
|
+
* This option is only available for Pie/Doughnut charts.
|
|
3435
|
+
*
|
|
3436
|
+
*/
|
|
3437
|
+
void chart_set_rotation(lxw_chart *chart, uint16_t rotation);
|
|
3438
|
+
|
|
3439
|
+
/**
|
|
3440
|
+
* @brief Set the Doughnut chart hole size.
|
|
3441
|
+
*
|
|
3442
|
+
* @param chart Pointer to a lxw_chart instance to be configured.
|
|
3443
|
+
* @param size The hole size as a percentage.
|
|
3444
|
+
*
|
|
3445
|
+
* The `chart_set_hole_size()` function is used to set the hole size of a
|
|
3446
|
+
* Doughnut chart:
|
|
3447
|
+
*
|
|
3448
|
+
* @code
|
|
3449
|
+
* chart_set_hole_size(chart, 33);
|
|
3450
|
+
* @endcode
|
|
3451
|
+
*
|
|
3452
|
+
* The hole size must be in the range `10 <= size <= 90`.
|
|
3453
|
+
*
|
|
3454
|
+
* This option is only available for Doughnut charts.
|
|
3455
|
+
*
|
|
3456
|
+
*/
|
|
3457
|
+
void chart_set_hole_size(lxw_chart *chart, uint8_t size);
|
|
3458
|
+
|
|
3459
|
+
lxw_error lxw_chart_add_data_cache(lxw_series_range *range, uint8_t *data,
|
|
3460
|
+
uint16_t rows, uint8_t cols, uint8_t col);
|
|
3461
|
+
|
|
3462
|
+
/* Declarations required for unit testing. */
|
|
3463
|
+
#ifdef TESTING
|
|
3464
|
+
|
|
3465
|
+
STATIC void _chart_xml_declaration(lxw_chart *chart);
|
|
3466
|
+
STATIC void _chart_write_legend(lxw_chart *chart);
|
|
3467
|
+
|
|
3468
|
+
#endif /* TESTING */
|
|
3469
|
+
|
|
3470
|
+
/* *INDENT-OFF* */
|
|
3471
|
+
#ifdef __cplusplus
|
|
3472
|
+
}
|
|
3473
|
+
#endif
|
|
3474
|
+
/* *INDENT-ON* */
|
|
3475
|
+
|
|
3476
|
+
#endif /* __LXW_CHART_H__ */
|