Expand description
§egui-charts
High-performance financial charting engine for egui. Render interactive, TradingView-quality charts — candlesticks, OHLC bars, line, area, Renko, Kagi, Point & Figure, Market Profile (TPO) — with 95 drawing tools, 130+ technical indicators, and a full design-token theme system. Built to be embedded in Tauri desktop apps or any egui host.
§Quick start
use egui_charts::{ChartBuilder, Chart};
use egui_charts::model::{Bar, BarData, Timeframe};
use egui_charts::theme::Theme;
// Build a chart with the fluent API
let mut trading_chart = ChartBuilder::new()
.with_symbol("BTCUSDT")
.with_timeframe(Timeframe::H1)
.with_theme(Theme::dark())
.with_drawing_tools()
.build();
// In your egui update loop:
// trading_chart.update(); // poll data source, progressive loading
// trading_chart.show(&mut ui); // render into an egui::UiFor a minimal price ticker (no grid, no crosshair, no tools):
let mini = ChartBuilder::price_chart()
.with_symbol("ETHUSDT")
.with_visible_candles(30)
.build();§Architecture
The crate is organized into a layered set of modules:
| Layer | Modules | Purpose |
|---|---|---|
| Domain model | model | Bar, BarData, Symbol, Timeframe, ChartType, Renko/Kagi/P&F transforms |
| Data | data | DataSource trait, DataUpdate, historical/live data abstractions |
| Chart engine | chart | Pan/zoom, hit-testing, coordinate mapping, series rendering, interaction |
| Drawing tools | drawings | 95 tools (trend lines, Fibonacci, patterns, etc.), undo/redo, snapping |
| Indicators | studies | 130+ built-in indicators, Indicator trait, IndicatorRegistry |
| Scales | scales | Price scales (normal, log, percentage), time scales, tick generators, formatters |
| Configuration | config | ChartConfig, ChartOptions, crosshair, tooltip, keyboard, kinetic scroll |
| Validation | validation | OHLC integrity checks, timestamp ordering, data quality |
| Theme system | theme, tokens, styles, theming | Design tokens (RON), semantic colors, presets (Classic, Dark, Light, Midnight, High Contrast) |
| Widget | widget | Chart egui widget, ChartBuilder, TradingChart |
| Extensions | ext | UiExt, ContextExt, ResponseExt, HasDesignTokens |
| Icons | icons | 280+ compile-time embedded SVG icons |
| App UI | ui, ui_kit, templates | (feature ui) Toolbars, panels, dialogs, reusable form/button primitives |
| Backtest | backtest | (feature backtest) Strategy backtesting on historical data |
| Scripting | scripting | (feature scripting) User-defined indicators and strategies |
§Feature flags
The default build includes the core engine, theme system, chart widget, and compile-time icons. Application-level UI is opt-in.
| Feature | Default | Description |
|---|---|---|
icons | on | 280+ compile-time embedded SVG icons. Required by ui. |
ui | off | Application-level UI: toolbars, panels, sidebars, dialogs, and the reusable ui_kit widget library they are built on. Enable this when you are building a full trading-terminal interface around the chart engine. |
backtest | off | Backtesting framework for strategy evaluation on historical data. |
scripting | off | Embedded scripting support for user-defined indicators and strategies. |
§Integrating with Tauri
egui-charts is designed to be used as the rendering engine inside a Tauri
desktop application. A typical setup:
-
Add the crate to your Tauri frontend’s dependencies:
[dependencies] egui-charts = { version = "0.1", features = ["ui"] } -
Implement
data::DataSourceto bridge your Tauri backend (IPC / WebSocket) to the chart’s data layer. -
Create a
chart::builder::ChartBuilderin youreframe::App::updateand calltrading_chart.show(ui)inside anegui::CentralPanel. -
Apply a theme at startup with
theme::apply_to_eguito propagate design tokens into egui’s visual system.
§Crate-level re-exports
The most commonly used types are re-exported at the crate root for convenience:
ChartBuilder/TradingChart— fluent chart constructionChart— the low-level egui widgetDataSource— data provider traitChartType— candlestick, line, area, bar, etc.
Re-exports§
pub use chart::builder::ChartBuilder;pub use chart::builder::TradingChart;pub use data::DataSource;pub use model::ChartType;pub use widget::Chart;
Modules§
- chart
- Core chart engine for high-performance financial charting.
- config
- Complete chart configuration options.
- data
- Data source abstraction for flexible data fetching.
- drawings
- Chart drawing tools – the annotation layer for financial charts.
- ext
- Extension traits for egui types – the ergonomic API layer.
- icons
- Icons Module - Compile-time embedded icons following rerun patterns
- model
- Core data models for financial charting
- scales
- Price and time scale engines for charting.
- studies
- Technical analysis indicators (studies) module.
- styles
- UI Styles - Sizing Constants and Layout Helpers
- theme
- Unified Theme System for egui-charts
- theming
- Unified theme-aware color helpers for egui-charts.
- tokens
- Design Token System – RON-based, compile-time loaded design primitives.
- validation
- Data validation and mismatch detection for bar sequences.
- widget
- The primary Chart widget for embedding interactive financial charts in egui.
Macros§
- icon_
from_ path - Macro to embed an SVG icon at compile time.