Skip to content

feat(site): fix headless rendering, add Fixes & PRs gallery, standalone getChart() conversions, README update#940

Merged
timmolter merged 4 commits into
developfrom
timmolter/xchart-site-module
May 21, 2026
Merged

feat(site): fix headless rendering, add Fixes & PRs gallery, standalone getChart() conversions, README update#940
timmolter merged 4 commits into
developfrom
timmolter/xchart-site-module

Conversation

@timmolter
Copy link
Copy Markdown
Member

@timmolter timmolter commented May 21, 2026

What and why

This PR ships several improvements to the XChart GitHub Pages site (xchart-site module).


1. Fix missing chart images (headless AWT)

About 40% of charts on the live site rendered as broken images. Root cause: charts using setToolTipsEnabled(true) or setZoomEnabled(true) try to initialize Swing/AWT components that require a display, causing an NPE on headless Linux CI runners.

Fix: Add java.awt.headless=true as a system property in the exec-maven-plugin config in xchart-site/pom.xml. Also improved error logging to print the full stack trace (previously e.getMessage() silently returned null for NPEs).


2. Fixes & PRs gallery page (fixes.html)

A new page that:

  • Scans standalone.issues and standalone.prs packages for all TestForIssueNNN / TestForPRNNN classes
  • Renders each chart using the public static getChart() method
  • Extracts the issue/PR number from the class name and links each card to github.com/knowm/XChart/issues/NNN or .../pull/NNN
  • Handles variant names like TestForIssue27_1 (strips suffix before parsing number)
  • Shows a "No preview" placeholder for classes without a renderable getChart() method

3. Standalone test class conversions (43 files)

All TestForIssueNNN and TestForPRNNN classes in xchart-demo have been updated to expose a public static getChart() method, making them usable from GenerateSite without a display. Patterns used:

  • Delegation to existing named getChart*() methods
  • No-arg overloads for parameterized variants
  • Extraction from main()

4. Shared navigation

Both index.html and fixes.html share a buildHeader() / buildFooter() with a top nav (Gallery | Fixes & PRs | GitHub | Maven Central), with the active page highlighted.


5. README update

Added a "Chart Gallery" section above the demo instructions linking to https://knowm.github.io/XChart/.


CSS additions

  • .gh-link - GitHub link on fix cards
  • .chart-no-image / .no-image-label - placeholder for unrenderable charts
  • .header-links a.active - highlights current page in nav

timmolter and others added 3 commits May 21, 2026 23:48
Points readers to the GitHub Pages site as a no-install way to
browse all chart types before running the demo app locally.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add public static getChart() to all TestForIssueNNN and TestForPRNNN
classes that lacked it, enabling headless rendering for the xchart-site
gallery. main() methods are preserved unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…llery page

- Add java.awt.headless=true system property to exec-maven-plugin config
  so charts using setToolTipsEnabled/setZoomEnabled render correctly on CI
- Improve error logging: print full stack trace instead of just e.getMessage()
  (which returns null for NPEs)
- Add generateFixesPage(): scans standalone.issues and standalone.prs packages,
  renders each TestForIssueNNN/TestForPRNNN chart, and emits fixes.html with
  cards linked to the corresponding GitHub issue or pull request
- Add shared buildHeader()/buildFooter() helpers; index.html and fixes.html
  now share a navigation bar with Gallery and Fixes & PRs links
- Add CSS for .gh-link, .chart-no-image placeholder, and active header nav link

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@timmolter timmolter changed the title Add Chart Gallery link to README feat(site): fix headless rendering, add Fixes & PRs gallery, standalone getChart() conversions, README update May 21, 2026
The previous edit replaced only the import block but left the original
GenerateSite class body intact after the new one, causing a duplicate
class compiler error on CI.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@timmolter timmolter merged commit ab77677 into develop May 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant