AI Integration Context
Use this file as context for coding assistants integrating @hyperprop/charting-library.
What this library is#
- Canvas-based chart rendering and interaction engine.
- Framework-agnostic (no React/Vue dependency).
- Strong support for price lines, order lines, and trading-style widgets.
What this library is not#
- Not an order execution engine.
- Not a broker/exchange API.
- No persistence/state backend.
All business rules (order lifecycle, fills, validation, permissions) must be handled in app code.
Integration model#
- App owns source-of-truth state.
- App translates state ->
setData,setPriceLines,setOrderLines. - App listens to
onOrderAction/onChartClick. - App mutates state.
- App re-renders lines/data into chart.
This pattern is required for reliable drag/update behavior during live ticks.
Canonical event handling#
move-> update stored price immediately.- custom action (for example
execute) -> run domain logic in app. dragging: true-> interim updates during drag.dragging: false-> drag completed.
Common mistakes to avoid#
- Treating chart line visuals as source-of-truth.
- Putting broker logic inside chart callbacks directly.
- Ignoring interim drag events while streaming data.
- Assuming
actionis closed enum. It is open (string) by design.
Useful option groups#
- Display:
backgroundColor,axis,grid,watermark,crosshair,tickerLine - Candles:
candleBodyWidthRatio,candleMinWidth,candleWickWidth - Stability:
autoScaleSmoothing,autoScaleIgnoreLatestCandle - Interaction:
doubleClickEnabled,doubleClickAction - Overlays:
priceLines,orderLines
Suggested docs for AI prompts#
When using this library in another repo, include:
docs/API.mddocs/EVENTS.mddocs/BRACKETS.md(if trading/order workflows)- this file (
AI_CONTEXT.md)
That gives enough context for most integration tasks without reading source.
