hyperprop-charting-library 0.1.23 → 0.1.25
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 +44 -0
- package/dist/hyperprop-charting-library.cjs +291 -36
- package/dist/hyperprop-charting-library.d.ts +18 -1
- package/dist/hyperprop-charting-library.js +291 -36
- package/dist/index.cjs +291 -36
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +291 -36
- package/docs/API.md +18 -1
- package/docs/RECIPES.md +59 -0
- package/package.json +1 -1
package/docs/API.md
CHANGED
|
@@ -32,6 +32,8 @@ Top-level options:
|
|
|
32
32
|
- `backgroundColor` (default `#101114`)
|
|
33
33
|
- `axisColor` (legacy shorthand for axis line/text color)
|
|
34
34
|
- `axis?: AxisOptions`
|
|
35
|
+
- `xAxis?: AxisOptions` (overrides bottom-axis label text/font)
|
|
36
|
+
- `yAxis?: AxisOptions` (overrides right-axis label text/font)
|
|
35
37
|
- `priceDecimals` (default `2`, used for axis/ticker/line price labels)
|
|
36
38
|
- `stabilizePriceLabels` (default `true`, prevents ticker/crosshair/price-tag width jitter)
|
|
37
39
|
- `priceLabelMinIntegerDigits` (default `3`, baseline integer-digit width for stabilized labels)
|
|
@@ -50,6 +52,9 @@ Top-level options:
|
|
|
50
52
|
- `candleBodyWidthRatio` (default `0.7`)
|
|
51
53
|
- `candleMinWidth` (default `0.5`)
|
|
52
54
|
- `candleWickWidth` (default `1`)
|
|
55
|
+
- `tickSize` (default `0`; when > 0, formatter/pointer prices snap to tick)
|
|
56
|
+
- `candleColorMode` (`"openClose" | "prevClose"`, default `"openClose"`)
|
|
57
|
+
- `candleColorEpsilon` (default `-1` = auto from `priceDecimals`; set `0` to disable tolerance)
|
|
53
58
|
- `autoScaleSmoothing` (default `0.16`)
|
|
54
59
|
- `autoScaleIgnoreLatestCandle` (default `true`)
|
|
55
60
|
- `doubleClickEnabled` (default `true`)
|
|
@@ -246,6 +251,9 @@ Connector/fill visuals:
|
|
|
246
251
|
- `visible?: boolean` (default `true`)
|
|
247
252
|
- `pane?: "overlay" | "separate"`
|
|
248
253
|
- `paneHeightRatio?: number` (for separate panes; `0.08` to `0.45` recommended)
|
|
254
|
+
- `zIndex?: number` (render order; lower first)
|
|
255
|
+
- `excludeFromAutoscale?: boolean` (default `true` for indicator instances)
|
|
256
|
+
- `overlayScaleWeight?: number` (`0..1`; only used when `excludeFromAutoscale` is `false`)
|
|
249
257
|
- `inputs?: Record<string, unknown>` (plugin-specific parameters)
|
|
250
258
|
|
|
251
259
|
### `IndicatorPlugin`
|
|
@@ -267,7 +275,7 @@ Connector/fill visuals:
|
|
|
267
275
|
|
|
268
276
|
Built-in:
|
|
269
277
|
|
|
270
|
-
- `"volume"`:
|
|
278
|
+
- `"volume"`: overlay histogram by default (uses `OhlcDataPoint.v`; can be moved to separate pane)
|
|
271
279
|
- `"sma"`: Simple Moving Average (overlay)
|
|
272
280
|
- `"ema"`: Exponential Moving Average (overlay)
|
|
273
281
|
- `"rsi"`: Relative Strength Index (separate pane, 30/50/70 guides)
|
|
@@ -295,6 +303,13 @@ Volume/VWMA note:
|
|
|
295
303
|
|
|
296
304
|
- if your data has no `v`, `volume`/`vwma` will have limited or no output.
|
|
297
305
|
|
|
306
|
+
Volume style inputs:
|
|
307
|
+
|
|
308
|
+
- `upOpacity`, `downOpacity`
|
|
309
|
+
- `upColor`, `downColor`
|
|
310
|
+
- `minBarWidth`
|
|
311
|
+
- `overlayHeightRatio` (when used as overlay)
|
|
312
|
+
|
|
298
313
|
---
|
|
299
314
|
|
|
300
315
|
## `ChartInstance` Methods
|
|
@@ -323,6 +338,8 @@ Volume/VWMA note:
|
|
|
323
338
|
- `setDoubleClickAction(action: "reset" | "placeLimitOrder"): void`
|
|
324
339
|
- `registerIndicator(plugin: IndicatorPlugin): void`
|
|
325
340
|
- `unregisterIndicator(type: string): void`
|
|
341
|
+
- `listBuiltInIndicators(): BuiltInIndicatorInfo[]`
|
|
342
|
+
- `getIndicators(): IndicatorInstanceOptions[]`
|
|
326
343
|
- `addIndicator(type: string, inputs?: Record<string, unknown>, options?: Partial<IndicatorInstanceOptions>): string`
|
|
327
344
|
- `updateIndicator(id: string, patch: Partial<IndicatorInstanceOptions>): void`
|
|
328
345
|
- `removeIndicator(id: string): void`
|
package/docs/RECIPES.md
CHANGED
|
@@ -26,6 +26,45 @@ Use:
|
|
|
26
26
|
- `autoScaleSmoothing` for smoother scale transitions
|
|
27
27
|
- `autoScaleIgnoreLatestCandle` to reduce live-candle jitter
|
|
28
28
|
|
|
29
|
+
## Tick-size aware chart precision
|
|
30
|
+
|
|
31
|
+
```ts
|
|
32
|
+
const chart = createChart(rootEl, {
|
|
33
|
+
tickSize: 0.25,
|
|
34
|
+
priceDecimals: 2
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Style x-axis and y-axis labels differently
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
const chart = createChart(rootEl, {
|
|
42
|
+
axis: { lineColor: "#374151" },
|
|
43
|
+
xAxis: { textColor: "#9ca3af", fontSize: 11 },
|
|
44
|
+
yAxis: { textColor: "#e5e7eb", fontSize: 12 }
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Stabilize candle up/down coloring on tiny deltas
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
const chart = createChart(rootEl, {
|
|
52
|
+
// default behavior
|
|
53
|
+
candleColorMode: "openClose",
|
|
54
|
+
// auto epsilon from priceDecimals (recommended)
|
|
55
|
+
candleColorEpsilon: -1
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Use previous-close mode if your UX expects green/red by last-close change:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
const chart = createChart(rootEl, {
|
|
63
|
+
candleColorMode: "prevClose",
|
|
64
|
+
candleColorEpsilon: -1
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
29
68
|
## Add a static alert/level line
|
|
30
69
|
|
|
31
70
|
```ts
|
|
@@ -118,6 +157,26 @@ Recommended range:
|
|
|
118
157
|
|
|
119
158
|
- `0.08` to `0.45` (library clamps to safe bounds)
|
|
120
159
|
|
|
160
|
+
## Use indicator z-order and autoscale influence
|
|
161
|
+
|
|
162
|
+
```ts
|
|
163
|
+
chart.addIndicator("ema", { length: 34 }, { zIndex: 5 });
|
|
164
|
+
chart.addIndicator("wma", { length: 55 }, { zIndex: 10 });
|
|
165
|
+
|
|
166
|
+
chart.addIndicator("sma", { length: 200 }, {
|
|
167
|
+
excludeFromAutoscale: false,
|
|
168
|
+
overlayScaleWeight: 0.25
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Query built-ins and active indicator instances
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
const builtIns = chart.listBuiltInIndicators();
|
|
176
|
+
const active = chart.getIndicators();
|
|
177
|
+
console.log({ builtIns, active });
|
|
178
|
+
```
|
|
179
|
+
|
|
121
180
|
## Remove or hide indicators
|
|
122
181
|
|
|
123
182
|
```ts
|