Im Charts - Institutional Financial Charting Engine for Flutter

Im Charts (im_charts)

Pub Version Pub Points Flutter Dart Platforms License: MIT CI

Live Web Demo

๐ŸŒ Live Interactive Web Showcase: https://lykanimran.github.io/im_charts/

Explore all 8 interactive modes directly in your browser without installing anything (Full Institutional Terminal, Direct Chart Trading with Brackets & Positions, Drawing Engine with 8-Handle Shape Resizing, Clean Headless Canvas, Dual Multi-Chart Grid, Theme Lab, and Embedded Portfolio Card).

Im Charts is an institutional-grade financial charting engine and professional trading terminal for Flutter, engineered from the ground up for high-frequency responsiveness on Impeller and Skia.

Designed to be 100% plug-and-play out-of-the-box, while remaining deeply customizable for brokers, fintech platforms, crypto exchanges, and algorithmic trading interfaces.


๐Ÿ“š Master Documentation Index

Comprehensive guides and architectural deep-dives are located in the doc/ directory:

Guide Description
๐Ÿš€ Getting Started Installation, 3-minute plug & play, and integration patterns for Im Charts.
๐Ÿ›๏ธ Architecture & Internals Skia/Impeller rendering pipeline, coordinate projections, and gesture routing.
๐Ÿ”Œ Data Sources & Real-Time Feeds Connecting WebSockets, REST APIs, Binance, Zerodha Kite, and live tick aggregation.
๐ŸŽจ Customization & Theming Custom themes (ChartTheme), candle presentation styles, and layout sizing.
๐Ÿ“ˆ Technical Indicators Guide Built-in indicators (EMA, SMA, Supertrend, Bollinger Bands, VWAP, MACD, RSI, Volume Profile VRVP) and writing custom indicators.
๐Ÿ“– API Reference Detailed documentation for all classes, methods, models, and enums.
๐Ÿค Contributing Guide Development environment setup, running test suites, and PR submission guide.

โœจ Key Features

  • โšก Institutional 2-Row Terminal Layout:
    • Row 1 (Primary Toolbar): Symbol Search Dialog (โŒ˜K), Interval Dropdown (1m to 1W), Candle Style Dropdown, Technical Indicators Selector (fx), Bar Replay Simulator (โฎ), High-DPI Camera Snapshot (๐Ÿ“ท), Keyboard Shortcuts Cheatsheet (โŒจ๏ธ), Real-time Refresh, Dark/Light Theme Toggle, and Chart Settings Modal.
    • Row 2 (Floating Telemetry Header): Glassmorphic overlay displaying Live Ticker, Exchange Badge (displays whatever exchange is passed), LTP with real-time dynamic color pulse, and high-density OHLCV telemetry strip.
  • ๐Ÿ•ฏ๏ธ 6 Candlestick Presentation Styles:
    • Standard Candlesticks, Hollow Candles, Heikin Ashi, Line Chart, Area Mountain Chart, and Western OHLC Tick Bars.
  • ๐Ÿ“ˆ Integrated Technical Indicators & Volume Profile:
    • โญ Smart Money Concepts (SMC): Institutional price action engine auto-detecting Fair Value Gaps (FVG) with 50% Consequent Encroachment (CE) dashed midlines and mitigation tracking, Break of Structure (BOS) and Change of Character (CHoCH) fractal swing breaks, and institutional Order Blocks (OB Demand/Supply) directly on the Skia/Impeller canvas.
    • โญ Viral & High-Demand Indicators: Stochastic Oscillator (14, 3, 3), Parabolic SAR (0.02, 0.2), Chandelier Exit (ATR trailing stop), Average True Range (ATR 14), Williams %R, Commodity Channel Index (CCI 20), and Ichimoku Cloud (9, 26, 52).
    • โญ Categorized & Starred Indicator Menu: Indicators organized by โญ VIRAL & POPULAR, TREND & OVERLAYS, MOMENTUM & OSCILLATORS, and CUSTOM FORMULAS with gold star badges and vibrant tags (VIRAL, HOT, PRO, POPULAR).
    • Overlays: Exponential Moving Averages (EMA 20, EMA 50), Simple Moving Average (SMA 20), Supertrend Indicator (ATR-based trend bands with green/red buy/sell directional shifts), Bollinger Bands (20, 2), Volume Weighted Average Price (VWAP with intraday session boundary reset and $\pm 2.0\sigma$ standard deviation volatility envelope bands).
    • Visible Range Volume Profile (VRVP): Real-time volume profile over currently visible bars with Point of Control (POC), 70% Value Area High (VAH) and Value Area Low (VAL) dashed bounds, and color-coded buy/sell horizontal volume bars.
    • Stacked Multi-SubPanes: Simultaneously run multiple oscillators (e.g. RSI 14, MACD 12, 26, 9, Stochastic, ATR, Williams %R) stacked below the chart, each with auto-scaled coordinate spaces, dynamic zero-baseline histograms, and individual close buttons.
    • Volume: Real-time auto-scaled volume histogram.
  • โ†ฉ๏ธ Undo / Redo History Stack (Ctrl+Z / Ctrl+Y / โŒ˜Z / โŒ˜Shift+Z):
    • Full transactional history for drawings (creation, movement, resizing, color/width changes, and deletion).
  • ๐Ÿงฒ Magnet Mode (Snap to OHLC):
    • Snap drawing anchors automatically to the nearest candle's Open, High, Low, or Close price wicks and bodies.
  • ๐Ÿ’พ JSON Serialization & Cloud Sync:
    • Complete toJson() and fromJson() serialization on ChartDrawing, DrawingPoint, ChartAlert, and ChartOrder with controller.exportDrawingsJson() and controller.importDrawingsJson().
  • ๐Ÿ”” Visual Price Alerts (ChartAlert):
    • Direct canvas amber dashed alert lines with draggable price levels.
    • Ticker alert pill on the vertical price scale (๐Ÿ”” โ‚น...).
    • Integration with the hover + button dropdown (๐Ÿ”” Add Alert @ โ‚น...).
    • Customizable trigger conditions (crossing, crossingUp, crossingDown) and reactive callbacks.
  • ๐Ÿ–๏ธ TradingView-Identical Multi-Zone Interactions:
    • Native macOS / Windows Trackpad Pinch Zoom: Focal-anchored horizontal zoom without emulation lag.
    • 2-Finger Trackpad Pan: Smooth horizontal time scrolling.
    • Price Scale Drag: Stretch and compress price vertically with interactive AUTO scale reset badge.
    • Time Scale Drag: Dynamic timeframe scaling via bottom time axis drag.
  • โŒจ๏ธ Keyboard Shortcuts & Hotkeys:
    • Ctrl + Z / โŒ˜ + Z: Undo last drawing action.
    • Ctrl + Y / โŒ˜ + Shift + Z: Redo drawing action.
    • Alt + H: Quick-draw Horizontal Ray / Support & Resistance line at cursor.
    • Alt + T: Quick-draw Trendline.
    • Alt + A: Open instant Alert modal at hovered price.
    • Alt + R: Reset chart zoom and scaling to auto.
    • Delete / Backspace: Remove selected drawing or order.
    • Left / Right Arrow: Pan horizontally across historical time.
    • + / -: Zoom in and zoom out.
    • Escape: Cancel active tool or dismiss overlays.
  • โฎ๏ธ Bar Replay / Backtesting Simulator:
    • Cut historical candles back to any chosen point in time.
    • Step forward bar-by-bar or step backward.
    • Automated continuous playback with speed multipliers (1x, 2x, 3x, 5x).
    • Floating glassmorphic control bar (ReplayControlBar) with instant exit button.
  • ๐Ÿ“ท High-DPI Chart Snapshot & CSV Export (ChartExporter):
    • High-resolution 2.0x retina PNG image rendering via RepaintBoundary.
    • Built-in preview modal dialog with direct download and clipboard copy capabilities.
    • ChartExporter.exportCandlesToCsv(candles) for algorithmic backtesting data export.
  • ๐ŸŽฏ Direct On-Chart Trading, Orders & Open Positions:
    • Hover + Button: Cursor-tracking + button rendered right before the vertical price axis.
    • 1-Click Order Execution: Dropdown menu for Limit Buy, Limit Sell, and Brackets with support for custom consuming UI (orderMenuBuilder).
    • Dotted Skia/Impeller Order Lines: Green for Buy, Red for Sell, with real-time pill badges showing side, quantity, and limit price.
    • Connected TP & SL Brackets: Dedicated Take Profit (Cyan) and Stop Loss (Orange) dashed lines with vertical elbow connector arms.
    • Drag-to-Modify: Drag badges directly on the chart canvas to dynamically update order and bracket prices in real time.
    • Executed Open Positions & Live P&L: Skia/Impeller solid position lines with real-time unrealized P&L and percentage badge ([LONG 100 @ โ‚น24,490.00 | +โ‚น1,250.00 (+1.25%) | โœ– Close]), attached TP/SL bracket arms, and 1-click market close button (โœ– Close).
    • Tabbed Ledger Drawer: Interactive slide-over ledger tracking pending Orders and active Positions with 1-click cancellations and market exits.
    • Lifecycle Callbacks: Comprehensive onOrderPlaced, onOrderModified, onOrderCancelled, onPositionOpened, and onPositionClosed hooks.
  • ๐Ÿ“ TradingView-Standard Drawing Instruments & Floating Action Bar:
    • 10 Analysis Tools: Trendline (with angle/delta badge), Horizontal Line, Horizontal Ray (infinite right breakout level), Vertical Line (time/event marker), Rectangle (Supply & Demand / SMC order block zone box with translucent fill and 8 corner/edge resize handles), Fibonacci Retracement (golden ratio bands), Long Position (interactive target & stop handles), Short Position, Measure Ruler (ฮ”Price, ฮ”%, bar count), and Cursor Pointer.
    • Dual Creation Gestures: Supports both Click-and-Drag (drag & release) and Click-Move-Click (anchor 1 $\rightarrow$ hover $\rightarrow$ anchor 2).
    • Interactive Anchor Handles: Selected drawings display circular grab handles to modify individual coordinates or target/stop boundaries.
    • Drag-to-Move: Click & drag the body of any drawing to translate it smoothly across candles and price levels.
    • Floating Action Bar: Glassmorphic floating menu for selected drawings featuring 1-tap color swatches (Blue, Emerald, Crimson, Amber, Purple, White), stroke thickness (1โ€“4px), lock/unlock, and delete (๐Ÿ—‘๏ธ).
    • Financial Coordinate Anchoring: Stored in (candleIndex, price) to stay mathematically pinned across zoom, pan, and live tick streaming.
  • โฑ๏ธ Live Candle Close Countdown Timer & Watermark:
    • Countdown Timer Badge: Live ticking badge on the vertical price axis showing exact time remaining before the active bar closes (e.g. 04:18).
    • Background Canvas Watermark: Bold institutional typography featuring brand name (IM CHARTS โ€ข NIFTY 50 โ€ข 5m โ€ข NSE) rendered in the background pane at 4.5% opacity.
    • Price Beacon Pulse Dot: Radiant pulsing beacon tracking the active candle close price on canvas.
  • ๐Ÿ“ฑ Mobile-Optimized Touch Ergonomics & Responsive Layout (ChartLayoutMode):
    • Automatic Web vs Mobile Switching: ChartLayoutMode.auto automatically detects available screen/container width (< 600px), dynamically adjusting axes, toolbars, and touch targets. Can be explicitly set to ChartLayoutMode.mobile or ChartLayoutMode.desktop.
    • Physics-Based Kinetic Inertia Scrolling: Horizontal flings glide smoothly across historical candles using Flutter's native FrictionSimulation, decelerating naturally like native iOS/Android lists or TradingView.
    • Floating "Jump to Real-Time" Action Pill: Sleek glassmorphic button with pulsing live indicator dot (โฏ Real-time) automatically appears when scrolled into history (scrollOffset > 50px) and animates smoothly back to real-time on tap with haptic feedback.
    • Dedicated Mobile Long-Press Inspection Mode: Clean 1-finger panning without crosshair interference. Long-pressing activates candle inspection with medium haptic confirmation, snapping across candles with subtle mechanical dial ticks (HapticFeedback.selectionClick()), and rendering an elevated OHLCV card above the user's thumb.
    • Ultra-Smooth, Zero-Cling Finger Dragging: Replaces frame-by-frame price rounding with continuous floating-point drag accumulation. Finger dragging of Buy/Sell orders, TP/SL brackets, and price alerts is 100% linear and fluid at 60/120Hz with tactile selection feedback.
    • Enlarged 44px Touch Targets: Order tags, bracket handles, price alerts, and position close buttons feature an invisible 44px touch hit box with HitTestBehavior.opaque to ensure fingers never accidentally trigger background chart panning.
    • Jump-Free Pinch-to-Zoom: Multi-touch pointer synchronization eliminates the 100โ€“250px focal point jumps when placing down or lifting a second finger. Focal zoom is strictly clamped within canvas boundaries.
    • Draggable Price Alerts (ChartAlert): Interactive alert pill handles directly on the chart canvas allowing traders to drag price alerts up and down with live floating telemetry chip positioned above the thumb.
    • Responsive Drawing Toolbar Auto-Collapse: Automatically collapses on mobile screens (< 600px) to an 18px strip to preserve valuable candle viewing real estate, expanding smoothly on tap.
    • Responsive Floating Notifications (ChartToast): Adapts to the viewportโ€”docking to the top-right with a fixed 350px width on Desktop/Web, and center-top with full device width on Mobile.
    • Custom Context Menu: TradingView-style right-click context menu (with live indicator counts, canvas drawing counts, reset view, and order shortcuts) suppressing browser defaults on Web.
  • ๐Ÿš€ Skia & Impeller Direct Canvas Rendering:
    • Zero widget overhead: Entire chart renders via a single, isolated CustomPainter with boundary clipping.

โšก 3-Minute Plug & Play Quickstart

1. Add Dependency

Add to your Flutter project via terminal:

flutter pub add im_charts

Or add directly to pubspec.yaml:

dependencies:
  im_charts: ^0.1.0

2. Run the Turnkey Trading Terminal

Drop TradingScreen (or ImTradingScreen) anywhere in your widget tree:

import 'package:flutter/material.dart';
import 'package:im_charts/im_charts.dart';

void main() => runApp(const MaterialApp(home: TradingTerminalPage()));

class TradingTerminalPage extends StatelessWidget {
  const TradingTerminalPage({super.key});

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: TradingScreen(
        initialSymbol: 'NIFTY 50',
        initialExchange: 'NSE',
        initialTimeframe: Timeframe.fiveMinutes,
        initialCandleStyle: CandleStyle.candles,
      ),
    );
  }
}

3. Ultra-Easy Zero-Boilerplate Chart (ImChart.simple)

If you already have a list of candles or JSON data from your backend/broker API, render an institutional interactive chart in just 3 lines of code:

import 'package:flutter/material.dart';
import 'package:im_charts/im_charts.dart';

class QuickChartCard extends StatelessWidget {
  final List<Candle> myCandles;
  const QuickChartCard({super.key, required this.myCandles});

  @override
  Widget build(BuildContext context) {
    return ImChart.simple(
      candles: myCandles,
      indicators: [
        EMAIndicator(period: 20, color: const Color(0xFF2962FF)),
      ],
      onOrderModified: (order) {
        // Called whenever an order line or TP/SL bracket is dragged on canvas!
        print('Updated order ${order.id} to โ‚น${order.price}');
      },
    );
  }
}

Or stream live WebSocket ticks with zero controller boilerplate:

ImChart.live(
  candles: initialCandles,
  liveTickStream: myWebSocketStream, // Stream<Tick>
  symbol: 'BTC/USDT',
);

๐ŸŽฎ Interactive Gestures Cheat Sheet

Interaction macOS / Windows Trackpad Mouse Mobile Touch
Horizontal Zoom 2-finger pinch in / out Mouse wheel scroll over canvas 2-finger pinch in / out
Pan in Time 2-finger horizontal swipe Left click + drag on canvas 1-finger swipe on canvas
Vertical Price Scale Drag vertically on right price axis Drag vertically on right price axis Drag vertically on price axis
Time Scale Zoom Drag on bottom time axis Drag on bottom time axis Drag on bottom time axis
Reset Auto-Scale Double-tap price axis or tap AUTO pill Double-tap price axis or tap AUTO pill Tap AUTO badge
Crosshair Inspection Hover cursor over canvas Hover cursor over canvas Long-press and drag

๐Ÿงฉ Modular & Headless Usage (Clean Chart Without Top Header)

im_charts can be used either as a turnkey terminal or in a clean / headless configuration without the top header or toolbar:

// Option A: Turnkey terminal with custom header/toolbar toggles
TradingScreen(
  initialSymbol: 'NIFTY 50',
  showToolbar: false, // Omit top toolbar
  showHeader: false,  // Omit top telemetry header (pure clean canvas)
)
// Option B: Direct standalone canvas embedding in cards or dialogs
import 'package:flutter/material.dart';
import 'package:im_charts/im_charts.dart';

class CustomDashboardCard extends StatefulWidget {
  const CustomDashboardCard({super.key});

  @override
  State<CustomDashboardCard> createState() => _CustomDashboardCardState();
}

class _CustomDashboardCardState extends State<CustomDashboardCard> {
  late final MockTradingDataSource _dataSource;
  late final TradingChartController _controller;

  @override
  void initState() {
    super.initState();
    _dataSource = MockTradingDataSource(initialPrice: 24500.0);
    _controller = TradingChartController(
      symbol: 'RELIANCE',
      dataSource: _dataSource,
      theme: ChartTheme.dark(),
    );
    _controller.initialize();
  }

  @override
  void dispose() {
    _controller.dispose();
    _dataSource.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Card(
      child: SizedBox(
        height: 380,
        child: TradingChart(controller: _controller),
      ),
    );
  }
}

๐ŸŽจ Instant Customization

Override colors, typography, or styling with ChartTheme.copyWith(...):

final customTheme = ChartTheme.dark().copyWith(
  backgroundColor: const Color(0xFF0F141C),
  bullishColor: const Color(0xFF00E676),
  bearishColor: const Color(0xFFFF1744),
  gridColor: const Color(0xFF1B222D),
  currentPriceLineColor: const Color(0xFF2962FF),
);

// Apply directly
controller.setTheme(customTheme);

๐Ÿงช Interactive Showcase Hub & Runnable Example

๐ŸŒ Live Web Demo: https://lykanimran.github.io/im_charts/

A complete multi-mode showcase application is provided in the example/ directory:

# Run the example showcase locally on macOS, Web, iOS, or Android
cd example
flutter run

Showcase Modes Included in example/:

  1. ๐Ÿ’ก Dashboard Hub: Interactive catalog overview explaining every possibility with quick-launch triggers.
  2. ๐Ÿš€ Full Institutional Terminal: Turnkey TradingView-grade setup with 2-row toolbars, technical indicators, and symbol search.
  3. ๐ŸŽฏ Clean / Headless Chart: Clean chart version with no top header or toolbar, maximizing canvas space.
  4. ๐Ÿ“Š Dual Multi-Chart Grid: Synchronized side-by-side live charting engines (NIFTY 50 5m vs BANKNIFTY 15m).
  5. ๐ŸŽจ Custom Themes & Styles Lab: Live dynamic switching between Cyberpunk, Bloomberg Amber, Dark, and Light themes + 6 candle styles.
  6. ๐Ÿ“ฑ Embedded Analytics Card: Wealth-tech KPI card embedding a 320px area chart with quick timeframe filters.
  7. ๐Ÿ“ˆ Direct Chart Trading & Brackets: Limit, Stop & Bracket orders with direct canvas drag-to-modify, SL/TP levels, and position overlay.
  8. โœ๏ธ Drawing Engine & 8-Handle Shape Resizing: TradingView-standard drawing instruments (Trendlines, Horizontal lines with direct vertical drag, 8-handle Rectangle supply/demand boxes, Fibonacci, Long/Short position boxes, and Measure ruler).

๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.

Libraries

core/coordinates/coordinate_converter
core/coordinates/viewport
core/models/candle
core/models/candle_style
core/models/chart_alert
core/models/chart_drawing
core/models/chart_layout_mode
core/models/chart_order
core/models/chart_position
core/models/chart_save_state
core/models/chart_theme
core/models/price_range
core/models/tick
core/models/timeframe
core/utils/chart_exporter
datasource/chart_data_source
datasource/mock_data_source
datasource/static_data_source
engine/candle_builder
engine/chart_controller
engine/chart_sync_group
engine/formula/formula_ast
engine/formula/formula_evaluator
engine/formula/formula_indicator
engine/formula/formula_lexer
engine/formula/formula_parser
engine/indicators/adx
engine/indicators/atr
engine/indicators/bollinger_bands
engine/indicators/cci
engine/indicators/chandelier_exit
engine/indicators/ema
engine/indicators/hma
engine/indicators/ichimoku
engine/indicators/indicator
engine/indicators/indicator_result
engine/indicators/macd
engine/indicators/obv
engine/indicators/parabolic_sar
engine/indicators/pivot_points
engine/indicators/rsi
engine/indicators/sma
engine/indicators/smart_money_concepts
engine/indicators/stochastic
engine/indicators/supertrend
engine/indicators/volume_profile
engine/indicators/vwap
engine/indicators/williams_r
engine/indicators/wma
im_charts
Im Charts โ€” A high-performance financial charting engine and professional trading terminal for Flutter.
main
renderer/chart_painter
renderer/pane
renderer/renderers/alert_renderer
renderer/renderers/axis_renderer
renderer/renderers/base_renderer
renderer/renderers/candle_renderer
renderer/renderers/crosshair_renderer
renderer/renderers/current_price_renderer
renderer/renderers/drawing_renderer
renderer/renderers/grid_renderer
renderer/renderers/indicator_renderer
renderer/renderers/order_renderer
renderer/renderers/smc_renderer
renderer/renderers/volume_profile_renderer
renderer/renderers/volume_renderer
ui/chart_drawing_toolbar
ui/chart_header
ui/chart_save_status_badge
ui/chart_settings_modal
ui/chart_toast
ui/chart_toolbar
ui/chart_widget
ui/drawing_action_toolbar
ui/formula_editor_modal
ui/multi_chart_container
ui/replay_control_bar
ui/simple_chart_widget
ui/symbol_search_modal
ui/trading_screen
ui/web_zoom_interop
ui/web_zoom_interop_stub
ui/web_zoom_interop_web