Skip to content

Add setChartTitleFontColor() for independent title text color control#967

Merged
timmolter merged 1 commit into
developfrom
timmolter/issue-706-chart-title-font-color
Jun 9, 2026
Merged

Add setChartTitleFontColor() for independent title text color control#967
timmolter merged 1 commit into
developfrom
timmolter/issue-706-chart-title-font-color

Conversation

@timmolter

Copy link
Copy Markdown
Member

Motivation

There was no way to set the chart title font color independently -- setChartFontColor() controls the title, axes labels, and legend all at once. Issue #706 asks for finer-grained control over just the title text color, consistent with the per-axis color overrides already available (e.g. setXAxisTitleColor()).

Approach

Added chartTitleFontColor to Styler as an optional override:

  • getChartTitleFontColor() returns the override if set, otherwise falls back to chartFontColor -- fully backward compatible.
  • setChartTitleFontColor(Color) is fluent and lives alongside the other chart title settings (setChartTitleFont, setChartTitleBoxBackgroundColor, etc.).
  • ChartTitle now calls getChartTitleFontColor() instead of getChartFontColor() for both the regular text and TeX render paths.

Usage

chart.getStyler().setChartTitleFontColor(Color.RED);

// or combine with a custom font
chart.getStyler()
    .setChartTitleFontColor(new Color(220, 100, 0))
    .setChartTitleFont(new Font("Arial", Font.BOLD, 20));

Testing

  • 4 unit tests in StylerChartTitleFontColorTest: default fallback, override, isolation from chartFontColor, and reset-to-null fallback.
  • Demo: TestForIssue706 -- displays three charts side by side (default, red title, orange bold title) to visually verify the feature.

Adds a dedicated chartTitleFontColor field to Styler that allows
independent control of the chart title text color. When not set it
falls back to chartFontColor, preserving existing behavior.

ChartTitle now uses getChartTitleFontColor() instead of
getChartFontColor() so the override is respected during rendering.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@timmolter timmolter merged commit 2c8a0f9 into develop Jun 9, 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