openalgo-charts 2.1.8 → 2.2.0

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 CHANGED
@@ -4,17 +4,17 @@
4
4
 
5
5
  **A from-scratch, dependency-free HTML5-canvas charting engine for OpenAlgo.**
6
6
 
7
- Professional interactive charts, 102 built-in indicators plus your own custom ones, 51 drawing tools, order flow, market replay, linked chart grids, on-chart trading, vector SVG export and an optional WebGL2 backend. Eight lazy-loaded tiers, zero runtime dependencies, 74.00 KB Brotli for the base engine, and a one-call widget tier that adds the toolbar, drawing rail, dialogs and shortcuts.
7
+ Professional interactive charts, 102 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. Eight lazy-loaded tiers, zero runtime dependencies, 76.22 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
  [![npm version](https://img.shields.io/npm/v/openalgo-charts.svg?color=cb3837&label=npm)](https://www.npmjs.com/package/openalgo-charts)
10
10
  [![license](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](./LICENSE)
11
- [![bundle](https://img.shields.io/badge/brotli-74.00%20KB%20base%20%C2%B7%20201.15%20KB%20all%20tiers-brightgreen.svg)](#size-budget)
12
- [![tests](https://img.shields.io/badge/tests-4376%20passing-brightgreen.svg)](#develop)
11
+ [![bundle](https://img.shields.io/badge/brotli-76.22%20KB%20base%20%C2%B7%20212.52%20KB%20all%20tiers-brightgreen.svg)](#size-budget)
12
+ [![tests](https://img.shields.io/badge/tests-5142%20passing-brightgreen.svg)](#develop)
13
13
  [![dependencies](https://img.shields.io/badge/runtime%20deps-0-brightgreen.svg)](#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)
16
16
 
17
- <img src="docs/architecture-diagram.svg" alt="OpenAlgo Charts architecture: seven layers from the public API down to feeds and data, with 102 built-in plus custom indicators, 51 drawing tools, and an eight-tier bundle legend" width="920" />
17
+ <img src="docs/architecture-diagram.svg" alt="OpenAlgo Charts architecture: seven layers from the public API down to feeds and data, with 102 built-in plus custom indicators, 85 drawing tools, and an eight-tier bundle legend" width="920" />
18
18
 
19
19
  </div>
20
20
 
@@ -43,14 +43,14 @@ Every chart in the [live gallery](https://marketcalls.github.io/openalgo-charts/
43
43
 
44
44
  ## Install
45
45
 
46
- Current version: **2.1.8**.
46
+ Current version: **2.2.0**.
47
47
 
48
- This release adds proportional wheel and trackpad navigation, horizontal wheel pan,
49
- price-axis wheel scaling and smooth autoscale transitions. The packaged widget now
50
- provides responsive mobile controls that share its drawings, objects and dialogs.
51
- See the [interaction guide](https://marketcalls.github.io/openalgo-charts/docs/interactions/),
52
- the [mobile guide](https://marketcalls.github.io/openalgo-charts/docs/mobile/) and
53
- the [2.1.8 changelog](./CHANGELOG.md#218).
48
+ This release expands the drawing catalogue to 85 tools with pitchforks, regression
49
+ channels, advanced Fibonacci and Gann geometry, and harmonic and Elliott patterns.
50
+ It adds guided multi-point placement and an editable sample gallery while keeping
51
+ saved drawing documents compatible. See the
52
+ [drawing guide](https://marketcalls.github.io/openalgo-charts/docs/drawing-tools/)
53
+ and the [2.2.0 changelog](./CHANGELOG.md#220).
54
54
 
55
55
  ```bash
56
56
  npm install openalgo-charts
@@ -63,6 +63,14 @@ const chart = createChart(document.getElementById('chart'));
63
63
  chart.addSeries('candlestick').setData(generateBars(1700000000, 200, 3600));
64
64
  ```
65
65
 
66
+ ## Branding and optional watermark
67
+
68
+ Version 2.1.9 adds default corner branding and an optional background
69
+ watermark. The background text starts off. Use `branding: false` for a host-owned
70
+ logo, and `watermark: true` with `setDataContext` to show the current symbol and
71
+ interval. The same watermark controls appear under Appearance in chart settings.
72
+ See the [branding guide](https://marketcalls.github.io/openalgo-charts/docs/branding-and-watermarks/).
73
+
66
74
  ## No build step
67
75
 
68
76
  Every release is on unpkg and jsDelivr the moment it is published, because both sit
@@ -71,7 +79,7 @@ in front of npm rather than being places you upload to. A chart is one HTML file
71
79
  ```html
72
80
  <div id="chart" style="width:100vw;height:100vh"></div>
73
81
  <script type="module">
74
- import { createChart } from 'https://unpkg.com/openalgo-charts@2.1.8/dist/openalgo-charts.mjs';
82
+ import { createChart } from 'https://unpkg.com/openalgo-charts@2.2.0/dist/openalgo-charts.mjs';
75
83
  const chart = createChart(document.getElementById('chart'), { timezone: 'Asia/Kolkata' });
76
84
  chart.addSeries('candlestick').setData(bars);
77
85
  </script>
@@ -111,16 +119,16 @@ Import only what you use. Each tier is a separate bundle that registers into the
111
119
 
112
120
  | Import | Contents | Brotli |
113
121
  |---|---|---|
114
- | `openalgo-charts` | Engine, 13 chart types, panes &amp; scales, primitives, registries, chart state, chart linking, bar cache, interval registry, trading overlay, SVG export, render backend port, OpenAlgo feeds | 74.00 KB |
122
+ | `openalgo-charts` | Engine, 13 chart types, panes &amp; scales, primitives, registries, chart state, chart linking, bar cache, interval registry, trading overlay, SVG export, render backend port, OpenAlgo feeds | 76.22 KB |
115
123
  | `openalgo-charts/indicators` | 102 built-in indicators, the `registerIndicator` contract for your own, and the Tier-2 (external-data) contract | 28.05 KB |
116
- | `openalgo-charts/draw` | 51 drawing tools + a headless drawing controller, clipboard, settings schema, level palette, freehand geometry and SVG icons | 25.90 KB |
124
+ | `openalgo-charts/draw` | 85 drawing tools + a headless drawing controller, clipboard, settings schema, level palette, freehand geometry and SVG icons | 34.49 KB |
117
125
  | `openalgo-charts/transform` | Heikin Ashi, Renko, Range bars, Line Break, Point &amp; Figure, Kagi | 2.66 KB |
118
126
  | `openalgo-charts/profile` | Volume Profile, Market Profile (TPO) with compact pixel letters, Footprint, order flow | 14.96 KB |
119
127
  | `openalgo-charts/trade` | Order / position / bracket tools + DOM ladder | 7.61 KB |
120
128
  | `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.38 KB |
121
- | `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 | 41.59 KB |
129
+ | `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 | 42.16 KB |
122
130
 
123
- Everything together is **201.15 KB Brotli**; a widget terminal (base + draw + indicators + widget, what one `createWidget` call loads) is 169.54 KB. Figures are the measured `size-limit` output. The trade tier is listed as its delta over the base, so loading base + trade costs 81.61 KB.
131
+ Everything together is **212.52 KB Brotli**; a widget terminal (base + draw + indicators + widget, what one `createWidget` call loads) is 180.92 KB. Figures are measured from the 2.2.0 release build. The trade tier is listed as its delta over the base, so loading base + trade costs 83.83 KB.
124
132
 
125
133
  ## What's built
126
134
 
@@ -152,7 +160,7 @@ const draw = new DrawingController(chart, { magnet: true });
152
160
  draw.setTool('trend-line'); // the next two clicks place it
153
161
  ```
154
162
 
155
- 51 tools. Lines: trend line, ray, extended line, arrow, horizontal line/ray, vertical line, cross line. Shapes: rectangle, rotated rectangle, ellipse, circle, triangle. Paths: path, polyline, arc, curve, double curve. Channels: parallel channel, fib channel. Fibonacci: retracement, extension, time zone, speed fan. Gann: fan, box. Cycles: cyclic lines, time cycles, sine line. Forecasting: long/short position (1:1 from one click, with risk/reward and risk-based sizing), forecast. Measurers: price range, date range, measure. Arrows: mark up, down, left, right. Text and notes: text, price label, callout, flag mark. Annotations: note, balloon, comment, signpost, price note, table. Brushes: brush, highlighter (freehand).
163
+ 85 tools. Lines, channels and four pitchfork variants. Fibonacci levels, time projections, fans, circles, arcs, wedges and spirals. Gann fans, boxes and squares. Harmonic patterns, Elliott waves and Head and Shoulders. Geometric wavefronts and tessellation. Shapes, paths, forecasts, positions, measurements, text, tables and freehand brushes. Every tool appears in the [editable drawing gallery](https://marketcalls.github.io/openalgo-charts/demos/drawings/index.html), with simulated NIFTY prices near 23800 and desktop or touch controls.
156
164
 
157
165
  Headless by design: no toolbar, no dialogs. Placement with live preview, selection, whole-shape and per-anchor dragging, magnet snap to O/H/L/C, undo/redo (a drag is one step), and persistence. Anchors are `{ time, price }`, never pixels, so they survive zoom and resolve inside collapsed session gaps and past the last bar.
158
166
 
@@ -412,16 +420,16 @@ Enforced in CI by [`size-limit`](./.size-limit.json). Nothing is excluded, becau
412
420
 
413
421
  | Bundle | Limit | Actual |
414
422
  |---|---|---|
415
- | Base engine | 75 KB | 74.00 KB |
416
- | Base + trade | 83 KB | 81.61 KB |
423
+ | Base engine | 77 KB | 76.22 KB |
424
+ | Base + trade | 85 KB | 83.83 KB |
417
425
  | Indicators tier | 30 KB | 28.05 KB |
418
- | Draw tier | 26 KB | 25.90 KB |
426
+ | Draw tier | 36 KB | 34.49 KB |
419
427
  | Transform tier | 5 KB | 2.66 KB |
420
428
  | Profile tier | 15 KB | 14.96 KB |
421
429
  | WebGL2 tier | 7 KB | 6.38 KB |
422
- | Widget tier | 42 KB | 41.59 KB |
423
- | Widget terminal (base + draw + indicators + widget) | 170 KB | 169.54 KB |
424
- | **Everything** | **202 KB** | **201.15 KB** |
430
+ | Widget tier | 43 KB | 42.16 KB |
431
+ | Widget terminal (base + draw + indicators + widget) | 183 KB | 180.92 KB |
432
+ | **Everything** | 215 KB | 212.52 KB |
425
433
 
426
434
  ## Documentation
427
435
 
@@ -466,7 +474,7 @@ See [Contributing](./CONTRIBUTING.md) for setup, targeted checks, documentation
466
474
  ```bash
467
475
  npm install # install dev toolchain
468
476
  npm run typecheck # strict TypeScript check
469
- npm test # unit tests (vitest) - 4376 across 196 files
477
+ npm test # unit tests (vitest) - 5142 across 207 files
470
478
  npm run build # Rollup -> dist/ (minified ESM per tier + types)
471
479
  npm run size # size-limit (Brotli) against the budget
472
480
  npm run e2e # Playwright Chromium smoke tests
@@ -483,7 +491,7 @@ npm run verify # lint + typecheck + test + build + demo tests + dts + size +
483
491
 
484
492
  ## Status &amp; limitations
485
493
 
486
- Version **2.1.8**. All engine build phases are implemented. Upgrading a 1.9.x host: [Migrating to 2.0](./docs/migrating-to-2.md).
494
+ Version **2.2.0**. All engine build phases are implemented. Upgrading a 1.9.x host: [Migrating to 2.0](./docs/migrating-to-2.md).
487
495
 
488
496
  Known gaps, stated plainly:
489
497
 
@@ -1021,6 +1021,7 @@ declare class DrawingLayer implements IPrimitive {
1021
1021
  draw(ctx: CanvasRenderingContext2D, rc: PrimitiveRenderContext): void;
1022
1022
  private _drawingContext;
1023
1023
  private _drawContent;
1024
+ private _drawPlacementGuide;
1024
1025
  /**
1025
1026
  * Anchor handles. A hover shows them light (thin, translucent) as a hint
1026
1027
  * that the shape can be grabbed; a selection shows them at full weight.
@@ -1793,6 +1794,19 @@ declare function catmullRom(ctx: CanvasRenderingContext2D, points: ReadonlyArray
1793
1794
  */
1794
1795
  declare function pressureWidth(baseWidth: number, pressure: number, range?: number): number;
1795
1796
 
1797
+ /** Channels, pitchforks and dedicated line tools. Geometry stays in media pixels. */
1798
+
1799
+ declare const ADVANCED_LINE_TOOLS: readonly DrawingTool[];
1800
+
1801
+ /** Screen-space curves and price/time constructions for advanced drawings. */
1802
+
1803
+ declare const ADVANCED_GEOMETRY_TOOLS: readonly DrawingTool[];
1804
+
1805
+ /** Labeled price patterns with shared paint and hit geometry. */
1806
+
1807
+ /** Pattern drawing descriptors. Registration is owned by the draw-tier catalog. */
1808
+ declare const PATTERN_DRAWING_TOOLS: readonly DrawingTool[];
1809
+
1796
1810
  declare const DRAW_TIER: "draw";
1797
1811
 
1798
- export { ALIGN_OPTIONS, ARC, ARROW, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, BALLOON, BRUSH, BUILTIN_DRAWING_TOOLS, CALLOUT, CHROME_ICONS, CHROME_ICON_ATTRS, CHROME_ICON_FILLED, CHROME_ICON_STROKE, CHROME_ICON_VIEWBOX, CIRCLE, COLOR_FIELD, COMMENT, CROSS_LINE, CURVE, CYCLE_PALETTE, CYCLIC_LINES, type ClipboardPort, DATE_RANGE, DEFAULT_FIB, DEFAULT_FIB_FAN, DEFAULT_FIB_TIME_ZONE, DEFAULT_GANN_BOX, DEFAULT_GANN_FAN, DOUBLE_CURVE, DRAWING_CLIPBOARD_KEY, DRAWING_CLIPBOARD_VERSION, DRAWING_STATE_VERSION, DRAWING_TOOL_ICONS, DRAW_TIER, type DrawContext, type Drawing, type DrawingChangeKind, type DrawingChartHost, DrawingClipboard, type DrawingClipboardOptions, DrawingController, type DrawingControllerOptions, type DrawingInput, type DrawingKeyAction, type DrawingKeyContext, type DrawingKeyEvent, DrawingLayer, type DrawingLayerOrder, type DrawingPatch, type DrawingPoint, type DrawingPointerKind, type DrawingStyle, type DrawingText, type DrawingTool, type DrawingsDocument, ELLIPSE, EXTENDED_LINE, EXTEND_FIELDS, type ExpandContext, FIB_CHANNEL, FIB_EXTENSION, FIB_FAN, FIB_RETRACEMENT, FIB_TIME_ZONE, FILL_FIELDS, FLAG_MARK, FONT_FIELDS, FONT_OPTIONS, FORECAST, type FibLevel, type FieldGroup, type FieldKind, GANN_BOX, GANN_FAN, HIGHLIGHTER, HORIZONTAL_LINE, HORIZONTAL_RAY, type HitContext, ICON_ATTRS, ICON_STROKE, ICON_SYMBOL_PREFIX, ICON_VIEWBOX, type IconAttrs, type IconSvgOptions, LEVEL_FIELDS, LEVEL_NEUTRAL, LINE_FIELDS, LINE_STYLE_FIELD, LINE_STYLE_OPTIONS, LINE_WIDTH_FIELD, LONG_POSITION, MEASURE, type MagnetMode, NOTE, NUDGE_STEP_PX, NUDGE_STEP_SHIFT_PX, PARALLEL_CHANNEL, PATH, PLATE_TEXT_FIELDS, POLYLINE, PRICE_LABEL, PRICE_NOTE, PRICE_RANGE, RAY, RECTANGLE, ROTATED_RECTANGLE, SHAPE_TEXT_FIELDS, SHORT_POSITION, SHOW_LABELS_FIELD, SIGNPOST, SINE_LINE, type ScreenPoint, type SettingsField, type SettingsSchema, type ShortcutEvent, TABLE, TEXT, TEXT_FIELDS, TEXT_POSITION_OPTIONS, TEXT_VALUE_FIELD, TIME_CYCLES, TREND_LINE, TRIANGLE, type ToolCursorOptions, VALIGN_OPTIONS, VERTICAL_LINE, applyDrawingSettings, boundsOf, catmullRom, chromeIcon, chromeIconIds, chromeIconSvg, clearMemoryClipboard, cloneDrawing, cloneLevels, coerceSettingValue, composeSettings, cycleColor, decodeClipboardPayload, distToEllipse, distToLine, distToPolyline, distToRect, distToSegment, drawingSettingsSchema, drawingShortcuts, drawingToolIcon, drawingToolIconIds, encodeClipboardPayload, extendSegment, formatRatio, gannLabel, getDrawingTool, hasDrawingTool, iconSprite, iconSvg, iconUse, keyToDrawingAction, levelColor, matchDrawingShortcut, migrateDrawings, pressureWidth, rdpSimplify, readDrawingSetting, readDrawingSettings, rectOf, registerBuiltinDrawingTools, registerDrawingTool, registeredDrawingTools, sanitizeDrawing, sortByZIndex, systemClipboard, toolCursor };
1812
+ export { ADVANCED_GEOMETRY_TOOLS, ADVANCED_LINE_TOOLS, ALIGN_OPTIONS, ARC, ARROW, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, BALLOON, BRUSH, BUILTIN_DRAWING_TOOLS, CALLOUT, CHROME_ICONS, CHROME_ICON_ATTRS, CHROME_ICON_FILLED, CHROME_ICON_STROKE, CHROME_ICON_VIEWBOX, CIRCLE, COLOR_FIELD, COMMENT, CROSS_LINE, CURVE, CYCLE_PALETTE, CYCLIC_LINES, type ClipboardPort, DATE_RANGE, DEFAULT_FIB, DEFAULT_FIB_FAN, DEFAULT_FIB_TIME_ZONE, DEFAULT_GANN_BOX, DEFAULT_GANN_FAN, DOUBLE_CURVE, DRAWING_CLIPBOARD_KEY, DRAWING_CLIPBOARD_VERSION, DRAWING_STATE_VERSION, DRAWING_TOOL_ICONS, DRAW_TIER, type DrawContext, type Drawing, type DrawingChangeKind, type DrawingChartHost, DrawingClipboard, type DrawingClipboardOptions, DrawingController, type DrawingControllerOptions, type DrawingInput, type DrawingKeyAction, type DrawingKeyContext, type DrawingKeyEvent, DrawingLayer, type DrawingLayerOrder, type DrawingPatch, type DrawingPoint, type DrawingPointerKind, type DrawingStyle, type DrawingText, type DrawingTool, type DrawingsDocument, ELLIPSE, EXTENDED_LINE, EXTEND_FIELDS, type ExpandContext, FIB_CHANNEL, FIB_EXTENSION, FIB_FAN, FIB_RETRACEMENT, FIB_TIME_ZONE, FILL_FIELDS, FLAG_MARK, FONT_FIELDS, FONT_OPTIONS, FORECAST, type FibLevel, type FieldGroup, type FieldKind, GANN_BOX, GANN_FAN, HIGHLIGHTER, HORIZONTAL_LINE, HORIZONTAL_RAY, type HitContext, ICON_ATTRS, ICON_STROKE, ICON_SYMBOL_PREFIX, ICON_VIEWBOX, type IconAttrs, type IconSvgOptions, LEVEL_FIELDS, LEVEL_NEUTRAL, LINE_FIELDS, LINE_STYLE_FIELD, LINE_STYLE_OPTIONS, LINE_WIDTH_FIELD, LONG_POSITION, MEASURE, type MagnetMode, NOTE, NUDGE_STEP_PX, NUDGE_STEP_SHIFT_PX, PARALLEL_CHANNEL, PATH, PATTERN_DRAWING_TOOLS, PLATE_TEXT_FIELDS, POLYLINE, PRICE_LABEL, PRICE_NOTE, PRICE_RANGE, RAY, RECTANGLE, ROTATED_RECTANGLE, SHAPE_TEXT_FIELDS, SHORT_POSITION, SHOW_LABELS_FIELD, SIGNPOST, SINE_LINE, type ScreenPoint, type SettingsField, type SettingsSchema, type ShortcutEvent, TABLE, TEXT, TEXT_FIELDS, TEXT_POSITION_OPTIONS, TEXT_VALUE_FIELD, TIME_CYCLES, TREND_LINE, TRIANGLE, type ToolCursorOptions, VALIGN_OPTIONS, VERTICAL_LINE, applyDrawingSettings, boundsOf, catmullRom, chromeIcon, chromeIconIds, chromeIconSvg, clearMemoryClipboard, cloneDrawing, cloneLevels, coerceSettingValue, composeSettings, cycleColor, decodeClipboardPayload, distToEllipse, distToLine, distToPolyline, distToRect, distToSegment, drawingSettingsSchema, drawingShortcuts, drawingToolIcon, drawingToolIconIds, encodeClipboardPayload, extendSegment, formatRatio, gannLabel, getDrawingTool, hasDrawingTool, iconSprite, iconSvg, iconUse, keyToDrawingAction, levelColor, matchDrawingShortcut, migrateDrawings, pressureWidth, rdpSimplify, readDrawingSetting, readDrawingSettings, rectOf, registerBuiltinDrawingTools, registerDrawingTool, registeredDrawingTools, sanitizeDrawing, sortByZIndex, systemClipboard, toolCursor };