zengeld-canvas
High-performance SVG chart rendering engine for financial data visualization
A platform-agnostic rendering library for financial charts. Built in Rust with zero runtime dependencies, designed to work seamlessly across native platforms, WebAssembly, and Python bindings.
Features
-
80+ Drawing Primitives - Comprehensive set of technical analysis tools:
- Trend lines, rays, extended lines, arrows
- Fibonacci retracements, extensions, fans, arcs, spirals, time zones
- Gann tools (fan, box, square, fixed square)
- Pitchforks (standard, Schiff, modified Schiff, inside)
- Patterns (XABCD, Cypher, Head & Shoulders, ABCD, Three Drives, Elliott waves)
- Channels (parallel, regression, disjoint angle)
- Shapes (rectangles, ellipses, triangles, arcs, polylines, paths)
- Annotations (text, notes, callouts, price labels, flags, tables)
- Trading tools (long/short positions, price ranges, date ranges)
-
12 Series Types - Complete data visualization:
- Candlestick, OHLC bars
- Line, Step line, Area, Baseline
- Histogram, Columns
- High-Low, Range area
- Markers, Circles
-
Platform Agnostic -
RenderContexttrait abstraction for any rendering backend -
Coordinate Systems - Built-in viewport, price scale, and time scale management
-
Layout System - Multi-pane charts, sub-panes, multichart grids (10+ presets)
-
Zero Dependencies - Only serde/serde_json for serialization
-
High Performance - Optimized for real-time chart rendering
Installation
Add to your Cargo.toml:
[]
= "0.1"
Quick Start
use ;
// Implement RenderContext for your platform (Canvas2D, SVG, WebGL, etc.)
// Create chart components
let viewport = new;
let theme = dark;
Architecture
zengeld-canvas/
├── core/ # Foundational types (Bar, Theme, ChartConfig)
├── coords/ # Coordinate systems (Viewport, PriceScale, TimeScale)
├── model/ # Data models (series, overlays, annotations)
├── primitives/ # 80+ interactive drawing tools
├── layout/ # Pane system, multichart grids
├── render/ # Rendering engine, batch operations
└── api/ # High-level chart API
Module Overview
| Module | Description |
|---|---|
core |
Bar data, Theme, configuration types, color parsing, math utilities |
coords |
Viewport management, price/time scale calculations, tick formatting |
model |
Series options, overlay configs, marker/annotation data |
primitives |
Drawing tools with PrimitiveTrait, registry pattern, control points |
layout |
PaneManager for multi-pane charts, MultichartLayout for grids |
render |
RenderContext trait, render operations, text rendering |
Drawing Primitives
All primitives implement the PrimitiveTrait:
use ;
// Get all available primitives
let registry = new;
for metadata in registry.all_metadata
// Create a primitive via factory
let trend_line = registry.create;
Primitive Categories
| Category | Examples |
|---|---|
| Lines | Trend Line, Ray, Extended Line, Horizontal/Vertical Lines, Cross Line |
| Fibonacci | Retracement, Extension, Fan, Arcs, Spiral, Time Zones, Wedge, Channel |
| Gann | Fan, Box, Square, Fixed Square |
| Pitchforks | Standard, Schiff, Modified Schiff, Inside Pitchfork |
| Patterns | XABCD, Cypher, Head & Shoulders, ABCD, Triangle, Three Drives |
| Elliott | Impulse Wave, Corrective Wave, Triangle Wave, Combination, Degree |
| Channels | Parallel, Flat Top/Bottom, Disjoint Angle, Regression |
| Shapes | Rectangle, Ellipse, Triangle, Arc, Polyline, Path, Curve, Brush |
| Ranges | Price Range, Date Range, Date/Price Range, Bars Pattern |
| Positions | Long Position, Short Position, Forecast, Projection |
| Annotations | Text, Note, Callout, Price Label, Signpost, Flag, Comment, Table |
| Arrows | Arrow Marker, Arrow Line, Arrow Up/Down |
| Icons | Emoji, Image |
| Signals | Entry/Exit signals, Crossover, Breakdown, Divergence, Pattern Match |
Series Types
use ;
// Candlestick data
let candle = CandlestickData ;
// Line data
let point = LineData ;
Layouts
Multi-Pane Charts
use ;
let mut manager = new;
manager.add_pane; // Add volume pane at 20% height
manager.add_pane; // Add RSI pane at 15% height
Multichart Grids
use MultichartLayout;
// Built-in presets
let quad = quad; // 2x2 grid
let six = six_pack; // 2x3 grid
let custom = grid; // 3x4 grid
Platform Targets
| Platform | Method | Status |
|---|---|---|
| Rust (native) | Direct dependency | Available |
| WebAssembly | wasm-bindgen | Planned |
| Python | PyO3 bindings | Planned |
| Node.js | WASM + npm | Planned |
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT License (LICENSE-MIT)
at your option.
Author
zengeld
Built with Rust for speed and reliability.