mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
Change lxw_chart_data_label field from .delete to .hide.
Change lxw_chart_data_label field from .delete to .hide in order to avoid reserved word conflict with C++. Issue #300
This commit is contained in:
parent
502e1a2e93
commit
2e6f3d7cdf
9 changed files with 27 additions and 26 deletions
1
Makefile
1
Makefile
|
|
@ -182,6 +182,7 @@ spellcheck:
|
|||
$(Q)for f in examples/*.c; do aspell --lang=en_US --check $$f; done
|
||||
$(Q)aspell --lang=en_US --check Changes.txt
|
||||
$(Q)aspell --lang=en_US --check Readme.md
|
||||
$(Q)aspell --lang=en_US --check docs/src/examples.txt
|
||||
|
||||
releasecheck:
|
||||
$(Q)dev/release/release_check.sh
|
||||
|
|
|
|||
|
|
@ -919,7 +919,7 @@ Chart 4: chart with custom string data labels.
|
|||
Chart 5: chart with custom data labels referenced from worksheet cells.
|
||||
@image html chart_data_labels15.png
|
||||
|
||||
Chart 6: chart with a mix of custom and default labels. The items inialised
|
||||
Chart 6: chart with a mix of custom and default labels. The items initialized
|
||||
with '{0}' and items without a custom label (points 5 and 6 which come after
|
||||
NULL) will get the default value. We also set a font for the custom items as
|
||||
an extra example.
|
||||
|
|
|
|||
|
|
@ -478,7 +478,7 @@ Chart 4: chart with custom string data labels.
|
|||
Chart 5: chart with custom data labels referenced from worksheet cells.
|
||||
@image html chart_data_labels15.png
|
||||
|
||||
Chart 6: chart with a mix of custom and default labels. The items inialised
|
||||
Chart 6: chart with a mix of custom and default labels. The items initialized
|
||||
with '{0}' and items without a custom label (points 5 and 6 which come after
|
||||
NULL) will get the default value. We also set a font for the custom items as
|
||||
an extra example.
|
||||
|
|
|
|||
|
|
@ -776,26 +776,26 @@ font for the label in the data series (see @ref chart_fonts):
|
|||
|
||||
@image html chart_data_labels20.png
|
||||
|
||||
The `delete` element in the #lxw_chart_data_label struct can be used to delete
|
||||
labels in a series. This can be useful if you want to highlight one or more
|
||||
cells in the series, for example the maximum and the minimum:
|
||||
The `hide` element in the #lxw_chart_data_label struct can be used to
|
||||
hide/delete labels in a series. This can be useful if you want to highlight
|
||||
one or more cells in the series, for example the maximum and the minimum:
|
||||
|
||||
@code
|
||||
// Add the series data labels.
|
||||
chart_series_set_labels(series);
|
||||
|
||||
// Create some custom labels.
|
||||
lxw_chart_data_label delete = {.delete = LXW_TRUE};
|
||||
lxw_chart_data_label keep = {.delete = LXW_FALSE};
|
||||
lxw_chart_data_label hide = {.hide = LXW_TRUE};
|
||||
lxw_chart_data_label keep = {.hide = LXW_FALSE};
|
||||
|
||||
// Create an array of label pointers. NULL indicates the end of the array.
|
||||
lxw_chart_data_label *data_labels[] = {
|
||||
&delete,
|
||||
&hide,
|
||||
&keep,
|
||||
&delete,
|
||||
&delete,
|
||||
&hide,
|
||||
&hide,
|
||||
&keep,
|
||||
&delete,
|
||||
&hide,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ int main() {
|
|||
|
||||
|
||||
/*
|
||||
* Chart 7. Example with deleted custom data labels.
|
||||
* Chart 7. Example with deleted/hidden custom data labels.
|
||||
*/
|
||||
chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);
|
||||
|
||||
|
|
@ -273,20 +273,20 @@ int main() {
|
|||
chart_series_set_labels(series);
|
||||
|
||||
/* Create some custom labels. */
|
||||
lxw_chart_data_label delete = {.delete = LXW_TRUE};
|
||||
lxw_chart_data_label keep = {.delete = LXW_FALSE};
|
||||
lxw_chart_data_label hide = {.hide = LXW_TRUE};
|
||||
lxw_chart_data_label keep = {.hide = LXW_FALSE};
|
||||
|
||||
/* An initialized struct like this would also work: */
|
||||
/* lxw_chart_data_label keep = {0}; */
|
||||
|
||||
/* Create an array of label pointers. NULL indicates the end of the array. */
|
||||
lxw_chart_data_label *data_labels7[] = {
|
||||
&delete,
|
||||
&hide,
|
||||
&keep,
|
||||
&delete,
|
||||
&delete,
|
||||
&hide,
|
||||
&hide,
|
||||
&keep,
|
||||
&delete,
|
||||
&hide,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -799,9 +799,9 @@ typedef struct lxw_chart_data_label {
|
|||
* @ref chart_custom_labels. */
|
||||
char *value;
|
||||
|
||||
/** Option to delete/hide the data label from the chart series.
|
||||
/** Option to hide/delete the data label from the chart series.
|
||||
* See @ref chart_custom_labels. */
|
||||
uint8_t delete;
|
||||
uint8_t hide;
|
||||
|
||||
/** The font properties for the chart data label. @ref chart_fonts. */
|
||||
lxw_chart_font *font;
|
||||
|
|
@ -812,7 +812,7 @@ typedef struct lxw_chart_data_label {
|
|||
typedef struct lxw_chart_custom_label {
|
||||
|
||||
char *value;
|
||||
uint8_t delete;
|
||||
uint8_t hide;
|
||||
lxw_chart_font *font;
|
||||
|
||||
/* We use a range to hold the label formula properties even though it
|
||||
|
|
|
|||
|
|
@ -2350,7 +2350,7 @@ _chart_write_custom_labels(lxw_chart *self, lxw_chart_series *series)
|
|||
for (index = 0; index < series->data_label_count; index++) {
|
||||
lxw_chart_custom_label *data_label = &series->data_labels[index];
|
||||
|
||||
if (!data_label->value && !data_label->range && !data_label->delete
|
||||
if (!data_label->value && !data_label->range && !data_label->hide
|
||||
&& !data_label->font) {
|
||||
|
||||
continue;
|
||||
|
|
@ -2361,7 +2361,7 @@ _chart_write_custom_labels(lxw_chart *self, lxw_chart_series *series)
|
|||
/* Write the c:idx element. */
|
||||
_chart_write_idx(self, index);
|
||||
|
||||
if (data_label->delete) {
|
||||
if (data_label->hide) {
|
||||
/* Write the c:delete element. */
|
||||
_chart_write_delete(self);
|
||||
}
|
||||
|
|
@ -5544,7 +5544,7 @@ chart_series_set_labels_custom(lxw_chart_series *series,
|
|||
|
||||
char *src_value = user_data_label->value;
|
||||
|
||||
data_label->delete = user_data_label->delete;
|
||||
data_label->hide = user_data_label->hide;
|
||||
|
||||
data_label->font = _chart_convert_font_args(user_data_label->font);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ int main() {
|
|||
|
||||
lxw_chart_series *series = chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
|
||||
|
||||
lxw_chart_data_label data_label1 = {.delete = LXW_TRUE};
|
||||
lxw_chart_data_label data_label1 = {.hide = LXW_TRUE};
|
||||
lxw_chart_data_label *data_labels[] = {&data_label1, NULL};
|
||||
|
||||
chart_series_set_labels_custom(series, data_labels);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ int main() {
|
|||
|
||||
lxw_chart_series *series = chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5");
|
||||
|
||||
lxw_chart_data_label data_label1 = {.delete = LXW_TRUE};
|
||||
lxw_chart_data_label data_label1 = {.hide = LXW_TRUE};
|
||||
lxw_chart_data_label data_label2 = {0};
|
||||
lxw_chart_data_label *data_labels[] = {&data_label1, &data_label2, &data_label1, &data_label2, &data_label1, NULL};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue