hyperprop-charting-library 0.1.20 → 0.1.22
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/README.md +50 -0
- package/dist/hyperprop-charting-library.cjs +704 -12
- package/dist/hyperprop-charting-library.d.ts +50 -1
- package/dist/hyperprop-charting-library.js +704 -12
- package/dist/index.cjs +704 -12
- package/dist/index.d.cts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +704 -12
- package/docs/API.md +63 -0
- package/docs/RECIPES.md +61 -0
- package/package.json +1 -1
|
@@ -33,6 +33,49 @@ 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
|
+
paneHeightRatio?: number;
|
|
45
|
+
inputs?: Partial<TInputs>;
|
|
46
|
+
}
|
|
47
|
+
interface IndicatorRenderContext {
|
|
48
|
+
data: Array<{
|
|
49
|
+
time: Date;
|
|
50
|
+
o: number;
|
|
51
|
+
h: number;
|
|
52
|
+
l: number;
|
|
53
|
+
c: number;
|
|
54
|
+
v?: number;
|
|
55
|
+
}>;
|
|
56
|
+
startIndex: number;
|
|
57
|
+
endIndex: number;
|
|
58
|
+
xStart: number;
|
|
59
|
+
xSpan: number;
|
|
60
|
+
chartLeft: number;
|
|
61
|
+
chartRight: number;
|
|
62
|
+
chartTop: number;
|
|
63
|
+
chartBottom: number;
|
|
64
|
+
chartWidth: number;
|
|
65
|
+
chartHeight: number;
|
|
66
|
+
xFromIndex: (index: number) => number;
|
|
67
|
+
yFromPrice: ((price: number) => number) | null;
|
|
68
|
+
candleSpacing: number;
|
|
69
|
+
upColor: string;
|
|
70
|
+
downColor: string;
|
|
71
|
+
}
|
|
72
|
+
interface IndicatorPlugin<TInputs extends Record<string, unknown> = Record<string, unknown>> {
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
pane?: IndicatorPane;
|
|
76
|
+
paneHeightRatio?: number;
|
|
77
|
+
defaultInputs?: TInputs;
|
|
78
|
+
draw: (ctx: CanvasRenderingContext2D, renderContext: IndicatorRenderContext, inputs: TInputs) => void;
|
|
36
79
|
}
|
|
37
80
|
interface DashPatternOptions {
|
|
38
81
|
dotted: [number, number];
|
|
@@ -223,6 +266,12 @@ interface ChartInstance {
|
|
|
223
266
|
fitContent: () => void;
|
|
224
267
|
setDoubleClickEnabled: (enabled: boolean) => void;
|
|
225
268
|
setDoubleClickAction: (action: "reset" | "placeLimitOrder") => void;
|
|
269
|
+
registerIndicator: (plugin: IndicatorPlugin<any>) => void;
|
|
270
|
+
unregisterIndicator: (type: string) => void;
|
|
271
|
+
addIndicator: (type: string, inputs?: Record<string, unknown>, options?: Partial<IndicatorInstanceOptions>) => string;
|
|
272
|
+
updateIndicator: (id: string, patch: Partial<IndicatorInstanceOptions>) => void;
|
|
273
|
+
removeIndicator: (id: string) => void;
|
|
274
|
+
setIndicators: (indicators: IndicatorInstanceOptions[]) => void;
|
|
226
275
|
resize: (width?: number, height?: number) => void;
|
|
227
276
|
destroy: () => void;
|
|
228
277
|
}
|
|
@@ -236,4 +285,4 @@ interface OhlcDataPoint {
|
|
|
236
285
|
}
|
|
237
286
|
declare function createChart(element: HTMLElement, options?: ChartOptions): ChartInstance;
|
|
238
287
|
|
|
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 };
|
|
288
|
+
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 };
|