Skip to content

feat(analysis): add TradingView-style price scale interaction to the … - #11

Open
Impulssi wants to merge 1 commit into
froooze:testfrom
Impulssi:feat/tradingview-chart-interactions
Open

feat(analysis): add TradingView-style price scale interaction to the …#11
Impulssi wants to merge 1 commit into
froooze:testfrom
Impulssi:feat/tradingview-chart-interactions

Conversation

@Impulssi

@Impulssi Impulssi commented Aug 24, 2026

Copy link
Copy Markdown

…chart exporter

The exported HTML chart locked the price (y) scale to auto-fit, which made zoomed-in inspection awkward: axis ticks were sparse, prices used an uneven precision format, and the last price was not visible on the axis. The chart also clipped panning to the data edges, so there was no empty grid space around the series like TradingView shows.

Price scale interaction

  • Wheel or drag on the price axis zooms/shrinks the visible price band (manual scale); double-click on the axis restores auto-fit.
  • Vertical drag inside the chart pans the price scale and activates the manual mode, mirroring the existing horizontal time pan.
  • Manual range is clamped to sensible bounds derived from the data (floor ~35% below data min, ceil ~1.6x data max, max span ~1.6x the data price range) so the scale cannot collapse to a sliver or run away.
  • The manual scale resets on chart rebuild, price-scale toggle and pair orientation flip, where the unit changes and the old range is invalid.

Axis and price marker

  • Price axis moved to the right side and tick spacing tightened so more price levels appear at every zoom level.
  • Adaptive decimal formatting on axis values based on the tick step.
  • TradingView-style last-price marker: colored label pinned to the price axis plus a dashed crosshair line through the chart, log-scale aware.

Time axis breathing room

  • Wheel zoom-out now allows up to ~2.5x the data span and clampRange permits up to ~75% of the data span as empty padding on each side, so zooming out reveals the grid around the series instead of hard-clamping to the candles.

Testing Notes

  • npm run typecheck clean; full suite run on Windows shows the same pre-existing environment failures with and without this change.
  • Chart verified manually with 6-month and full-history (2021->2026) BTS/XBTSX.USDT LP datasets.

Note: I'm new to this codebase and worked through this change with an AI
coding assistant (opencode). The bug was hit on my own live instance and
all measurements / reproduction steps are mine — but please flag anything
in the code that looks off and I'll dig in and follow up.

…chart exporter

The exported HTML chart locked the price (y) scale to auto-fit, which made
zoomed-in inspection awkward: axis ticks were sparse, prices used an uneven
precision format, and the last price was not visible on the axis. The chart
also clipped panning to the data edges, so there was no empty grid space
around the series like TradingView shows.

## Price scale interaction
- Wheel or drag on the price axis zooms/shrinks the visible price band
  (manual scale); double-click on the axis restores auto-fit.
- Vertical drag inside the chart pans the price scale and activates the
  manual mode, mirroring the existing horizontal time pan.
- Manual range is clamped to sensible bounds derived from the data
  (floor ~35% below data min, ceil ~1.6x data max, max span ~1.6x the
  data price range) so the scale cannot collapse to a sliver or run away.
- The manual scale resets on chart rebuild, price-scale toggle and pair
  orientation flip, where the unit changes and the old range is invalid.

## Axis and price marker
- Price axis moved to the right side and tick spacing tightened so more
  price levels appear at every zoom level.
- Adaptive decimal formatting on axis values based on the tick step.
- TradingView-style last-price marker: colored label pinned to the price
  axis plus a dashed crosshair line through the chart, log-scale aware.

## Time axis breathing room
- Wheel zoom-out now allows up to ~2.5x the data span and clampRange
  permits up to ~75% of the data span as empty padding on each side, so
  zooming out reveals the grid around the series instead of hard-clamping
  to the candles.

## Testing Notes
- npm run typecheck clean; full suite run on Windows shows the same
  pre-existing environment failures with and without this change.
- Chart verified manually with 6-month and full-history (2021->2026)
  BTS/XBTSX.USDT LP datasets.
@Impulssi
Impulssi force-pushed the feat/tradingview-chart-interactions branch from 8e731d7 to 7c10107 Compare August 26, 2026 06:01
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.

1 participant