Skip to content

feat: Enhance chart title features with overlay, fill, and layout options#2278

Merged
xuri merged 6 commits intoqax-os:masterfrom
debugdoctor:master
Mar 23, 2026
Merged

feat: Enhance chart title features with overlay, fill, and layout options#2278
xuri merged 6 commits intoqax-os:masterfrom
debugdoctor:master

Conversation

@debugdoctor
Copy link
Copy Markdown
Contributor

@debugdoctor debugdoctor commented Mar 17, 2026

Description

Add support for chart title customization: overlay mode, background fill, border style, and manual layout position. Introduces four new fields to the Chart struct while keeping Title []RichTextRun unchanged for full backward compatibility.

New fields added to Chart:

  • TitleOverlay bool — whether the title overlaps the plot area
  • TitleFill Fill — background fill for the title box
  • TitleBorder ChartLine — border line style for the title box
  • TitleLayout *ChartTitleLayout — manual position/size as fractions of chart area (0.0–1.0)

Internal changes:

  • cTitle.Layout corrected from string to *cLayout for proper OOXML mapping
  • Added cLayout and cManualLayout XML structs
  • drawPlotAreaTitles refactored to accept a *chartTitle helper struct

Motivation and Context

Previously there was no way to control the chart title's visual style or exact position. Users who needed to overlay the title on the plot area, apply a background color, add a border, or pin the title to a specific region of the chart had no API to do so.

How Has This Been Tested

Unit tests added in chart_test.go covering:

  • Chart title with manual layout (TitleLayout)
  • Chart title with overlay + fill + border (TitleOverlay, TitleFill, TitleBorder)
  • Chart title with border only
  • Chart title with no overlay (default behavior)

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

debugdoctor and others added 2 commits March 17, 2026 14:05
…y, add TitleOverlay, TitleFill, TitleBorder and TitleLayout fields

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@xuri xuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR. I've left some comments.

@xuri xuri added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 17, 2026
@debugdoctor debugdoctor requested a review from xuri March 17, 2026 09:57
debugdoctor and others added 3 commits March 19, 2026 14:31
- Add exported `ChartTitle` data type
- Change Title field data type of Chart from []RichTextRun to ChartTitle
- Update README and unit tests
- Update chart cell for tests
@xuri xuri moved this to Features in Excelize v2.11.0 Mar 22, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.60%. Comparing base (ae7a616) to head (495a1d5).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2278   +/-   ##
=======================================
  Coverage   99.60%   99.60%           
=======================================
  Files          32       32           
  Lines       26654    26697   +43     
=======================================
+ Hits        26548    26591   +43     
  Misses         55       55           
  Partials       51       51           
Flag Coverage Δ
unittests 99.60% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

- Renamed data type ChartDashType to LineDashType
- Renamed data type ChartLineType to LineType
- Renamed data type ChartLine to LineOptions
- Change Line field data type of Shape from ShapeLine to LineOptions
@debugdoctor
Copy link
Copy Markdown
Contributor Author

Great

Copy link
Copy Markdown
Member

@xuri xuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The screenshot below shows the line formatting settings panels for both shape outlines and chart title lines. As you can see, properties such as line type and width are consistent across both, which allows us to reuse the same data structure for line formatting.

Image

Based on your branch, I have introduced some breaking changes, including the adoption of LintOptions for both shapes and charts.

@xuri xuri merged commit 48a958f into qax-os:master Mar 23, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

Status: Features

Development

Successfully merging this pull request may close these issues.

2 participants