Skip to content

docs: demo custom Y-axis label formatting (issue #256)#987

Open
timmolter wants to merge 1 commit into
developfrom
issue-256-format-y-axis-labels
Open

docs: demo custom Y-axis label formatting (issue #256)#987
timmolter wants to merge 1 commit into
developfrom
issue-256-format-y-axis-labels

Conversation

@timmolter

Copy link
Copy Markdown
Member

Closes #256.

Context

Issue #256 requested the ability to "override the whole label formatting" of the Y-axis (beyond the decimal pattern), e.g. to apply time/date formatting to Y values.

Finding: already supported

AxesChartStyler.setYAxisTickLabelsFormattingFunction(Function<Double, String>) (and the convenience AxesChart.setCustomYAxisTickLabelsFormatter(...)) completely replaces the default numeric formatting. The function receives each raw tick value and returns the label string.

Wiring:

  • Axis_Y.getAxisTickCalculator selects AxisTickCalculator_Callback (or AxisTickCalculator_Logarithmic for log/non-Date axes) when the function is set.
  • Formatter_Custom invokes the user function per tick, bypassing the decimal pattern entirely.

The symmetric X-axis hook (setXAxisTickLabelsFormattingFunction) already existed as well.

This PR

Adds a how-to demo, TestForIssue256, that plots epoch-millis Y values and renders them as HH:mm time-of-day labels via a SimpleDateFormat — the reporter's exact use case. No library code change is needed.

Verified headless: the Y-axis renders 01:00, 01:08, 01:16, …

🤖 Generated with Claude Code

…sue #256)

Issue #256 asked to override the whole Y-axis label formatting (beyond the
decimal pattern), e.g. to apply time/date formatting to Y values. This is
already supported via
AxesChartStyler.setYAxisTickLabelsFormattingFunction(Function<Double,String>),
which routes through AxisTickCalculator_Callback -> Formatter_Custom and fully
replaces the default numeric formatting.

Add a how-to demo rendering epoch-millis Y values as HH:mm time-of-day labels.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@timmolter timmolter mentioned this pull request Jul 2, 2026
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.

Format Y axis labels

1 participant