hyperprop-charting-library 0.1.20 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hyperprop-charting-library.cjs +698 -12
- package/dist/hyperprop-charting-library.d.ts +49 -1
- package/dist/hyperprop-charting-library.js +698 -12
- package/dist/index.cjs +698 -12
- package/dist/index.d.cts +49 -1
- package/dist/index.d.ts +49 -1
- package/dist/index.js +698 -12
- package/docs/API.md +28 -0
- package/package.json +1 -1
|
@@ -33,6 +33,48 @@ interface ChartOptions {
|
|
|
33
33
|
orderLines?: OrderLineOptions[];
|
|
34
34
|
tickerLine?: TickerLineOptions;
|
|
35
35
|
dashPatterns?: Partial<DashPatternOptions>;
|
|
36
|
+
indicators?: IndicatorInstanceOptions[];
|
|
37
|
+
}
|
|
38
|
+
type IndicatorPane = "overlay" | "separate";
|
|
39
|
+
interface IndicatorInstanceOptions<TInputs extends Record<string, unknown> = Record<string, unknown>> {
|
|
40
|
+
id?: string;
|
|
41
|
+
type: string;
|
|
42
|
+
visible?: boolean;
|
|
43
|
+
pane?: IndicatorPane;
|
|
44
|
+
inputs?: Partial<TInputs>;
|
|
45
|
+
}
|
|
46
|
+
interface IndicatorRenderContext {
|
|
47
|
+
data: Array<{
|
|
48
|
+
time: Date;
|
|
49
|
+
o: number;
|
|
50
|
+
h: number;
|
|
51
|
+
l: number;
|
|
52
|
+
c: number;
|
|
53
|
+
v?: number;
|
|
54
|
+
}>;
|
|
55
|
+
startIndex: number;
|
|
56
|
+
endIndex: number;
|
|
57
|
+
xStart: number;
|
|
58
|
+
xSpan: number;
|
|
59
|
+
chartLeft: number;
|
|
60
|
+
chartRight: number;
|
|
61
|
+
chartTop: number;
|
|
62
|
+
chartBottom: number;
|
|
63
|
+
chartWidth: number;
|
|
64
|
+
chartHeight: number;
|
|
65
|
+
xFromIndex: (index: number) => number;
|
|
66
|
+
yFromPrice: ((price: number) => number) | null;
|
|
67
|
+
candleSpacing: number;
|
|
68
|
+
upColor: string;
|
|
69
|
+
downColor: string;
|
|
70
|
+
}
|
|
71
|
+
interface IndicatorPlugin<TInputs extends Record<string, unknown> = Record<string, unknown>> {
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
pane?: IndicatorPane;
|
|
75
|
+
paneHeightRatio?: number;
|
|
76
|
+
defaultInputs?: TInputs;
|
|
77
|
+
draw: (ctx: CanvasRenderingContext2D, renderContext: IndicatorRenderContext, inputs: TInputs) => void;
|
|
36
78
|
}
|
|
37
79
|
interface DashPatternOptions {
|
|
38
80
|
dotted: [number, number];
|
|
@@ -223,6 +265,12 @@ interface ChartInstance {
|
|
|
223
265
|
fitContent: () => void;
|
|
224
266
|
setDoubleClickEnabled: (enabled: boolean) => void;
|
|
225
267
|
setDoubleClickAction: (action: "reset" | "placeLimitOrder") => void;
|
|
268
|
+
registerIndicator: (plugin: IndicatorPlugin<any>) => void;
|
|
269
|
+
unregisterIndicator: (type: string) => void;
|
|
270
|
+
addIndicator: (type: string, inputs?: Record<string, unknown>, options?: Partial<IndicatorInstanceOptions>) => string;
|
|
271
|
+
updateIndicator: (id: string, patch: Partial<IndicatorInstanceOptions>) => void;
|
|
272
|
+
removeIndicator: (id: string) => void;
|
|
273
|
+
setIndicators: (indicators: IndicatorInstanceOptions[]) => void;
|
|
226
274
|
resize: (width?: number, height?: number) => void;
|
|
227
275
|
destroy: () => void;
|
|
228
276
|
}
|
|
@@ -236,4 +284,4 @@ interface OhlcDataPoint {
|
|
|
236
284
|
}
|
|
237
285
|
declare function createChart(element: HTMLElement, options?: ChartOptions): ChartInstance;
|
|
238
286
|
|
|
239
|
-
export { type AxisOptions, type ChartClickEvent, type ChartInstance, type ChartOptions, type CrosshairMoveEvent, type CrosshairOptions, type CrosshairPriceActionEvent, type DashPatternOptions, type GridOptions, type OhlcDataPoint, type OrderActionButton, type OrderActionEvent, type OrderLineOptions, type PriceLineOptions, type TickerLineOptions, type WatermarkOptions, createChart };
|
|
287
|
+
export { type AxisOptions, type ChartClickEvent, type ChartInstance, type ChartOptions, type CrosshairMoveEvent, type CrosshairOptions, type CrosshairPriceActionEvent, type DashPatternOptions, type GridOptions, type IndicatorInstanceOptions, type IndicatorPane, type IndicatorPlugin, type IndicatorRenderContext, type OhlcDataPoint, type OrderActionButton, type OrderActionEvent, type OrderLineOptions, type PriceLineOptions, type TickerLineOptions, type WatermarkOptions, createChart };
|