Repository navigation
fix(trading): keep price chart y-axis labels distinct - #180
Open
RaphaelFakhri wants to merge 1 commit into
Open
RaphaelFakhri wants to merge 1 commit into
RaphaelFakhri wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Summary
The price chart on the asset details screen formats y-axis ticks with a fixed precision: one decimal of thousands above $1,000 and whole dollars above $1. The chart shows the last 60 one-minute closes, so the y-axis range is usually narrow, and victory-native picks ticks closer together than that precision can show. Several ticks then get the same label, for example:
$3.9k$3.9k$3.9k$3.9k$3.865k$3.87k$3.875k$3.88k$177$177$178$178$176.5$177$177.5$178$2$2$2$2.31$2.32$2.33This change moves the formatter into a
formatAxisPricehelper next toformatPricein the SDK. The helper keeps theksuffix and the$prefix, but usesmaximumFractionDigitsinstead oftoFixed, so each tick keeps its significant digits without padding zeros.Test plan
packages/host/src/__tests__/formatAxisPrice-test.ts, which checks that tick sequences for each price range get distinct labels. With the previous formatting logic, 4 of 5 cases fail. With this change, all 5 pass.pnpm test,pnpm lint,pnpm typecheckandpnpm format:checkpass.Fixes #179