Skip to content

fix(chart): one path style for the server trace and the local staircase - #540

Merged
guyverino merged 1 commit into
mainfrom
fix/order-trail-path-style
Sep 13, 2026
Merged

fix(chart): one path style for the server trace and the local staircase#540
guyverino merged 1 commit into
mainfrom
fix/order-trail-path-style

Conversation

@guyverino

Copy link
Copy Markdown
Collaborator

What & why

An order's repricing history is drawn two mutually exclusive ways in moon-chart/order_geometry.rs: the trace the core sends with the order (buy_trace/sell_traceserver_points) and the staircase the terminal reconstructs from its own price steps when the core sends none. Settings → Lines → Path styled only the staircase, while the server trace kept its own hard-coded pen in the line's colour — so on nearly every chart the section changed nothing, and the only way to lose the trail was the per-tab checkbox in the chart graphics popup (#508, reported from chat with a screenshot).

Now one PathStyle drives both representations:

  • show — hides the server trace (and its temporary-point riser) exactly as it hides the staircase; the staircase's knots go with it.
  • colour — either the path's own colour or, with the new use_line_color, the colour of the line the path belongs to (the server trace's historical look).
  • thickness and dashed — reach the server trace too; Moonbot's wide-window rule (solid, half opacity) still sits on top of the user's dash.
  • alphatrace_alpha was only in orders.toml; it is now a slider in the same section.

The section is retitled «История переносов (путь / змейка)» / "Repricing trail (path)" with a hint saying what it covers. The per-tab checkbox in the chart graphics popup stays as a tab-local override — ChartGraphicsCfg is per tab, so it has a job of its own — and its label and hint now say so and point at the Lines section.

Notable decisions

  • use_line_color defaults to ON. That is how the server trace was always drawn and it is the trace nearly every user sees, so the default keeps the chart looking as before. The cost: an orders.toml from before this field carries a path.color whether or not the user ever touched it (load writes the full default file), so a user who did recolour the local staircase — visible only with a core that sends no trace — unticks one box to get it back.
  • **The path's opacity is trace_alpha × the order's own alpha** (active / pending / closed). The history is never brighter than its line; the local staircase already faded with a closed order, the server trace did not. A live filled order at the default active_alpha = 1 is unchanged; a pending order's trace now sits at its pending alpha (0.65) and a closed order's at closed_alpha (0.35) instead of full strength. The SetStopPrice segment shares that opacity, as documented, and is still drawn regardless of the toggle — the behaviour the issue asks to preserve.
  • trace_alpha stays a top-level OrdersStyle field rather than moving into PathStyle, so existing files need no migration; PathStyle is #[serde(default)], so a pre-Трассу переносов ордера нельзя настроить: раздел «Линии → Путь» на неё не действует #508 file loads with its path values intact (tested).
  • Highlighted trace thickness is path.thickness × 1.7 (the multiplier every line uses) instead of a hard-coded 2 px.

Known limitations

  • The picker is disabled while "line's own colour" is on rather than hidden — deliberate, so the row keeps its shape and says why the knob does nothing.
  • Not verified visually by me; geometry is covered by unit tests. Manual check: open a chart with an order the core has moved, untick "show path" in Settings → Lines → Repricing trail — the steps must vanish; change colour / thickness — they must apply.
  • FireTest not run (standing rule for this repo).

Issues

Closes #508

17 open issues checked; #538 (Lines tab should say it edits the active theme's set) touches the same tab but a different symptom and is not addressed here.

How to verify

cargo fmt --all -- --check                                                                   # exit 0
cargo build -p moon-ui-gpui --bin moonterminal --target x86_64-pc-windows-msvc --all-targets  # Finished
cargo clippy -p moon-chart -p moon-ui-gpui --target x86_64-pc-windows-msvc --all-targets      # no new finding in touched files
cargo test --workspace --target x86_64-pc-windows-msvc                                       # 0 failed
  • clippy: -D warnings exits 101 on origin/main too (pre-existing moon-core debt); the only two findings inside the touched files (order_geometry.rs knots loop for i in 1..n, lines.rs line_section argument count) are the same code on origin/main, shifted by insertions above.
  • tests: moon-chart 134, moon-core 1944 (+ integration targets), moon-ui-gpui 1799 + theme_contract 330 — all green. New: 5 in order_geometry/tests.rs (show gates the server trace and knots but not the stop segment; colour/thickness/dash reach both; line colour on both; a closed order's staircase fades with the order) and 2 in config/orders/tests.rs (pre-Трассу переносов ордера нельзя настроить: раздел «Линии → Путь» на неё не действует #508 file loads; defaults).

The order's repricing history is drawn two mutually exclusive ways: the
trace the core sends with the order and the staircase the terminal
reconstructs when it sends none. Settings > Lines > Path styled only the
staircase, so on nearly every chart the section changed nothing.

One PathStyle now drives both: show, colour or the line's own colour
(new `use_line_color`, on by default so the server trace keeps its look),
thickness and dash. The path's opacity (`trace_alpha`, now exposed as a
slider) is scaled by the order's own alpha so the history is never
brighter than its line; the SetStopPrice segment shares that opacity and
is still drawn whatever the toggle says. The staircase's knots hide with
it. The per-tab "hide" checkbox stays as a tab-local override and points
at the Lines section. A pre-existing orders.toml without the new field
still loads with its path values intact.
@guyverino
guyverino merged commit f11e2d4 into main Sep 13, 2026
6 checks passed
@guyverino
guyverino deleted the fix/order-trail-path-style branch September 13, 2026 05:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant