Interface
PluginCtx
What a JS plugin gets while the frame is built. The functions only work during the call.
Properties
| Name | Type | Description |
|---|---|---|
rect | {
x: number;
y: number;
width: number;
height: number;
} | The area drawn in (clipped to): the pane's plot, or all panes for a chart-wide layer. |
dpr | number |
Methods
timeToX
timeToX(time: number): number | null;x of a time (UTC ms), interpolated and extrapolated; null for a chart-wide layer or a pane without data.
priceToY
priceToY(price: number): number | null;xToTime
xToTime(x: number): number | null;yToPrice
yToPrice(y: number): number | null;textWidth
textWidth(text: string, size?: number): number;Width of text at font size size (CSS px, default 12).
formatPrice
formatPrice(price: number): string;price formatted like the pane's axis labels.
Declaration
export interface PluginCtx {
rect: {
x: number;
y: number;
width: number;
height: number;
};
dpr: number;
timeToX(time: number): number | null;
priceToY(price: number): number | null;
xToTime(x: number): number | null;
yToPrice(y: number): number | null;
textWidth(text: string, size?: number): number;
formatPrice(price: number): string;
}