Skip to content

Conversation

@OnlyJousting
Copy link
Contributor

The introduction of grid lines in the candle chart clashed with the original implementation of the user range series. The original implementation was a hack with two area series (a native area series always extends to the bottom of the chart). The second series acted as a blocker of the background color of the first (overriding the background color with the canvas background color) as well as adding the bottom price line of the range.

The CandleChart component is quite long and complicated, it should be broken up to be easier to understand but I didn't want to do it in this PR to keep it more reviewable.

Changes:

  • Created and implemented a custom liquidation range series
  • Uses price lines to mark the upper and lower edges of the liquidation range with dashed lines and price labels on the y-axis
  • Allows grid lines to always be visible (were being blocked by the previous background area series)
  • Support for start/end timestamps to visualize when the position was created (not yet implemented), this also allows for showing historical positions on the chart (not yet implemented)

@vercel
Copy link

vercel bot commented Nov 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
curve-dapp Ready Ready Preview Comment Nov 24, 2025 2:38pm
curve-dapp-storybook Ready Ready Preview Comment Nov 24, 2025 2:38pm

@0xAlunara
Copy link
Collaborator

Nice this also fixes the legend not working. In prod, once you toggle it off it can't be toggled on anymore lol
image

0xAlunara
0xAlunara previously approved these changes Nov 20, 2025
@OnlyJousting
Copy link
Contributor Author

Nice this also fixes the legend not working. In prod, once you toggle it off it can't be toggled on anymore lol image

Yes, this was awaited!

0xtutti
0xtutti previously approved these changes Nov 21, 2025
return true
}

const toTimestamp = (time?: Time): number | undefined => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is there so much ambiguity in the dates? The timestamps should either be required or not, they should be either number or string..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

..paranoia, the chart has blown up in the past by bad timestamp data

priceLinesRef: RefObject<{ top: IPriceLine | null; bottom: IPriceLine | null }> | null,
data: LiquidationRangePoint[],
) => {
if (!seriesRef.current) return
Copy link
Collaborator

Choose a reason for hiding this comment

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

why would this be called before the ref is set? Looks like a bug if we stop early and ignore the callback
Ideally these checks should be deleted

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the liquidation-range series is torn down and recreated whenever visibility or chart mount state changes, so there are moments where the effect fires while the ref is still null. Without the check we’d call setData on null during those transitions and never render the chart

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.

5 participants