openalgo-charts 2.1.9 → 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, 76.16 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-76.16%20KB%20base%20%C2%B7%20203.62%20KB%20all%20tiers-brightgreen.svg)](#size-budget)
12
- [![tests](https://img.shields.io/badge/tests-4402%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,13 +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.9**.
46
+ Current version: **2.2.0**.
47
47
 
48
- This release adds default corner branding and optional background watermarks across
49
- charts, widgets and reference hosts. It also fixes profile example histograms,
50
- maximized-pane exports and logo gestures, and updates the website stock simulations.
51
- See the [branding guide](https://marketcalls.github.io/openalgo-charts/docs/branding-and-watermarks/)
52
- and the [2.1.9 changelog](./CHANGELOG.md#219).
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).
53
54
 
54
55
  ```bash
55
56
  npm install openalgo-charts
@@ -78,7 +79,7 @@ in front of npm rather than being places you upload to. A chart is one HTML file
78
79
  ```html
79
80
  <div id="chart" style="width:100vw;height:100vh"></div>
80
81
  <script type="module">
81
- import { createChart } from 'https://unpkg.com/openalgo-charts@2.1.9/dist/openalgo-charts.mjs';
82
+ import { createChart } from 'https://unpkg.com/openalgo-charts@2.2.0/dist/openalgo-charts.mjs';
82
83
  const chart = createChart(document.getElementById('chart'), { timezone: 'Asia/Kolkata' });
83
84
  chart.addSeries('candlestick').setData(bars);
84
85
  </script>
@@ -118,16 +119,16 @@ Import only what you use. Each tier is a separate bundle that registers into the
118
119
 
119
120
  | Import | Contents | Brotli |
120
121
  |---|---|---|
121
- | `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.16 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 |
122
123
  | `openalgo-charts/indicators` | 102 built-in indicators, the `registerIndicator` contract for your own, and the Tier-2 (external-data) contract | 28.05 KB |
123
- | `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 |
124
125
  | `openalgo-charts/transform` | Heikin Ashi, Renko, Range bars, Line Break, Point &amp; Figure, Kagi | 2.66 KB |
125
126
  | `openalgo-charts/profile` | Volume Profile, Market Profile (TPO) with compact pixel letters, Footprint, order flow | 14.96 KB |
126
127
  | `openalgo-charts/trade` | Order / position / bracket tools + DOM ladder | 7.61 KB |
127
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 |
128
- | `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.91 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 |
129
130
 
130
- Everything together is **203.62 KB Brotli**; a widget terminal (base + draw + indicators + widget, what one `createWidget` call loads) is 172.02 KB. Figures are measured from the 2.1.9 release build. The trade tier is listed as its delta over the base, so loading base + trade costs 83.77 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.
131
132
 
132
133
  ## What's built
133
134
 
@@ -159,7 +160,7 @@ const draw = new DrawingController(chart, { magnet: true });
159
160
  draw.setTool('trend-line'); // the next two clicks place it
160
161
  ```
161
162
 
162
- 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.
163
164
 
164
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.
165
166
 
@@ -419,16 +420,16 @@ Enforced in CI by [`size-limit`](./.size-limit.json). Nothing is excluded, becau
419
420
 
420
421
  | Bundle | Limit | Actual |
421
422
  |---|---|---|
422
- | Base engine | 77 KB | 76.16 KB |
423
- | Base + trade | 85 KB | 83.77 KB |
423
+ | Base engine | 77 KB | 76.22 KB |
424
+ | Base + trade | 85 KB | 83.83 KB |
424
425
  | Indicators tier | 30 KB | 28.05 KB |
425
- | Draw tier | 26 KB | 25.90 KB |
426
+ | Draw tier | 36 KB | 34.49 KB |
426
427
  | Transform tier | 5 KB | 2.66 KB |
427
428
  | Profile tier | 15 KB | 14.96 KB |
428
429
  | WebGL2 tier | 7 KB | 6.38 KB |
429
- | Widget tier | 42 KB | 41.91 KB |
430
- | Widget terminal (base + draw + indicators + widget) | 173 KB | 172.02 KB |
431
- | **Everything** | 205 KB | 203.62 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 |
432
433
 
433
434
  ## Documentation
434
435
 
@@ -473,7 +474,7 @@ See [Contributing](./CONTRIBUTING.md) for setup, targeted checks, documentation
473
474
  ```bash
474
475
  npm install # install dev toolchain
475
476
  npm run typecheck # strict TypeScript check
476
- npm test # unit tests (vitest) - 4402 across 197 files
477
+ npm test # unit tests (vitest) - 5142 across 207 files
477
478
  npm run build # Rollup -> dist/ (minified ESM per tier + types)
478
479
  npm run size # size-limit (Brotli) against the budget
479
480
  npm run e2e # Playwright Chromium smoke tests
@@ -490,7 +491,7 @@ npm run verify # lint + typecheck + test + build + demo tests + dts + size +
490
491
 
491
492
  ## Status &amp; limitations
492
493
 
493
- Version **2.1.9**. 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).
494
495
 
495
496
  Known gaps, stated plainly:
496
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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /** Library version string. Matches package.json (including locally prepared releases). */
2
- declare const VERSION = "2.1.9";
2
+ declare const VERSION = "2.2.0";
3
3
  /** Returns the current library version. */
4
4
  declare function version(): string;
5
5