Skip to content

fix(flet-charts): match axis labels with float tolerance#6459

Merged
FeodorFitsner merged 2 commits intorelease/v0.85.0from
fix/chart-axis-label-float-precision
May 1, 2026
Merged

fix(flet-charts): match axis labels with float tolerance#6459
FeodorFitsner merged 2 commits intorelease/v0.85.0from
fix/chart-axis-label-float-precision

Conversation

@FeodorFitsner
Copy link
Copy Markdown
Contributor

@FeodorFitsner FeodorFitsner commented May 1, 2026

Fixes #6445. Supersedes #6452 — thanks @KangZhaoKui for the original report and fix.

Description

ChartAxisLabel entries silently disappeared from the axis because labels were matched against tick values with ==, which fails for doubles like 0.1, 0.2, 0.3 due to IEEE 754 representation.

This change uses a tolerance-based comparison scaled by meta.appliedInterval, so it adapts to the chart's value range instead of relying on a hardcoded epsilon.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Test plan

Summary by Sourcery

Bug Fixes:

  • Fix axis labels not rendering when their double values failed exact equality comparison with tick values due to floating-point precision.

Floating-point comparison with == fails for values like 0.1, 0.2, 0.3
due to IEEE 754 representation, causing custom ChartAxisLabel entries
to silently disappear. Use a tolerance scaled by meta.appliedInterval
so it adapts to the chart's value range.

Fixes #6445
@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying flet-website-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2f860b9
Status:⚡️  Build in progress...

View logs

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

We've reviewed this pull request using the Sourcery rules engine

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying flet-examples with  Cloudflare Pages  Cloudflare Pages

Latest commit: de4d17e
Status: ✅  Deploy successful!
Preview URL: https://0981239e.flet-examples.pages.dev
Branch Preview URL: https://fix-chart-axis-label-float-p.flet-examples.pages.dev

View logs

@FeodorFitsner FeodorFitsner merged commit 7f28743 into release/v0.85.0 May 1, 2026
42 of 44 checks passed
@FeodorFitsner FeodorFitsner deleted the fix/chart-axis-label-float-precision branch May 1, 2026 17:15
@ndonkoHenri ndonkoHenri linked an issue May 1, 2026 that may be closed by this pull request
1 task
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.

bug: LineChart left_axis labels display incomplete

1 participant