openalgo-charts 2.4.6 → 2.4.7
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 +22 -23
- package/dist/index.d.ts +14 -3
- package/dist/openalgo-charts.mjs +1 -1
- package/dist/openalgo-charts.mjs.map +1 -1
- package/dist/openalgo-charts.standalone.js +1 -1
- package/dist/openalgo-charts.standalone.js.map +1 -1
- package/dist/openalgo-charts.widget.mjs +1 -1
- package/dist/openalgo-charts.widget.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
**A from-scratch, dependency-free HTML5-canvas charting engine for OpenAlgo.**
|
|
6
6
|
|
|
7
|
-
Professional interactive charts, 105 built-in indicators plus your own custom ones, 85 drawing tools, order flow, market replay, linked chart grids, on-chart trading, vector SVG export and an optional WebGL2 backend. Nine lazy-loaded tiers, zero runtime dependencies,
|
|
7
|
+
Professional interactive charts, 105 built-in indicators plus your own custom ones, 85 drawing tools, order flow, market replay, linked chart grids, on-chart trading, vector SVG export and an optional WebGL2 backend. Nine lazy-loaded tiers, zero runtime dependencies, 92.83 kB Brotli for the base engine, and a one-call widget tier that adds the toolbar, drawing rail, dialogs and shortcuts.
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/openalgo-charts)
|
|
10
10
|
[](./LICENSE)
|
|
11
|
-
[](#size-budget)
|
|
12
|
+
[](#develop)
|
|
13
13
|
[](#principles)
|
|
14
14
|
|
|
15
15
|
[**Documentation**](https://marketcalls.github.io/openalgo-charts/) · [**Live examples**](https://marketcalls.github.io/openalgo-charts/examples) · [**Getting started**](./docs/getting-started.md) · [**Migrating to 2.0**](./docs/migrating-to-2.md) · [**Architecture**](./ARCHITECTURE.md)
|
|
@@ -53,17 +53,16 @@ Every chart in the [live gallery](https://marketcalls.github.io/openalgo-charts/
|
|
|
53
53
|
|
|
54
54
|
## Install
|
|
55
55
|
|
|
56
|
-
Current version: **2.4.
|
|
56
|
+
Current version: **2.4.7**.
|
|
57
57
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
See the [2.4.6 changelog](./CHANGELOG.md#246).
|
|
58
|
+
Drag a price or study-threshold alert line to preview a new level, then release
|
|
59
|
+
to save it once. Escape cancels the draft; range bounds stay ordered. Stored
|
|
60
|
+
thresholds and live evaluation remain unchanged during preview. See the
|
|
61
|
+
[2.4.7 changelog](./CHANGELOG.md#247) and the [live example](https://marketcalls.github.io/openalgo-charts/examples/#alert-threshold-dragging).
|
|
63
62
|
|
|
64
|
-
To try
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
To try dragging locally, run the [yfinance reference host](./examples/yfinance/README.md),
|
|
64
|
+
create a price alert from the chart context menu, and drag its dashed line or
|
|
65
|
+
**Alert** badge. Study and range alerts use the same controls.
|
|
67
66
|
|
|
68
67
|
```bash
|
|
69
68
|
npm install openalgo-charts
|
|
@@ -92,7 +91,7 @@ in front of npm rather than being places you upload to. A chart is one HTML file
|
|
|
92
91
|
```html
|
|
93
92
|
<div id="chart" style="width:100vw;height:100vh"></div>
|
|
94
93
|
<script type="module">
|
|
95
|
-
import { createChart } from 'https://unpkg.com/openalgo-charts@2.4.
|
|
94
|
+
import { createChart } from 'https://unpkg.com/openalgo-charts@2.4.7/dist/openalgo-charts.mjs';
|
|
96
95
|
const chart = createChart(document.getElementById('chart'), { timezone: 'Asia/Kolkata' });
|
|
97
96
|
chart.addSeries('candlestick').setData(bars);
|
|
98
97
|
</script>
|
|
@@ -134,17 +133,17 @@ Import only what you use. Each tier is a separate bundle that registers into the
|
|
|
134
133
|
|
|
135
134
|
| Import | Contents | Brotli |
|
|
136
135
|
|---|---|---|
|
|
137
|
-
| `openalgo-charts` | Engine, 13 chart types, panes & scales, primitives, registries, chart state, chart linking, bar cache, interval registry, trading overlay, SVG export, render backend port, OpenAlgo feeds |
|
|
136
|
+
| `openalgo-charts` | Engine, 13 chart types, panes & scales, primitives, registries, chart state, chart linking, bar cache, interval registry, trading overlay, SVG export, render backend port, OpenAlgo feeds | 92.83 kB |
|
|
138
137
|
| `openalgo-charts/indicators` | 105 built-in indicators, the `registerIndicator` contract for your own, and the Tier-2 (external-data) contract | 29.84 kB |
|
|
139
138
|
| `openalgo-charts/draw` | 85 drawing tools + a headless drawing controller, clipboard, settings schema, level palette, freehand geometry and SVG icons | 35.43 kB |
|
|
140
139
|
| `openalgo-charts/transform` | Heikin Ashi, Renko, Range bars, Line Break, Point & Figure, Kagi, and symbol arithmetic (`AAPL/MSFT`) | 4.50 kB |
|
|
141
140
|
| `openalgo-charts/profile` | Volume Profile, Market Profile (TPO) with compact pixel letters, Footprint, order flow | 14.96 kB |
|
|
142
141
|
| `openalgo-charts/trade` | Order / position / bracket tools + DOM ladder | 8.01 kB |
|
|
143
142
|
| `openalgo-charts/webgl` | WebGL2 series backend: batched, analytically anti-aliased GPU rendering of the standard chart types behind `renderer: 'auto'`, with a session-long fallback to the 2D path | 6.39 kB |
|
|
144
|
-
| `openalgo-charts/widget` | The chart with its chrome in one call: `createWidget` adds a top bar, the drawing rail, a status line, the settings and indicator dialogs, drawing properties, a right-click menu, a keymap with a `?` panel and optional layout persistence. The only tier that ships DOM | 49.
|
|
143
|
+
| `openalgo-charts/widget` | The chart with its chrome in one call: `createWidget` adds a top bar, the drawing rail, a status line, the settings and indicator dialogs, drawing properties, a right-click menu, a keymap with a `?` panel and optional layout persistence. The only tier that ships DOM | 49.03 kB |
|
|
145
144
|
| `openalgo-charts/workspace` | Validated workspace and indicator-template documents, named catalogs with revision checks, asynchronous storage and an IndexedDB adapter; no DOM | 5.52 kB |
|
|
146
145
|
|
|
147
|
-
Everything together is **
|
|
146
|
+
Everything together is **246.52 kB Brotli**; a widget terminal with built-in indicators (base + draw + indicators + widget) is 207.13 kB. Figures are measured from the 2.4.7 release build. The trade tier is 8.01 kB on its own; base + trade costs 100.84 kB. Sizes use decimal kB.
|
|
148
147
|
|
|
149
148
|
## What's built
|
|
150
149
|
|
|
@@ -449,17 +448,17 @@ Enforced in CI by [`size-limit`](./.size-limit.json). Nothing is excluded, becau
|
|
|
449
448
|
|
|
450
449
|
| Bundle | Limit | Actual |
|
|
451
450
|
|---|---|---|
|
|
452
|
-
| Base engine |
|
|
453
|
-
| Base + trade |
|
|
451
|
+
| Base engine | 93.5 kB | 92.83 kB |
|
|
452
|
+
| Base + trade | 101.5 kB | 100.84 kB |
|
|
454
453
|
| Indicators tier | 30 kB | 29.84 kB |
|
|
455
454
|
| Draw tier | 36 kB | 35.43 kB |
|
|
456
455
|
| Transform tier | 6 kB | 4.50 kB |
|
|
457
456
|
| Profile tier | 15 kB | 14.96 kB |
|
|
458
457
|
| WebGL2 tier | 7 kB | 6.39 kB |
|
|
459
|
-
| Widget tier | 49.25 kB | 49.
|
|
460
|
-
| Widget terminal (base + draw + indicators + widget) |
|
|
458
|
+
| Widget tier | 49.25 kB | 49.03 kB |
|
|
459
|
+
| Widget terminal (base + draw + indicators + widget) | 207.75 kB | 207.13 kB |
|
|
461
460
|
| Workspace tier | 6 kB | 5.52 kB |
|
|
462
|
-
| **Everything** |
|
|
461
|
+
| **Everything** | 247.25 kB | 246.52 kB |
|
|
463
462
|
|
|
464
463
|
## Documentation
|
|
465
464
|
|
|
@@ -504,7 +503,7 @@ See [Contributing](./CONTRIBUTING.md) for setup, targeted checks, documentation
|
|
|
504
503
|
```bash
|
|
505
504
|
npm install # install dev toolchain
|
|
506
505
|
npm run typecheck # strict TypeScript check
|
|
507
|
-
npm test # engine unit tests (Vitest):
|
|
506
|
+
npm test # engine unit tests (Vitest): 5841 across 246 files
|
|
508
507
|
npm run test:demo # reference-host tests: 401 across 31 files
|
|
509
508
|
npm run test:endurance # node endurance-harness tests: 7 cases
|
|
510
509
|
npm run build # Rollup -> dist/ (minified ESM per tier + types)
|
|
@@ -523,7 +522,7 @@ npm run verify # lint + types + unit + endurance harness + build + demo + dt
|
|
|
523
522
|
|
|
524
523
|
## Status & limitations
|
|
525
524
|
|
|
526
|
-
Version **2.4.
|
|
525
|
+
Version **2.4.7**. All engine build phases are implemented. Upgrading a 1.9.x host: [Migrating to 2.0](./docs/migrating-to-2.md).
|
|
527
526
|
|
|
528
527
|
Known gaps, stated plainly:
|
|
529
528
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TradingCapabilitySource as TradingCapabilitySource$1 } from 'openalgo-charts';
|
|
2
2
|
|
|
3
3
|
/** Library version string. Matches package.json (including locally prepared releases). */
|
|
4
|
-
declare const VERSION = "2.4.
|
|
4
|
+
declare const VERSION = "2.4.7";
|
|
5
5
|
/** Returns the current library version. */
|
|
6
6
|
declare function version(): string;
|
|
7
7
|
|
|
@@ -812,6 +812,8 @@ interface PrimitiveHit {
|
|
|
812
812
|
* declares it here, and the drag callbacks receive time as well as price.
|
|
813
813
|
*/
|
|
814
814
|
draggable?: boolean;
|
|
815
|
+
/** Opt into Escape cancellation without a release. Listen for `drag:cancel` to discard the preview. */
|
|
816
|
+
cancelOnEscape?: boolean;
|
|
815
817
|
}
|
|
816
818
|
/** Injected when a primitive is attached; lets it request a repaint. */
|
|
817
819
|
interface PrimitiveHost {
|
|
@@ -4339,7 +4341,7 @@ interface PointerSample {
|
|
|
4339
4341
|
}
|
|
4340
4342
|
/**
|
|
4341
4343
|
* What the engine reports about the physical pointer behind a gesture.
|
|
4342
|
-
* `crosshair:move`, `click`, `drag` and `drag:end` all carry these keys.
|
|
4344
|
+
* `crosshair:move`, `click`, `drag:start`, `drag` and `drag:end` all carry these keys.
|
|
4343
4345
|
*/
|
|
4344
4346
|
interface PointerInfo {
|
|
4345
4347
|
modifiers: PointerModifiers;
|
|
@@ -4393,7 +4395,7 @@ interface ChartDragEvent extends PointerInfo {
|
|
|
4393
4395
|
*/
|
|
4394
4396
|
samples: PointerSample[];
|
|
4395
4397
|
}
|
|
4396
|
-
/** Payload of
|
|
4398
|
+
/** Payload of `drag:start` (press) and `drag:end` (release) for a primitive drag. */
|
|
4397
4399
|
interface ChartDragEndEvent extends PointerInfo {
|
|
4398
4400
|
id: string;
|
|
4399
4401
|
price: number;
|
|
@@ -4634,6 +4636,7 @@ declare class Chart {
|
|
|
4634
4636
|
/** Pressure at the press; a click reports this, since its release always reads 0. */
|
|
4635
4637
|
private _downPressure;
|
|
4636
4638
|
private _dragId;
|
|
4639
|
+
private _dragCancelOnEscape;
|
|
4637
4640
|
private _hoverId;
|
|
4638
4641
|
/** Whether that primitive draws below the overlay, so leaving it must repaint the base. */
|
|
4639
4642
|
private _hoverOnBase;
|
|
@@ -5506,6 +5509,7 @@ declare class Chart {
|
|
|
5506
5509
|
private readonly _onDblClick;
|
|
5507
5510
|
private _beginPinch;
|
|
5508
5511
|
private _updatePinch;
|
|
5512
|
+
private _cancelPrimitiveDrag;
|
|
5509
5513
|
private readonly _onKeyDown;
|
|
5510
5514
|
/** Scope gating: hover keeps keys chart-local; global always acts. */
|
|
5511
5515
|
private _shortcutsActive;
|
|
@@ -9579,7 +9583,14 @@ declare class AlertController {
|
|
|
9579
9583
|
private _replay;
|
|
9580
9584
|
private _destroyed;
|
|
9581
9585
|
private _revision;
|
|
9586
|
+
private _drag;
|
|
9582
9587
|
constructor(_chart: AlertChartHost, options?: AlertControllerOptions);
|
|
9588
|
+
private _dragAvailability;
|
|
9589
|
+
private _dragPrice;
|
|
9590
|
+
private _startDrag;
|
|
9591
|
+
private _cancelDrag;
|
|
9592
|
+
/** Market evaluation keeps the committed source until a moved, owned gesture ends. */
|
|
9593
|
+
private _onDrag;
|
|
9583
9594
|
add(input: AlertInput): Alert;
|
|
9584
9595
|
update(id: string, patch: AlertPatch): Alert | undefined;
|
|
9585
9596
|
remove(id: string): boolean;
|