Skip to content

WPF sample: chart UX overhaul (pan/zoom, candle sizing) and restyle#35

Open
toolsche wants to merge 2 commits into
spotware:masterfrom
toolsche:feat/wpf-sample-chart-ux
Open

WPF sample: chart UX overhaul (pan/zoom, candle sizing) and restyle#35
toolsche wants to merge 2 commits into
spotware:masterfrom
toolsche:feat/wpf-sample-chart-ux

Conversation

@toolsche

Copy link
Copy Markdown

UX and styling improvements for the WPF sample (Trading.UI.Sample).

Stacked on #34. That PR contains the locale fix the chart needs to render, so this diff includes those commits and will shrink once #34 is merged. Please review #34 first.

Chart rewrite around data windowing

The chartjs-chart-financial candlestick sizes candle width from the number of points in the dataset, so loading thousands of bars and showing a subset made candles collapse into sub-pixel sticks. chart.html now keeps the full history in JS and feeds only a fixed-size window (~100 candles, clamped 25–200) to the chart, so candles stay a readable, consistent width at any history depth.

Interaction (the Hammer-based zoom plugin was unreliable with this beta Chart.js build and is no longer used):

  • Drag pans through history (horizontal) and price (vertical)
  • Drag over the price axis scales the price range
  • Double-click restores automatic price fitting
  • Wheel zooms the time axis
  • The price axis auto-fits the visible candles

Styling

  • Accent theme switched to Cobalt; CefSharp initialized with the GPU disabled (CefSharp 90 is unstable with hardware acceleration on modern Windows).
  • Larger, centered default window and a styled splitter.
  • Roomier API-configuration dialog with field watermarks.

These are more opinionated than #34 — happy to adjust or drop any part.

🤖 Generated with Claude Code

toolsche and others added 2 commits June 12, 2026 17:16
- Chart.cs: format OHLC values with InvariantCulture. They were interpolated with the current culture, so on cultures using ',' as the decimal separator (e.g. German) createChart received invalid JavaScript and the chart stayed blank.
- WPF.Sample.csproj: add CopyToOutputDirectory for hammer.js and chartjs-plugin-zoom.min.js. They are referenced by chart.html but only had CopyToPublishDirectory, so they were missing from a normal build output.
- ChartingService.cs: load chart.html via a proper file:// URI resolved from the app directory (AppContext.BaseDirectory) instead of Environment.CurrentDirectory plus a raw Windows path.
- ShellViewModel.cs: de-duplicate conversion-symbol requests on account change. Each distinct quote asset is now requested once instead of once per symbol, cutting hundreds of sequential round-trips and bringing account load from minutes to seconds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
chart.html rewritten around data windowing: the financial plugin sizes candles from the number of points in the dataset, so it kept only a fixed-size window of candles on the chart while holding the full history in JS. This keeps candles a readable, consistent width at any history depth. Drag pans through time and price, dragging over the price axis scales it, double-click restores auto-fit, and the wheel zooms the time axis. The unreliable Hammer-based zoom plugin is no longer used. The price axis auto-fits the visible candles.
- App.xaml/App.xaml.cs: switch the accent theme to Cobalt and initialize CefSharp with the GPU disabled (CefSharp 90 is unstable with hardware acceleration on modern Windows).
- ShellView.xaml: larger, centered default window and a styled splitter.
- ApiConfigurationView.xaml: roomier dialog with field watermarks.

Stacked on the bug-fix PR; that one is needed for the chart to render on non-English locales, so the diff will shrink once it merges.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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