TradingChartController class

Top-level controller managing chart state, gestures, viewport, indicators, and live data stream.

Inheritance

Constructors

TradingChartController({required String symbol, required ChartDataSource dataSource, String exchange = 'NSE', String brandName = 'Im Charts', Timeframe initialTimeframe = Timeframe.fiveMinutes, CandleStyle initialCandleStyle = CandleStyle.candles, ChartTheme? theme})

Properties

activeDrawingTool ↔ DrawingTool
getter/setter pair
activeIndicators → List<Indicator>
no setter
alerts → List<ChartAlert>
no setter
allCandlesCount → int
no setter
brandName ↔ String
Brand name displayed in watermarks and institutional overlays (defaults to 'Im Charts').
getter/setter pair
candleCountdownText → String
Formatted countdown to current candle close (e.g. '04:12' or '00:23').
no setter
candles → List<Candle>
no setter
candleStyle → CandleStyle
no setter
crosshairPosition → Offset?
no setter
currentCandle → Candle?
no setter
currentPriceRange → PriceRange
Visible auto-scaled price range with vertical scale & pan applied.
no setter
dataSource → ChartDataSource
final
drawings → List<ChartDrawing>
no setter
exchange → String
no setter
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
hoveredCandle → Candle?
no setter
isDarkTheme → bool
no setter
isLoading → bool
no setter
isManualPriceScale → bool
no setter
isReplaying → bool
no setter
isReplayMode → bool
no setter
mainPaneHeight → double
Height of the main chart canvas pane (excluding sub-pane and bottom time axis).
no setter
onAlertTriggered ↔ void Function(ChartAlert alert)?
getter/setter pair
onDrawingAdded ↔ void Function(ChartDrawing drawing)?
getter/setter pair
onDrawingRemoved ↔ void Function(String drawingId)?
getter/setter pair
onOrderCancelled ↔ void Function(String drawingId)?
getter/setter pair
onOrderModified ↔ void Function(ChartOrder order)?
getter/setter pair
onOrderPlaced ↔ void Function(ChartOrder order)?
getter/setter pair
onPositionClosed ↔ void Function(ChartPosition position)?
getter/setter pair
onPositionOpened ↔ void Function(ChartPosition position)?
getter/setter pair
orders → List<ChartOrder>
no setter
overlayResults → List<IndicatorResult>
no setter
positions → List<ChartPosition>
no setter
previewDrawing → ChartDrawing?
no setter
replayIndex → int?
no setter
replaySpeed → double
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedDrawing → ChartDrawing?
no setter
showCountdownTimer ↔ bool
getter/setter pair
showCrosshair → bool
no setter
showGrid → bool
no setter
showVolume → bool
no setter
showVolumeProfile ↔ bool
getter/setter pair
showWatermark ↔ bool
getter/setter pair
subPaneResult → IndicatorResult?
no setter
subPaneResults → List<IndicatorResult>
no setter
symbol → String
no setter
theme ↔ ChartTheme
getter/setter pair
timeframe → Timeframe
no setter
verticalPan → double
no setter
verticalScale → double
no setter
viewport → ChartViewport
no setter
volumeProfile → VolumeProfile?
no setter

Methods

addAlert(ChartAlert alert) → void
addDrawing(ChartDrawing drawing) → void
Adds a new user drawing to the chart canvas.
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
cancelActiveDrawing() → void
Cancels in-progress drawing, resets tool to pointer, and clears preview.
cancelOrder(String orderId) → void
Cancels an order and removes it from the chart canvas.
clearAlerts() → void
clearDrawings() → void
Clears all drawings from the chart canvas.
clearOrders() → void
Clears all active orders from the chart.
clearPositions() → void
Clears all open positions from the chart.
closePosition(String positionId) → void
Closes an open position and removes it from the chart canvas.
deleteSelectedDrawing() → void
Deletes the currently selected drawing.
dispose() → void
Discards any resources used by the object.
override
exitReplay() → void
initialize() → Future<void>
Loads initial historical data and establishes real-time tick ingestion.
isIndicatorActive(String id) → bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
onPan(double deltaX) → void
Horizontal scroll / pan gesture handler.
onTimeScale(double deltaX) → void
Horizontal scale drag on time scale (X-axis zoom).
onVerticalPan(double deltaY, double paneHeight) → void
Vertical pan when manual price scaling is active.
onVerticalScale(double deltaY) → void
Vertical scale drag on price scale (Y-axis zoom).
onZoom(double scaleFactor, Offset focalPoint) → void
Focal-point aware horizontal zoom (pinch zoom or mouse wheel).
openPosition(ChartPosition position) → void
Opens an executed position on the chart.
pauseReplay() → void
placeOrder(ChartOrder order) → void
Places an active order on the chart canvas.
playReplay() → void
priceAtY(double y) → double
Converts screen Y coordinate inside main pane to financial price.
refreshData() → Future<void>
Manually refreshes historical data and restarts stream.
removeAlert(String id) → void
removeDrawing(String id) → void
Removes a drawing from the chart canvas.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeSubPane(String indicatorId) → void
resetPriceScale() → void
Resets vertical price scale back to auto-scale.
resetTimeScale() → void
Resets horizontal time scale back to default.
resetView() → void
Resets both time and price scale to default view.
scrollToLatest() → void
Jumps to the latest forming candle.
selectDrawing(String? id) → void
Selects a drawing by ID or deselects all if null.
setCandleStyle(CandleStyle style) → void
Changes the candle presentation style (Candles, Hollow, Heikin Ashi, Line, Area, Bars).
setCrosshairPosition(Offset? position) → void
Updates crosshair position and extracts hovered candle under pointer.
setExchange(String newExchange) → void
Switches exchange (NSE vs BSE).
setOrders(List<ChartOrder> orders) → void
Replaces active orders on the chart.
setPositions(List<ChartPosition> positions) → void
Replaces open positions on the chart.
setPreviewDrawing(ChartDrawing? preview) → void
Updates the live drawing preview while the user is actively drawing.
setReplaySpeed(double speed) → void
setSelectedDrawingColor(Color color) → void
Updates the color of the currently selected drawing.
setSelectedDrawingStrokeWidth(double strokeWidth) → void
Updates the stroke width of the currently selected drawing.
setSymbol(String newSymbol, {String? exchange}) → Future<void>
Sets a new symbol and reloads chart data.
setTheme(ChartTheme newTheme) → void
Sets an explicit theme.
setTimeframe(Timeframe newTimeframe) → Future<void>
Changes chart timeframe and refreshes historical candles.
startReplay([int? startIndex]) → void
stepReplayBackward() → void
stepReplayForward() → void
toggleCrosshair() → void
Toggles crosshair on/off.
toggleGrid() → void
Toggles grid lines on/off.
toggleIndicator(Indicator indicator) → void
Toggles an indicator on or off.
toggleReplayPlay() → void
toggleSelectedDrawingLocked() → void
Toggles the lock state of the currently selected drawing.
toggleTheme() → void
Toggles dark / light theme.
toggleVolume() → void
Toggles volume histogram on/off.
toggleVolumeProfile() → void
toString() → String
A string representation of this object.
inherited
translateDrawing(String id, int deltaCandles, double deltaPrice) → void
Translates all points and prices of a drawing by a given candle and price delta.
updateAlert(ChartAlert alert) → void
updateDimensions(double width, double height) → void
Updates viewport canvas dimensions (called by LayoutBuilder in UI).
updateDrawing(ChartDrawing drawing) → void
Updates an existing drawing (e.g. dragging an anchor point).
updateDrawingPoint(String id, int pointIndex, DrawingPoint newPoint) → void
Updates a specific anchor point index of a drawing.
updateDrawingProperties(String id, Map<String, dynamic> newProperties) → void
Updates arbitrary metadata properties on a drawing (e.g. targetPrice, stopPrice, widthSpan).
updateOrderBrackets(String orderId, {double? takeProfitPrice, double? stopLossPrice, bool clearTakeProfit = false, bool clearStopLoss = false}) → void
Updates or attaches Take Profit and/or Stop Loss brackets to an order.
updateOrderPrice(String orderId, double newPrice) → void
Updates the limit price of an existing order.
updatePosition(ChartPosition position) → void
Updates an open position (e.g. adjust TP/SL or average price).
yAtPrice(double price) → double
Converts financial price to screen Y coordinate inside main pane.
zoomIn() → void
Zoom in horizontally by 25%.
zoomInPrice() → void
Zoom in price scale vertically.
zoomOut() → void
Zoom out horizontally by 20%.
zoomOutPrice() → void
Zoom out price scale vertically.

Operators

operator ==(Object other) → bool
The equality operator.
inherited