Modernize chart rendering: theme layer, HiDPI zoom, downsampling - #21
Open
velteyn wants to merge 11 commits into
Open
Modernize chart rendering: theme layer, HiDPI zoom, downsampling#21velteyn wants to merge 11 commits into
velteyn wants to merge 11 commits into
Conversation
- Add ChartTheme/ChartThemes with Material palette defaults - Replace inline RGB literals in six chart classes with theme lookups - Apply theme defaults to MainPropertiesPage color selectors - Add ChartUtils.createBackingImage/getZoom helpers for SWT 4.31 zoom awareness - Migrate ChartCanvas/DateScaleCanvas offscreen images to recreate on zoom change - Enable GC anti-aliasing (shape + text) in Graphics constructor - Add OHLCDownsampler (min/max binning) and ScalarDownsampler (max-deviation) - Wire downsampling and range-based caching into all six chart setDataBounds - Cache keyed by (firstDate,lastDate,width); cleared on invalidate() - Add pure-function unit tests for both downsamplers in core.modern.tests - Update OpenSpec tasks.md checkboxes
OHLCDownsampler and ScalarDownsampler depend only on core types (IOHLC, OHLC, NumberValue, IAdaptable) -- zero SWT dependencies. Moving them to core.charts lets core.modern.tests run their unit tests without pulling in the full SWT/UI stack, fixing the Windows test-runtime failure (error 13 / native library resolution).
- Default chart type: candlestick (was bars in basic-template.xml) - Chart type switcher toolbar: Candlestick / OHLC Bars / Line / Area - Period/timeframe actions added to toolbar for quick time switching - Enhanced context menu with Chart Type and Period submenus - TraderPerspective: added orders/tickers placeholders, chart toolbars, show-view shortcuts for Watchlist/Level2/Orders/Tickers - ChartsPerspective: added markets/orders/level2/tickers/portfolio placeholders, more show-view shortcuts - Fixed paste action ID bug (was "copy") These changes make the chart interface functional out-of-the-box for a professional trading workflow, with chart type switching, period selection, and populated perspective defaults.
- MainChartFactory.setParameters fallback: Candles not Bars (this was the root cause of line charts on fresh open) - ChartsPerspective: markets view auto-opens in bottom panel - TraderPerspective: chart tool/zoom action sets added These were uncommitted edits from the previous toolbar commit.
- Register PreferenceInitializer in core bundle - Set DEFAULT_CONNECTOR_ID to org.eclipsetrader.jessx.connector - Level2View reads this preference when no saved connector exists (no more manual "Select Data Source" on each Level2 open)
- Level2View: when no saved connector in memento (first run), use default connector from CoreActivator (JessX streaming via PreferenceInitializer). Previously the fallback was unreachable because the entire block was skipped when id was null. - createPeriodActions: hardcoded fallback default period list (2Y,1Y,6M,3M,1M,5D,1D) when preference unmarshalling fails, so period menu is never empty. Verified: mvn clean install all 248 tests pass, product builds.
velteyn
force-pushed
the
feature/modernize-chart-rendering
branch
from
August 10, 2026 17:23
7a2861c to
c99ff17
Compare
- Add missing preferenceCustomization property to product extension in org.eclipsetrader.platform/plugin.xml. Without this, the plugin_customization.ini was never loaded by the workbench on first launch, meaning: - Initial perspective (traderPerspective) was not set - Default connector was not applied - All other customization defaults were ignored - Change default connector from Yahoo to JessX streaming (org.eclipsetrader.jessx.connector) for both live feed and backfill. Combined with Level2View fallback fix, Level2 now auto-connects to JessX on first open. Verified: mvn clean install all 248 tests pass, product assembles.
- CandleStickChart.Candle.paint(): min body width 2px, min body height 1px (doji candles now visible) - BarChart.Bar.paint(): min tick width 3px Without this, downsampled candles at high zoom-out (800 candles in 800px) had body width of 0-1px, appearing as invisible or flattened lines. The wick line was visible but the body was not.
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
Implements the
modernize-chart-renderingchange — three groups of improvements to the EclipseTrader chart subsystem.1. Theme layer
ChartTheme(immutable value object) +ChartThemes.getDefault()with Material palette (blue line33,150,243, teal positive38,166,154, red negative239,83,80, outline64,64,64)CandleStickChart,BarChart,OHLCLineChart,HistogramBarChart,HistogramAreaChart,LineChart) replace inlinenew RGB(...)withChartThemes.getDefault()lookupsMainPropertiesPagecolor-selector defaults now source from theme2. HiDPI rendering (SWT 4.31)
ChartUtils.createBackingImage(Canvas, Rectangle)creates logical-size offscreen images; SWT 4.31 auto-scales to device pixelsChartUtils.getZoom(Canvas)usesMonitor.getZoom()(4.31) withgetDPI()fallbackChartCanvas(main + vertical scale) andDateScaleCanvasnow recreate images on zoom change (previously only on resize;getBounds()is logical so resize check never fired on zoom)Graphicsconstructor enablessetAntialias(SWT.ON)+setTextAntialias(SWT.ON)for shape/text smoothing3. Downsampling and geometry caching
OHLCDownsampler: min/max binning per pixel column (preserves high/low, first-open/last-close); returns pooledIOHLC[]ScalarDownsampler: max-deviation-from-mean per column (preserves spikes) for line/area/histogram; returnsNumberValue[]setDataBounds: when visible points exceedclientArea.width, aggregate before geometry build(firstDate, lastDate, width)per chart object;invalidate()clears it4. Tests
OHLCDownsamplerandScalarDownsampler(boundary, extreme preservation, one-per-column) inorg.eclipsetrader.core.modern.testsNo local Java/Maven — CI build verification with
mvn package(Tycho 4.0.8, JDK 21) is needed.