docs: demo custom Y-axis label formatting (issue #256)#987
Open
timmolter wants to merge 1 commit into
Open
Conversation
…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>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 convenienceAxesChart.setCustomYAxisTickLabelsFormatter(...)) completely replaces the default numeric formatting. The function receives each raw tick value and returns the label string.Wiring:
Axis_Y.getAxisTickCalculatorselectsAxisTickCalculator_Callback(orAxisTickCalculator_Logarithmicfor log/non-Date axes) when the function is set.Formatter_Custominvokes 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 asHH:mmtime-of-day labels via aSimpleDateFormat— 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