[PR #501] [CLOSED] Feature request: Chart secondary axes #511

Closed
opened 2026-05-05 12:17:54 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jmcnamara/libxlsxwriter/pull/501
Author: @kruftindustries
Created: 1/3/2026
Status: Closed

Base: mainHead: master


📝 Commits (5)

📊 Changes

509 files changed (+9035 additions, -1215 deletions)

View changed files

📝 .gitignore (+2 -1)
📝 .indent.pro (+1 -0)
📝 Changes.txt (+79 -3)
📝 build.zig (+30 -67)
📝 build.zig.zon (+1 -1)
📝 dev/fuzzing/build.sh (+1 -1)
docs/WINDOWS_BUILD.md (+368 -0)
📝 docs/src/working_with_charts.dox (+0 -7)
📝 examples/chart.c (+3 -3)
📝 examples/chart_area.c (+6 -6)
📝 examples/chart_bar.c (+6 -6)
📝 examples/chart_clustered.c (+3 -3)
📝 examples/chart_column.c (+6 -6)
examples/chart_combined.c (+146 -0)
📝 examples/chart_data_labels.c (+9 -9)
📝 examples/chart_data_table.c (+4 -4)
📝 examples/chart_data_tools.c (+14 -14)
📝 examples/chart_doughnut.c (+4 -4)
📝 examples/chart_fonts.c (+1 -1)
examples/chart_gauge.c (+105 -0)

...and 80 more files

📄 Description

1.2.4 January 2 2026

  • Added support for secondary Y axis in charts. Series can be assigned to a
    secondary Y axis using an optional fourth parameter to chart_add_series().
    Secondary axes are accessible via the chart->x2_axis and chart->y2_axis
    pointers, and all existing chart_axis_set_*() functions work with these
    secondary axis pointers. The API is backward compatible with existing code.

  • Added support for combined charts via chart_combine(). Combined charts
    allow overlaying two different chart types (e.g., Column + Line, Bar + Line,
    Area + Column) on the same plot area. For combined charts with secondary
    axes, set chart->is_secondary = LXW_TRUE on the secondary chart.

  • Added chart_set_series_gap_y2() and chart_set_series_overlap_y2() to set
    the gap and overlap for series on a secondary Y axis in Bar/Column charts.

  • Added support for Stock charts via LXW_CHART_STOCK. Stock charts display
    High-Low-Close (HLC) or Open-High-Low-Close (OHLC) data. Default series
    formatting is applied automatically (line with no fill, appropriate markers).
    Stock charts support hi-low lines, drop lines, and up-down bars.

  • Added LXW_CHART_MARKER_DOT marker type used by Stock charts.

  • Added support for gradient fills in chart series, plotarea, and chartarea.
    New functions: chart_series_set_gradient(), chart_plotarea_set_gradient(),
    and chart_chartarea_set_gradient(). Supports linear, radial, rectangular,
    and path gradient types with 2-10 color stops.

  • Added support for textboxes via worksheet_insert_textbox() and
    worksheet_insert_textbox_opt(). Textboxes allow inserting text with a
    rectangular shape into a worksheet. The optional lxw_textbox_options
    struct allows setting width, height, offsets, scale, and description.

  • Added new chart examples:

    • chart_stock.c: Demonstrates stock chart creation with High-Low-Close data.
    • chart_pareto.c: Shows how to create a Pareto chart using combined Column
      and Line charts with a secondary Y axis.
    • chart_gauge.c: Demonstrates creating a gauge chart by combining Doughnut
      and Pie charts with custom point colors.
    • chart_gradient.c: Shows how to apply gradient fills to chart series
      and the plot area.
  • Added textbox.c example demonstrating textbox insertion.

  • Added support for sparklines via worksheet_add_sparkline(). Sparklines are
    mini-charts that fit in a single cell to show data trends at a glance. The
    lxw_sparkline_options struct allows configuring:

    • Sparkline type: line, column, or win/loss
    • Predefined styles (0-35)
    • Point markers: high, low, negative, first, last, and all markers
    • Custom colors for series, markers, and axis
    • Axis options: min, max, date axis, reverse, show hidden data
      Added new example:
    • sparklines.c: Demonstrates creating different sparkline types with
      various options and custom colors.
  • Added support for chart date axis via chart_axis_set_date_axis(). This
    enables date-based X axis on charts with automatic date formatting. Related
    functions for configuring time units:

    • chart_axis_set_major_unit_type(): Set major time unit (days/months/years)
    • chart_axis_set_minor_unit_type(): Set minor time unit (days/months/years)
  • Added autofit helper utility functions for calculating column widths based
    on string content:

    • lxw_pixel_width(): Calculate pixel width of a string (Calibri 11 font)
    • lxw_autofit_width(): Calculate column width suitable for
      worksheet_set_column()
      Note: Excel does not store autofit information in files; these functions
      help users calculate appropriate column widths programmatically.
  • Added support for inserting checkboxes in worksheet cells via
    worksheet_insert_checkbox(). Checkboxes are a feature of Excel 365
    from 2024 onwards. They are boolean values displayed as interactive
    checkboxes in cells. Added new example:

    • checkbox.c: Demonstrates inserting checkboxes with different states.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jmcnamara/libxlsxwriter/pull/501 **Author:** [@kruftindustries](https://github.com/kruftindustries) **Created:** 1/3/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `master` --- ### 📝 Commits (5) - [`fc0c7bd`](https://github.com/jmcnamara/libxlsxwriter/commit/fc0c7bd38283a25ff86c444f87d16aa807e0f950) - Added support for secondary Y axis in charts. Series can be assigned to a - [`ba04890`](https://github.com/jmcnamara/libxlsxwriter/commit/ba048905125945e57f6a8f5038c7b30d5f8166f8) added missing limit checks and improved tests - [`0d02193`](https://github.com/jmcnamara/libxlsxwriter/commit/0d021936012e8d69f8c100bf3be11856894b6f1c) added c99 flag to allow macros in functions with y2 axis - [`d6e295f`](https://github.com/jmcnamara/libxlsxwriter/commit/d6e295f220d9f2e46604ec1ef6f0fc02aee893c1) Merge branch 'master' of https://github.com/kruftindustries/libxlsxwriter.git - [`1260311`](https://github.com/jmcnamara/libxlsxwriter/commit/1260311271006ecf96eafc2b38b91df5a3994979) Fix code style and add .gitignore entry ### 📊 Changes **509 files changed** (+9035 additions, -1215 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+2 -1) 📝 `.indent.pro` (+1 -0) 📝 `Changes.txt` (+79 -3) 📝 `build.zig` (+30 -67) 📝 `build.zig.zon` (+1 -1) 📝 `dev/fuzzing/build.sh` (+1 -1) ➕ `docs/WINDOWS_BUILD.md` (+368 -0) 📝 `docs/src/working_with_charts.dox` (+0 -7) 📝 `examples/chart.c` (+3 -3) 📝 `examples/chart_area.c` (+6 -6) 📝 `examples/chart_bar.c` (+6 -6) 📝 `examples/chart_clustered.c` (+3 -3) 📝 `examples/chart_column.c` (+6 -6) ➕ `examples/chart_combined.c` (+146 -0) 📝 `examples/chart_data_labels.c` (+9 -9) 📝 `examples/chart_data_table.c` (+4 -4) 📝 `examples/chart_data_tools.c` (+14 -14) 📝 `examples/chart_doughnut.c` (+4 -4) 📝 `examples/chart_fonts.c` (+1 -1) ➕ `examples/chart_gauge.c` (+105 -0) _...and 80 more files_ </details> ### 📄 Description ## 1.2.4 January 2 2026 - Added support for secondary Y axis in charts. Series can be assigned to a secondary Y axis using an optional fourth parameter to `chart_add_series()`. Secondary axes are accessible via the `chart->x2_axis` and `chart->y2_axis` pointers, and all existing `chart_axis_set_*()` functions work with these secondary axis pointers. The API is backward compatible with existing code. - Added support for combined charts via `chart_combine()`. Combined charts allow overlaying two different chart types (e.g., Column + Line, Bar + Line, Area + Column) on the same plot area. For combined charts with secondary axes, set `chart->is_secondary = LXW_TRUE` on the secondary chart. - Added `chart_set_series_gap_y2()` and `chart_set_series_overlap_y2()` to set the gap and overlap for series on a secondary Y axis in Bar/Column charts. - Added support for Stock charts via `LXW_CHART_STOCK`. Stock charts display High-Low-Close (HLC) or Open-High-Low-Close (OHLC) data. Default series formatting is applied automatically (line with no fill, appropriate markers). Stock charts support hi-low lines, drop lines, and up-down bars. - Added `LXW_CHART_MARKER_DOT` marker type used by Stock charts. - Added support for gradient fills in chart series, plotarea, and chartarea. New functions: `chart_series_set_gradient()`, `chart_plotarea_set_gradient()`, and `chart_chartarea_set_gradient()`. Supports linear, radial, rectangular, and path gradient types with 2-10 color stops. - Added support for textboxes via `worksheet_insert_textbox()` and `worksheet_insert_textbox_opt()`. Textboxes allow inserting text with a rectangular shape into a worksheet. The optional `lxw_textbox_options` struct allows setting width, height, offsets, scale, and description. - Added new chart examples: - `chart_stock.c`: Demonstrates stock chart creation with High-Low-Close data. - `chart_pareto.c`: Shows how to create a Pareto chart using combined Column and Line charts with a secondary Y axis. - `chart_gauge.c`: Demonstrates creating a gauge chart by combining Doughnut and Pie charts with custom point colors. - `chart_gradient.c`: Shows how to apply gradient fills to chart series and the plot area. - Added `textbox.c` example demonstrating textbox insertion. - Added support for sparklines via `worksheet_add_sparkline()`. Sparklines are mini-charts that fit in a single cell to show data trends at a glance. The `lxw_sparkline_options` struct allows configuring: - Sparkline type: line, column, or win/loss - Predefined styles (0-35) - Point markers: high, low, negative, first, last, and all markers - Custom colors for series, markers, and axis - Axis options: min, max, date axis, reverse, show hidden data Added new example: - `sparklines.c`: Demonstrates creating different sparkline types with various options and custom colors. - Added support for chart date axis via `chart_axis_set_date_axis()`. This enables date-based X axis on charts with automatic date formatting. Related functions for configuring time units: - `chart_axis_set_major_unit_type()`: Set major time unit (days/months/years) - `chart_axis_set_minor_unit_type()`: Set minor time unit (days/months/years) - Added autofit helper utility functions for calculating column widths based on string content: - `lxw_pixel_width()`: Calculate pixel width of a string (Calibri 11 font) - `lxw_autofit_width()`: Calculate column width suitable for `worksheet_set_column()` Note: Excel does not store autofit information in files; these functions help users calculate appropriate column widths programmatically. - Added support for inserting checkboxes in worksheet cells via `worksheet_insert_checkbox()`. Checkboxes are a feature of Excel 365 from 2024 onwards. They are boolean values displayed as interactive checkboxes in cells. Added new example: - `checkbox.c`: Demonstrates inserting checkboxes with different states. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror added the
pull-request
label 2026-05-05 12:17:54 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#511
No description provided.