mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 06:06:09 -06:00
[GH-ISSUE #504] Feature Request: Gradient Fills for Charts #391
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#391
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kruftindustries on GitHub (Jan 12, 2026).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/504
Originally assigned to: @jmcnamara on GitHub.
Support for gradient fills on chart series and plot areas, allowing smooth color transitions for enhanced visual presentation.
API Changes:
New enum in chart.h:
typedef enum lxw_chart_gradient_fill_type {LXW_CHART_GRADIENT_FILL_LINEAR, /* Linear gradient */LXW_CHART_GRADIENT_FILL_RADIAL, /* Radial gradient */LXW_CHART_GRADIENT_FILL_RECTANGULAR, /* Rectangular gradient */LXW_CHART_GRADIENT_FILL_PATH /* Path gradient */} lxw_chart_gradient_fill_type;New struct in chart.h:
typedef struct lxw_chart_gradient_fill {lxw_chart_gradient_fill_type type; /* Gradient type */lxw_color_t colors[LXW_CHART_GRADIENT_FILL_MAX_STOPS]; /* Color array */uint8_t positions[LXW_CHART_GRADIENT_FILL_MAX_STOPS]; /* Stop positions (0-100) */uint8_t num_stops; /* Number of stops (2-10) */double angle; /* Angle for linear gradients (0-359) */} lxw_chart_gradient_fill;New functions:
void chart_series_set_gradient(lxw_chart_series *series, lxw_chart_gradient_fill *gradient);void chart_chartarea_set_gradient(lxw_chart *chart, lxw_chart_gradient_fill *gradient);void chart_plotarea_set_gradient(lxw_chart *chart, lxw_chart_gradient_fill *gradient);Code Example:
#include "xlsxwriter.h"int main() {lxw_workbook *workbook = workbook_new("gradient.xlsx");lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);lxw_chart *chart = workbook_add_chart(workbook, LXW_CHART_COLUMN);lxw_chart_series *series = chart_add_series(chart, NULL, "=Sheet1!$A$1:$A$5", 0);/* Apply gradient fill: dark to light */lxw_chart_gradient_fill gradient = {.type = LXW_CHART_GRADIENT_FILL_LINEAR,.colors = {0x963735, 0xF1DCDB},.num_stops = 2,};chart_series_set_gradient(series, &gradient);worksheet_insert_chart(worksheet, CELL("C2"), chart);return workbook_close(workbook);}@jmcnamara commented on GitHub (Jan 12, 2026):
This one is useful and slightly higher priority but the requires a good bit of API additions. I would say this is medium to long term.