fix(chart): one path style for the server trace and the local staircase - #540
Merged
Conversation
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.
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.
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_trace→server_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
PathStyledrives both representations:use_line_color, the colour of the line the path belongs to (the server trace's historical look).trace_alphawas only inorders.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 —
ChartGraphicsCfgis 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_colordefaults 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: anorders.tomlfrom before this field carries apath.colorwhether or not the user ever touched it (loadwrites 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.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 defaultactive_alpha = 1is unchanged; a pending order's trace now sits at its pending alpha (0.65) and a closed order's atclosed_alpha(0.35) instead of full strength. TheSetStopPricesegment shares that opacity, as documented, and is still drawn regardless of the toggle — the behaviour the issue asks to preserve.trace_alphastays a top-levelOrdersStylefield rather than moving intoPathStyle, so existing files need no migration;PathStyleis#[serde(default)], so a pre-Трассу переносов ордера нельзя настроить: раздел «Линии → Путь» на неё не действует #508 file loads with its path values intact (tested).path.thickness × 1.7(the multiplier every line uses) instead of a hard-coded 2 px.Known limitations
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
-D warningsexits 101 onorigin/maintoo (pre-existing moon-core debt); the only two findings inside the touched files (order_geometry.rsknots loopfor i in 1..n,lines.rsline_sectionargument count) are the same code onorigin/main, shifted by insertions above.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 inconfig/orders/tests.rs(pre-Трассу переносов ордера нельзя настроить: раздел «Линии → Путь» на неё не действует #508 file loads; defaults).