Skip to main content

Module drawings

Module drawings 

Source
Expand description

Drawing tools and annotations anchored to chart coordinates.

Use DrawingManager to select tools and manage drawings, undo and redo. With a Chart, prefer its drawing APIs for validated timestamp anchors and save/load operations; persistence exposes the JSON format for host storage.

§Interactive drawing

Select a tool through the chart’s drawing manager; the chart collects its points from pointer input and handles selection and editing:

use egui_charts::{Chart, drawings::DrawingToolType, model::BarData};

let mut chart = Chart::new(BarData::default());
chart.drawings_mut().set_active_tool(Some(DrawingToolType::TrendLine));

DrawingToolRegistry configures built-in tool availability and lets hosts register custom renderers. Inspect availability before exposing a tool in a host picker. For lower-level composition, domain contains drawing records, services provides selection, history, snapping and handle operations, and rendering paints drawings against a chart view.

Re-exports§

pub use domain::ArrowStyle;
pub use domain::BarsPatternConfig;
pub use domain::BarsPatternMode;
pub use domain::ChartPoint;
pub use domain::Drawing;
pub use domain::DrawingInteractionMode;
pub use domain::DrawingOptions;
pub use domain::DrawingTemplate;
pub use domain::DrawingToolType;
pub use domain::ElliottDegree;
pub use domain::FibonacciConfig;
pub use domain::FibonacciLevel;
pub use domain::FontWeight;
pub use domain::GannConfig;
pub use domain::GannFanDirection;
pub use domain::GannLevel;
pub use domain::GhostCandle;
pub use domain::GhostFeedConfig;
pub use domain::HandlePos;
pub use domain::ImageConfig;
pub use domain::ParseToolTypeError;
pub use domain::PitchforkConfig;
pub use domain::PitchforkLevel;
pub use domain::PositionSize;
pub use domain::PositionSizing;
pub use domain::RegressionTrendConfig;
pub use domain::TimeframeVisibility;
pub use domain::VwapBand;
pub use domain::VwapConfig;
pub use manager::DrawingManager;
pub use manager::DrawingManagerOptions;
pub use manager::DrawingState;
pub use registry::DrawingRenderer;
pub use registry::DrawingToolRegistry;
pub use registry::RegisteredDrawingTool;
pub use registry::ToolAvailability;

Modules§

categories
Toolbar groupings for drawing tools.
domain
Drawing records, chart coordinates and tool-specific settings.
manager
Drawing state, selection, editing and undo history.
persistence
Drawing persistence – JSON serialization and storage.
registry
Host-defined tools and availability of built-in tools.
rendering
Painting drawings against bars and a coordinate mapping.
repositories
Drawing tool category lookup and search.
services
Selection, undo history, snapping, handles and draw ordering for drawings.