Events
onOrderAction#
Register:
chart.onOrderAction((event) => {
// handle
});Payload type:
type OrderActionEvent = {
orderId?: string;
action: "close" | "cancel" | "move" | "createLimit" | "execute" | string;
price?: number;
dragging?: boolean;
line?: OrderLineOptions;
};Common actions#
execute: action button pressed (for example Buy/Sell)close: close button pressed (usually market-type line)cancel: cancel button pressed (usually pending line)move: draggable line movedcreateLimit: double-click action inplaceLimitOrdermode
Drag semantics#
For draggable actions and lines:
- during drag updates:
dragging: true - on drag end:
dragging: false(final value)
For move:
pricecontains the new line price.
Notes#
actionis intentionally open (string) so app code can define custom actions.lineis the line snapshot associated with the hit region when available.
onChartClick#
Register:
chart.onChartClick((event) => {
// handle
});Payload type:
type ChartClickEvent = {
x: number;
y: number;
price?: number;
region: "plot" | "x-axis" | "y-axis";
};Behavior#
regiontells where the click happened.priceis provided forplotregion clicks.
onCrosshairMove#
Register:
chart.onCrosshairMove((event) => {
// update OHLC header, hover widgets, etc
});Payload type:
type CrosshairMoveEvent = {
x: number;
y: number;
region: "plot" | "x-axis" | "y-axis";
price?: number;
index?: number;
time?: string;
point?: OhlcDataPoint;
};Notes#
- Fires while hovering in chart regions.
- For plot hover,
priceis included. pointis included when hover maps to an existing candle index.- Use this to implement TradingView-style dynamic OHLC readout in your app header.
onCrosshairPriceAction#
Register:
chart.onCrosshairPriceAction((event) => {
// frontend action (open order ticket, quick action, etc)
});Payload type:
type CrosshairPriceActionEvent = {
x: number;
y: number;
price: number;
};Notes#
- Fires when the optional crosshair price action button (default text
"+") is clicked. - Enable button rendering via
crosshair.showPriceActionButton: true.
Double-click integration#
Set behavior:
chart.setDoubleClickEnabled(true);
chart.setDoubleClickAction("placeLimitOrder"); // or "reset""placeLimitOrder"emitsonOrderAction({ action: "createLimit", price })when double-clicking plot."reset"resets viewport/scale behavior.
