Skip to main content

Module chart

Module chart 

Source
Expand description

Rendering and geometry helpers for chart composition.

Use coords for coordinate conversions, series for hit testing and series settings, overlays for order flow visualizations and primitives for custom rendering. For a chart that manages data, layout and interaction, use Chart.

Internal painting lives in one rendering tree, grouped into axes, chart types, overlays and supporting chart elements. Interaction state belongs to the widget.

Modules§

coords
Coordinate mapping between bar indices, prices and screen positions.
overlays
Order flow visualizations for the price pane.
primitives
Custom drawing attached to a series: primitives, and the renderers of custom series.
series
Series hit testing, selection state, selection dot rendering and per-series display settings.

Structs§

RenderContext
Core rendering context containing painter and drawing area
TradingLineOptions
What render_trading_lines draws and offers.
TradingLines
What render_trading_lines drew, and what the user asked for.

Enums§

PnlUnit
What a profit or loss on the trading lines is written in.
TradingLabelAlignment
Horizontal placement of trading line labels inside the price pane.
TradingLineAction
What the user asked for on a trading line. Confirm it with the user, then send it to the broker.

Functions§

alert_shortcut_price
Resolve Alt+A at a hovered chart price without handling keys owned by a field or popup. The host decides whether to open a dialog or save a default alert at the returned price.
axis_settings_button
A 24-point scale-settings target in the price/time-axis corner. The caller opens its existing scale menu when the returned response is clicked, before handling scale drags.
crosshair_price_action
Paints a 26 by 20 point circled-plus button joined to the left of tag. A click returns price for the host’s alert, order or price-line menu. The tag itself remains available for price-axis drags. Uses the theme’s tag fill and foreground ink; call before handling price-axis drags.
price_axis_width
Width of the current price labels and tags, including their plot gap and right clearance. Include formatted session and volume labels in tag_labels when allocating their column, and the host formatter the labels are written with.
render_alert_levels
Draw price thresholds and return a replacement alert after a drag. Supply only alerts for this pane, resolving symbol or watchlist membership in the host. With active_only unset, triggered, disabled and expired alerts are drawn dimmed. Call after drawing the chart, then submit the result through the host’s alerts service. Non-price sources require the host to resolve their own pane and coordinates. format supplies the instrument’s precision and currency for labels.
render_axis_currency
Paints a currency button at the top of an axis column and returns its response and the host currency choice, if any. The host supplies available conversions and replaces the prices and instrument metadata after a choice; the renderer never converts prices. unit appends the host’s price unit without converting prices. An empty currency shows only the unit and offers no conversion menu. Pass the response rectangle to price tick occlusion.
render_crosshair_full
Renders crosshair with full customization: style, mode, color, line width, line style
render_event_band
Draws host-supplied event badges just above baseline, using the chart’s time mapping. An event between bars uses the first bar at or after its time; whitespace extrapolates the most common positive spacing among the outermost 16 bars. Colliding badges stack upward. Returns the clicked event ID; callers handle that action before starting a chart drag. The badges use the event’s colour, text and tooltip, without assigning any market meaning to them.
render_quote_tags
Paints independent current close, session and volume readouts, returning their rectangles in that order. Pass all three rectangles to tick occlusion and pointer routing.
render_trading_lines
Draws the working orders with their brackets and the open positions of one symbol on the chart, and returns what the user asked for. Pass only the orders and positions of the chart’s symbol, and call it after drawing the chart. The price axis is left to the caller; see TradingLines::tags.