@itssumitrai/fin-charter 0.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 +96 -0
- package/dist/api/chart-api.d.ts +173 -0
- package/dist/api/export.d.ts +46 -0
- package/dist/api/indicator-api.d.ts +38 -0
- package/dist/api/options.d.ts +226 -0
- package/dist/api/pane-api.d.ts +28 -0
- package/dist/api/series-api.d.ts +115 -0
- package/dist/core/accessibility.d.ts +90 -0
- package/dist/core/alert-line.d.ts +49 -0
- package/dist/core/chart-state.d.ts +39 -0
- package/dist/core/chart-sync.d.ts +83 -0
- package/dist/core/crosshair.d.ts +28 -0
- package/dist/core/css-theme.d.ts +41 -0
- package/dist/core/custom-indicator.d.ts +70 -0
- package/dist/core/data-feed.d.ts +59 -0
- package/dist/core/data-layer.d.ts +38 -0
- package/dist/core/invalidation.d.ts +24 -0
- package/dist/core/market-session.d.ts +11 -0
- package/dist/core/order-line.d.ts +134 -0
- package/dist/core/pane-divider.d.ts +22 -0
- package/dist/core/pane.d.ts +32 -0
- package/dist/core/periodicity.d.ts +6 -0
- package/dist/core/plugin.d.ts +90 -0
- package/dist/core/price-line.d.ts +17 -0
- package/dist/core/price-scale.d.ts +74 -0
- package/dist/core/replay.d.ts +73 -0
- package/dist/core/rtl.d.ts +22 -0
- package/dist/core/segment-tree.d.ts +38 -0
- package/dist/core/series-markers.d.ts +18 -0
- package/dist/core/storage-adapter.d.ts +50 -0
- package/dist/core/streaming-adapter.d.ts +102 -0
- package/dist/core/symbol-resolver.d.ts +32 -0
- package/dist/core/text-label.d.ts +72 -0
- package/dist/core/time-scale.d.ts +109 -0
- package/dist/core/types.d.ts +144 -0
- package/dist/core/undo-redo.d.ts +46 -0
- package/dist/currency/currency.d.ts +8 -0
- package/dist/currency/index.d.ts +2 -0
- package/dist/drawings/arrow.d.ts +10 -0
- package/dist/drawings/base.d.ts +79 -0
- package/dist/drawings/channel.d.ts +10 -0
- package/dist/drawings/crossline.d.ts +10 -0
- package/dist/drawings/ellipse.d.ts +10 -0
- package/dist/drawings/fib-arc.d.ts +10 -0
- package/dist/drawings/fib-fan.d.ts +12 -0
- package/dist/drawings/fib-projection.d.ts +11 -0
- package/dist/drawings/fibonacci.d.ts +11 -0
- package/dist/drawings/horizontal-line.d.ts +10 -0
- package/dist/drawings/index.d.ts +7 -0
- package/dist/drawings/measurement.d.ts +11 -0
- package/dist/drawings/pitchfork.d.ts +12 -0
- package/dist/drawings/ray.d.ts +12 -0
- package/dist/drawings/rectangle.d.ts +10 -0
- package/dist/drawings/text-annotation.d.ts +11 -0
- package/dist/drawings/trendline.d.ts +10 -0
- package/dist/drawings/vertical-line.d.ts +10 -0
- package/dist/formatting/index.d.ts +5 -0
- package/dist/formatting/price-formatter.d.ts +6 -0
- package/dist/formatting/time-formatter.d.ts +7 -0
- package/dist/formatting/volume-formatter.d.ts +1 -0
- package/dist/i18n/i18n.d.ts +6 -0
- package/dist/i18n/index.d.ts +3 -0
- package/dist/i18n/locales/en.d.ts +3 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index10.js +2 -0
- package/dist/index10.js.map +1 -0
- package/dist/index100.js +2 -0
- package/dist/index100.js.map +1 -0
- package/dist/index101.js +2 -0
- package/dist/index101.js.map +1 -0
- package/dist/index102.js +2 -0
- package/dist/index102.js.map +1 -0
- package/dist/index103.js +2 -0
- package/dist/index103.js.map +1 -0
- package/dist/index104.js +2 -0
- package/dist/index104.js.map +1 -0
- package/dist/index105.js +2 -0
- package/dist/index105.js.map +1 -0
- package/dist/index106.js +2 -0
- package/dist/index106.js.map +1 -0
- package/dist/index107.js +2 -0
- package/dist/index107.js.map +1 -0
- package/dist/index108.js +2 -0
- package/dist/index108.js.map +1 -0
- package/dist/index109.js +2 -0
- package/dist/index109.js.map +1 -0
- package/dist/index11.js +2 -0
- package/dist/index11.js.map +1 -0
- package/dist/index110.js +2 -0
- package/dist/index110.js.map +1 -0
- package/dist/index111.js +2 -0
- package/dist/index111.js.map +1 -0
- package/dist/index112.js +2 -0
- package/dist/index112.js.map +1 -0
- package/dist/index113.js +2 -0
- package/dist/index113.js.map +1 -0
- package/dist/index114.js +2 -0
- package/dist/index114.js.map +1 -0
- package/dist/index115.js +2 -0
- package/dist/index115.js.map +1 -0
- package/dist/index116.js +2 -0
- package/dist/index116.js.map +1 -0
- package/dist/index117.js +2 -0
- package/dist/index117.js.map +1 -0
- package/dist/index118.js +2 -0
- package/dist/index118.js.map +1 -0
- package/dist/index119.js +2 -0
- package/dist/index119.js.map +1 -0
- package/dist/index12.js +2 -0
- package/dist/index12.js.map +1 -0
- package/dist/index120.js +2 -0
- package/dist/index120.js.map +1 -0
- package/dist/index121.js +2 -0
- package/dist/index121.js.map +1 -0
- package/dist/index122.js +2 -0
- package/dist/index122.js.map +1 -0
- package/dist/index123.js +2 -0
- package/dist/index123.js.map +1 -0
- package/dist/index124.js +2 -0
- package/dist/index124.js.map +1 -0
- package/dist/index13.js +2 -0
- package/dist/index13.js.map +1 -0
- package/dist/index14.js +2 -0
- package/dist/index14.js.map +1 -0
- package/dist/index15.js +2 -0
- package/dist/index15.js.map +1 -0
- package/dist/index16.js +2 -0
- package/dist/index16.js.map +1 -0
- package/dist/index17.js +2 -0
- package/dist/index17.js.map +1 -0
- package/dist/index18.js +2 -0
- package/dist/index18.js.map +1 -0
- package/dist/index19.js +2 -0
- package/dist/index19.js.map +1 -0
- package/dist/index2.js +2 -0
- package/dist/index2.js.map +1 -0
- package/dist/index20.js +2 -0
- package/dist/index20.js.map +1 -0
- package/dist/index21.js +2 -0
- package/dist/index21.js.map +1 -0
- package/dist/index22.js +2 -0
- package/dist/index22.js.map +1 -0
- package/dist/index23.js +2 -0
- package/dist/index23.js.map +1 -0
- package/dist/index24.js +2 -0
- package/dist/index24.js.map +1 -0
- package/dist/index25.js +2 -0
- package/dist/index25.js.map +1 -0
- package/dist/index26.js +2 -0
- package/dist/index26.js.map +1 -0
- package/dist/index27.js +2 -0
- package/dist/index27.js.map +1 -0
- package/dist/index28.js +2 -0
- package/dist/index28.js.map +1 -0
- package/dist/index29.js +2 -0
- package/dist/index29.js.map +1 -0
- package/dist/index3.js +2 -0
- package/dist/index3.js.map +1 -0
- package/dist/index30.js +2 -0
- package/dist/index30.js.map +1 -0
- package/dist/index31.js +2 -0
- package/dist/index31.js.map +1 -0
- package/dist/index32.js +2 -0
- package/dist/index32.js.map +1 -0
- package/dist/index33.js +2 -0
- package/dist/index33.js.map +1 -0
- package/dist/index34.js +2 -0
- package/dist/index34.js.map +1 -0
- package/dist/index35.js +2 -0
- package/dist/index35.js.map +1 -0
- package/dist/index36.js +2 -0
- package/dist/index36.js.map +1 -0
- package/dist/index37.js +2 -0
- package/dist/index37.js.map +1 -0
- package/dist/index38.js +2 -0
- package/dist/index38.js.map +1 -0
- package/dist/index39.js +2 -0
- package/dist/index39.js.map +1 -0
- package/dist/index4.js +2 -0
- package/dist/index4.js.map +1 -0
- package/dist/index40.js +2 -0
- package/dist/index40.js.map +1 -0
- package/dist/index41.js +2 -0
- package/dist/index41.js.map +1 -0
- package/dist/index42.js +2 -0
- package/dist/index42.js.map +1 -0
- package/dist/index43.js +2 -0
- package/dist/index43.js.map +1 -0
- package/dist/index44.js +2 -0
- package/dist/index44.js.map +1 -0
- package/dist/index45.js +2 -0
- package/dist/index45.js.map +1 -0
- package/dist/index46.js +2 -0
- package/dist/index46.js.map +1 -0
- package/dist/index47.js +2 -0
- package/dist/index47.js.map +1 -0
- package/dist/index48.js +2 -0
- package/dist/index48.js.map +1 -0
- package/dist/index49.js +2 -0
- package/dist/index49.js.map +1 -0
- package/dist/index5.js +2 -0
- package/dist/index5.js.map +1 -0
- package/dist/index50.js +2 -0
- package/dist/index50.js.map +1 -0
- package/dist/index51.js +2 -0
- package/dist/index51.js.map +1 -0
- package/dist/index52.js +2 -0
- package/dist/index52.js.map +1 -0
- package/dist/index53.js +2 -0
- package/dist/index53.js.map +1 -0
- package/dist/index54.js +2 -0
- package/dist/index54.js.map +1 -0
- package/dist/index55.js +2 -0
- package/dist/index55.js.map +1 -0
- package/dist/index56.js +2 -0
- package/dist/index56.js.map +1 -0
- package/dist/index57.js +2 -0
- package/dist/index57.js.map +1 -0
- package/dist/index58.js +2 -0
- package/dist/index58.js.map +1 -0
- package/dist/index59.js +2 -0
- package/dist/index59.js.map +1 -0
- package/dist/index6.js +2 -0
- package/dist/index6.js.map +1 -0
- package/dist/index60.js +2 -0
- package/dist/index60.js.map +1 -0
- package/dist/index61.js +2 -0
- package/dist/index61.js.map +1 -0
- package/dist/index62.js +2 -0
- package/dist/index62.js.map +1 -0
- package/dist/index63.js +2 -0
- package/dist/index63.js.map +1 -0
- package/dist/index64.js +2 -0
- package/dist/index64.js.map +1 -0
- package/dist/index65.js +3 -0
- package/dist/index65.js.map +1 -0
- package/dist/index66.js +2 -0
- package/dist/index66.js.map +1 -0
- package/dist/index67.js +2 -0
- package/dist/index67.js.map +1 -0
- package/dist/index68.js +2 -0
- package/dist/index68.js.map +1 -0
- package/dist/index69.js +2 -0
- package/dist/index69.js.map +1 -0
- package/dist/index7.js +2 -0
- package/dist/index7.js.map +1 -0
- package/dist/index70.js +2 -0
- package/dist/index70.js.map +1 -0
- package/dist/index71.js +2 -0
- package/dist/index71.js.map +1 -0
- package/dist/index72.js +2 -0
- package/dist/index72.js.map +1 -0
- package/dist/index73.js +2 -0
- package/dist/index73.js.map +1 -0
- package/dist/index74.js +2 -0
- package/dist/index74.js.map +1 -0
- package/dist/index75.js +2 -0
- package/dist/index75.js.map +1 -0
- package/dist/index76.js +2 -0
- package/dist/index76.js.map +1 -0
- package/dist/index77.js +2 -0
- package/dist/index77.js.map +1 -0
- package/dist/index78.js +2 -0
- package/dist/index78.js.map +1 -0
- package/dist/index79.js +2 -0
- package/dist/index79.js.map +1 -0
- package/dist/index8.js +2 -0
- package/dist/index8.js.map +1 -0
- package/dist/index80.js +2 -0
- package/dist/index80.js.map +1 -0
- package/dist/index81.js +2 -0
- package/dist/index81.js.map +1 -0
- package/dist/index82.js +2 -0
- package/dist/index82.js.map +1 -0
- package/dist/index83.js +2 -0
- package/dist/index83.js.map +1 -0
- package/dist/index84.js +2 -0
- package/dist/index84.js.map +1 -0
- package/dist/index85.js +2 -0
- package/dist/index85.js.map +1 -0
- package/dist/index86.js +2 -0
- package/dist/index86.js.map +1 -0
- package/dist/index87.js +2 -0
- package/dist/index87.js.map +1 -0
- package/dist/index88.js +2 -0
- package/dist/index88.js.map +1 -0
- package/dist/index89.js +2 -0
- package/dist/index89.js.map +1 -0
- package/dist/index9.js +2 -0
- package/dist/index9.js.map +1 -0
- package/dist/index90.js +2 -0
- package/dist/index90.js.map +1 -0
- package/dist/index91.js +2 -0
- package/dist/index91.js.map +1 -0
- package/dist/index92.js +2 -0
- package/dist/index92.js.map +1 -0
- package/dist/index93.js +2 -0
- package/dist/index93.js.map +1 -0
- package/dist/index94.js +2 -0
- package/dist/index94.js.map +1 -0
- package/dist/index95.js +2 -0
- package/dist/index95.js.map +1 -0
- package/dist/index96.js +2 -0
- package/dist/index96.js.map +1 -0
- package/dist/index97.js +2 -0
- package/dist/index97.js.map +1 -0
- package/dist/index98.js +2 -0
- package/dist/index98.js.map +1 -0
- package/dist/index99.js +2 -0
- package/dist/index99.js.map +1 -0
- package/dist/indicators/adx.d.ts +6 -0
- package/dist/indicators/aroon.d.ts +5 -0
- package/dist/indicators/atr.d.ts +1 -0
- package/dist/indicators/awesome-oscillator.d.ts +1 -0
- package/dist/indicators/bollinger.d.ts +6 -0
- package/dist/indicators/cci.d.ts +1 -0
- package/dist/indicators/chaikin-mf.d.ts +1 -0
- package/dist/indicators/choppiness.d.ts +1 -0
- package/dist/indicators/coppock.d.ts +1 -0
- package/dist/indicators/donchian.d.ts +6 -0
- package/dist/indicators/elder-force.d.ts +1 -0
- package/dist/indicators/ema.d.ts +1 -0
- package/dist/indicators/ichimoku.d.ts +8 -0
- package/dist/indicators/index.d.ts +31 -0
- package/dist/indicators/keltner.d.ts +6 -0
- package/dist/indicators/linear-regression.d.ts +1 -0
- package/dist/indicators/macd.d.ts +6 -0
- package/dist/indicators/mfi.d.ts +1 -0
- package/dist/indicators/obv.d.ts +1 -0
- package/dist/indicators/parabolic-sar.d.ts +1 -0
- package/dist/indicators/pivot-points.d.ts +10 -0
- package/dist/indicators/roc.d.ts +1 -0
- package/dist/indicators/rsi.d.ts +1 -0
- package/dist/indicators/sma.d.ts +1 -0
- package/dist/indicators/stochastic.d.ts +5 -0
- package/dist/indicators/supertrend.d.ts +5 -0
- package/dist/indicators/trix.d.ts +5 -0
- package/dist/indicators/utils.d.ts +20 -0
- package/dist/indicators/volume-profile.d.ts +37 -0
- package/dist/indicators/volume.d.ts +1 -0
- package/dist/indicators/vwap.d.ts +1 -0
- package/dist/indicators/vwma.d.ts +1 -0
- package/dist/indicators/williams-r.d.ts +1 -0
- package/dist/interactions/axis-drag.d.ts +24 -0
- package/dist/interactions/context-menu-handler.d.ts +42 -0
- package/dist/interactions/crosshair.d.ts +20 -0
- package/dist/interactions/drawing-handler.d.ts +39 -0
- package/dist/interactions/event-router.d.ts +37 -0
- package/dist/interactions/keyboard-nav.d.ts +11 -0
- package/dist/interactions/pan-zoom.d.ts +39 -0
- package/dist/interactions/range-selection.d.ts +103 -0
- package/dist/interactions/touch-gestures.d.ts +36 -0
- package/dist/logo.svg +40 -0
- package/dist/market/exchange-map.d.ts +3 -0
- package/dist/market/index.d.ts +4 -0
- package/dist/market/market-calendar.d.ts +4 -0
- package/dist/market/market-definition.d.ts +22 -0
- package/dist/mockServiceWorker.js +349 -0
- package/dist/renderers/area.d.ts +17 -0
- package/dist/renderers/bar-ohlc.d.ts +17 -0
- package/dist/renderers/baseline-delta-mountain.d.ts +22 -0
- package/dist/renderers/baseline.d.ts +19 -0
- package/dist/renderers/candlestick.d.ts +21 -0
- package/dist/renderers/canvas-renderer.d.ts +28 -0
- package/dist/renderers/colored-line.d.ts +15 -0
- package/dist/renderers/colored-mountain.d.ts +18 -0
- package/dist/renderers/column.d.ts +14 -0
- package/dist/renderers/high-low.d.ts +14 -0
- package/dist/renderers/histogram.d.ts +16 -0
- package/dist/renderers/hlc-area.d.ts +16 -0
- package/dist/renderers/hollow-candle.d.ts +18 -0
- package/dist/renderers/kagi.d.ts +22 -0
- package/dist/renderers/line-break.d.ts +20 -0
- package/dist/renderers/line.d.ts +17 -0
- package/dist/renderers/point-figure.d.ts +20 -0
- package/dist/renderers/renderer.d.ts +59 -0
- package/dist/renderers/renko.d.ts +24 -0
- package/dist/renderers/step-line.d.ts +14 -0
- package/dist/renderers/text-cache.d.ts +23 -0
- package/dist/renderers/volume-candle.d.ts +20 -0
- package/dist/renderers/webgl/area-webgl.d.ts +28 -0
- package/dist/renderers/webgl/candlestick-webgl.d.ts +30 -0
- package/dist/renderers/webgl/index.d.ts +7 -0
- package/dist/renderers/webgl/line-webgl.d.ts +23 -0
- package/dist/renderers/webgl/webgl-utils.d.ts +23 -0
- package/dist/timezone/index.d.ts +2 -0
- package/dist/timezone/timezone.d.ts +12 -0
- package/dist/transforms/aggregate.d.ts +2 -0
- package/dist/transforms/heikin-ashi.d.ts +2 -0
- package/dist/transforms/index.d.ts +2 -0
- package/dist/ui/context-menu.d.ts +14 -0
- package/dist/ui/hud.d.ts +43 -0
- package/dist/ui/settings-popup.d.ts +15 -0
- package/package.json +129 -0
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="public/logo.svg" alt="fin-charter" width="128" height="128" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">fin-charter</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">Ultra-fast, tree-shakeable financial charting library for the browser.</p>
|
|
8
|
+
|
|
9
|
+
**[Live Storybook Documentation & Examples](https://itssumitrai.github.io/fin-charter/)**
|
|
10
|
+
|
|
11
|
+
## Key Features
|
|
12
|
+
|
|
13
|
+
- **Ultra-fast canvas rendering** — direct 2D canvas drawing, no virtual DOM
|
|
14
|
+
- **Tiny bundle** — core is under 15 KB gzipped; unused chart types tree-shake away
|
|
15
|
+
- **Tree-shakeable** — `"sideEffects": false` ES module package
|
|
16
|
+
- **8 chart types** — Candlestick, Line, Area, Bar (OHLC), Baseline, Hollow Candle, Histogram, Heikin-Ashi
|
|
17
|
+
- **30 built-in indicators** — SMA, EMA, Bollinger Bands, RSI, MACD, VWAP, Stochastic, ATR, ADX, OBV, Williams %R, Volume, Ichimoku Cloud, Parabolic SAR, Keltner Channel, Donchian Channel, CCI, Pivot Points, Aroon, Awesome Oscillator, Chaikin MF, Coppock, Elder Force, TRIX, Supertrend, VWMA, Choppiness, MFI, ROC, Linear Regression
|
|
18
|
+
- **Chart-managed indicators** — `chart.addIndicator('rsi', { source: series })` with auto-compute and auto-pane creation
|
|
19
|
+
- **Multi-pane layout** — indicator panes with draggable dividers and independent price scales
|
|
20
|
+
- **Interactive HUD** — series/indicator management with visibility toggle, settings editor, and remove
|
|
21
|
+
- **TV-style global HUD collapse** — chevron button collapses all indicator rows at once
|
|
22
|
+
- **Context menu** — right-click drawings for Edit/Duplicate/Remove/Z-order; right-click chart for Reset Zoom/Scroll to Latest; right-click indicator pane for Settings/Hide/Remove
|
|
23
|
+
- **TradingView-compatible plugin system** — `ISeriesPrimitive` / `IPanePrimitive` interfaces
|
|
24
|
+
- **Real-time data** — `series.update(bar)` appends or overwrites the last bar in O(1)
|
|
25
|
+
- **Drawing tools** — 16 built-in types (horizontal line, vertical line, trendline, fibonacci, rectangle, text, ray, arrow, channel, ellipse, pitchfork, fib projection, fib arc, fib fan, crossline, measurement); extensible via `registerDrawingType()`
|
|
26
|
+
- **Comparison mode** — normalise multiple series to percentage change for side-by-side performance comparison
|
|
27
|
+
- **Heikin-Ashi** — `chart.addHeikinAshiSeries()` with automatic OHLC-to-HA transform
|
|
28
|
+
- **Market sessions** — define pre/post-market windows with background highlights; filter bars by session
|
|
29
|
+
- **Chart state save/restore** — `exportState()` / `importState()` round-trips the full chart configuration
|
|
30
|
+
- **Data pagination** — `series.prependData()` + `barsInLogicalRange()` + `subscribeVisibleRangeChange()` for infinite-history scrolling
|
|
31
|
+
- **Event markers** — `series.setEvents()` places interactive earnings/dividend/news markers on bars
|
|
32
|
+
- **Periodicity model** — `setPeriodicity()` / `subscribePeriodicityChange()` for interval switching with data-reload hooks
|
|
33
|
+
- **OHLC aggregation** — `aggregateOHLC(store, intervalSec)` for client-side timeframe resampling
|
|
34
|
+
- **Screenshot export** — `chart.takeScreenshot()` composites all panes to a canvas
|
|
35
|
+
- **TypeScript-first** — full type definitions included
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install fin-charter
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { createChart } from 'fin-charter';
|
|
47
|
+
|
|
48
|
+
const chart = createChart(document.getElementById('chart')!, {
|
|
49
|
+
width: 800,
|
|
50
|
+
height: 400,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const series = chart.addSeries({ type: 'candlestick' });
|
|
54
|
+
|
|
55
|
+
series.setData([
|
|
56
|
+
{ time: 1700000000, open: 100, high: 110, low: 95, close: 107 },
|
|
57
|
+
{ time: 1700086400, open: 107, high: 115, low: 104, close: 112 },
|
|
58
|
+
{ time: 1700172800, open: 112, high: 118, low: 108, close: 109 },
|
|
59
|
+
]);
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Chart Types
|
|
63
|
+
|
|
64
|
+
| Type | Method | Description |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| Candlestick | `addSeries({ type: 'candlestick' })` | OHLC candles with filled body and wick |
|
|
67
|
+
| Line | `addSeries({ type: 'line' })` | Close-price polyline |
|
|
68
|
+
| Area | `addSeries({ type: 'area' })` | Close-price line with gradient fill below |
|
|
69
|
+
| Bar (OHLC) | `addSeries({ type: 'bar' })` | Traditional OHLC tick bars |
|
|
70
|
+
| Baseline | `addSeries({ type: 'baseline' })` | Two-color fill above/below a base price |
|
|
71
|
+
| Hollow Candle | `addSeries({ type: 'hollow-candle' })` | Up candles hollow (outline only), down candles filled |
|
|
72
|
+
| Histogram | `addSeries({ type: 'histogram' })` | Vertical bars from the bottom; useful for volume |
|
|
73
|
+
| Heikin-Ashi | `addSeries({ type: 'heikin-ashi' })` | Smoothed OHLC candles with automatic HA transform |
|
|
74
|
+
|
|
75
|
+
> **Note:** The individual `addCandlestickSeries()`, `addLineSeries()`, etc. methods still work but are deprecated. Prefer the unified `addSeries({ type })` API.
|
|
76
|
+
|
|
77
|
+
## Bundle Size (measured)
|
|
78
|
+
|
|
79
|
+
| Entry point | Size (gzip) |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `fin-charter` (core, main chunk) | ~13.8 KB |
|
|
82
|
+
| Full bundle (all chart types + indicators) | ~35.9 KB |
|
|
83
|
+
|
|
84
|
+
## Documentation
|
|
85
|
+
|
|
86
|
+
- [Getting Started](docs/getting-started.md)
|
|
87
|
+
- [API Reference](docs/api-reference.md)
|
|
88
|
+
- [Indicators](docs/indicators.md)
|
|
89
|
+
- [Drawing Tools](docs/drawings.md)
|
|
90
|
+
- [Data Integration](docs/data-integration.md)
|
|
91
|
+
- [Plugins](docs/plugins.md)
|
|
92
|
+
- [Performance](docs/performance.md)
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Bar, DeepPartial, SeriesType, ISeriesPrimitive } from '../core/types';
|
|
2
|
+
import { TimeScale } from '../core/time-scale';
|
|
3
|
+
import { PriceScale } from '../core/price-scale';
|
|
4
|
+
import { CrosshairState } from '../core/crosshair';
|
|
5
|
+
import { ChartState } from '../core/chart-state';
|
|
6
|
+
import { AnchorPoint, DrawingOptions, SerializedDrawing, DrawingPrimitive } from '../drawings/index';
|
|
7
|
+
import { ISeriesApi } from './series-api';
|
|
8
|
+
import { IPaneApi } from './pane-api';
|
|
9
|
+
import { IIndicatorApi } from './indicator-api';
|
|
10
|
+
import { ChartOptions, PaneOptions, SeriesOptions, IndicatorType, IndicatorOptions } from './options';
|
|
11
|
+
import { Periodicity } from '../core/periodicity';
|
|
12
|
+
import { MarketSession } from '../core/market-session';
|
|
13
|
+
export type CrosshairMoveCallback = (state: CrosshairState | null) => void;
|
|
14
|
+
export type ClickCallback = (state: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
time: number;
|
|
18
|
+
price: number;
|
|
19
|
+
}) => void;
|
|
20
|
+
export type DblClickCallback = (state: {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
time: number;
|
|
24
|
+
price: number;
|
|
25
|
+
}) => void;
|
|
26
|
+
export type VisibleRangeChangeCallback = (range: {
|
|
27
|
+
from: number;
|
|
28
|
+
to: number;
|
|
29
|
+
} | null) => void;
|
|
30
|
+
export type DrawingEventType = 'created' | 'modified' | 'removed';
|
|
31
|
+
export type DrawingEventCallback = (event: {
|
|
32
|
+
type: DrawingEventType;
|
|
33
|
+
drawingId: string;
|
|
34
|
+
drawingType: string;
|
|
35
|
+
}) => void;
|
|
36
|
+
export type IndicatorEventType = 'added' | 'removed';
|
|
37
|
+
export type IndicatorEventCallback = (event: {
|
|
38
|
+
type: IndicatorEventType;
|
|
39
|
+
indicatorId: string;
|
|
40
|
+
indicatorType: string;
|
|
41
|
+
paneId: string;
|
|
42
|
+
}) => void;
|
|
43
|
+
export type ResizeCallback = (size: {
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
}) => void;
|
|
47
|
+
export type SymbolChangeCallback = (symbol: {
|
|
48
|
+
previous: string;
|
|
49
|
+
current: string;
|
|
50
|
+
}) => void;
|
|
51
|
+
export type ChartTypeChangeCallback = (chartType: {
|
|
52
|
+
seriesType: SeriesType;
|
|
53
|
+
}) => void;
|
|
54
|
+
export type PreferencesChangeCallback = (options: DeepPartial<ChartOptions>) => void;
|
|
55
|
+
export type LayoutChangeAction = 'pane-added' | 'pane-removed';
|
|
56
|
+
export type LayoutChangeCallback = (event: {
|
|
57
|
+
action: LayoutChangeAction;
|
|
58
|
+
paneId: string;
|
|
59
|
+
}) => void;
|
|
60
|
+
export interface IDrawingApi {
|
|
61
|
+
readonly id: string;
|
|
62
|
+
drawingType(): string;
|
|
63
|
+
points(): AnchorPoint[];
|
|
64
|
+
applyOptions(options: Partial<DrawingOptions>): void;
|
|
65
|
+
options(): DrawingOptions;
|
|
66
|
+
remove(): void;
|
|
67
|
+
}
|
|
68
|
+
export interface IChartApi {
|
|
69
|
+
/** Add a series using a unified options object with a `type` discriminator. */
|
|
70
|
+
addSeries(options: SeriesOptions): ISeriesApi<SeriesType>;
|
|
71
|
+
removeSeries(series: ISeriesApi<SeriesType>): void;
|
|
72
|
+
addPane(options?: PaneOptions): IPaneApi;
|
|
73
|
+
removePane(pane: IPaneApi): void;
|
|
74
|
+
timeScale(): TimeScale;
|
|
75
|
+
priceScale(id?: string): PriceScale;
|
|
76
|
+
applyOptions(options: DeepPartial<ChartOptions>): void;
|
|
77
|
+
options(): ChartOptions;
|
|
78
|
+
resize(width: number, height: number): void;
|
|
79
|
+
remove(): void;
|
|
80
|
+
subscribeCrosshairMove(callback: CrosshairMoveCallback): void;
|
|
81
|
+
unsubscribeCrosshairMove(callback: CrosshairMoveCallback): void;
|
|
82
|
+
subscribeClick(callback: ClickCallback): void;
|
|
83
|
+
unsubscribeClick(callback: ClickCallback): void;
|
|
84
|
+
/** Set the visible time range by Unix timestamps (seconds). Adjusts barSpacing and rightOffset. */
|
|
85
|
+
setVisibleRange(from: number, to: number): void;
|
|
86
|
+
/** Set the visible range by bar indices directly. */
|
|
87
|
+
setVisibleLogicalRange(from: number, to: number): void;
|
|
88
|
+
/** Reset the view so the latest bar is at the right edge. */
|
|
89
|
+
scrollToRealTime(): void;
|
|
90
|
+
subscribeVisibleRangeChange(callback: VisibleRangeChangeCallback): void;
|
|
91
|
+
unsubscribeVisibleRangeChange(callback: VisibleRangeChangeCallback): void;
|
|
92
|
+
fitContent(): void;
|
|
93
|
+
takeScreenshot(): HTMLCanvasElement;
|
|
94
|
+
addIndicator(type: IndicatorType, options: IndicatorOptions): IIndicatorApi;
|
|
95
|
+
removeIndicator(indicator: IIndicatorApi): void;
|
|
96
|
+
/** Enable/disable comparison mode. When on, the Y-axis shows percentage change from the first visible bar. */
|
|
97
|
+
setComparisonMode(enabled: boolean): void;
|
|
98
|
+
isComparisonMode(): boolean;
|
|
99
|
+
addDrawing(type: string, points: AnchorPoint[], options?: DrawingOptions): IDrawingApi;
|
|
100
|
+
removeDrawing(drawing: IDrawingApi): void;
|
|
101
|
+
getDrawings(): IDrawingApi[];
|
|
102
|
+
setActiveDrawingTool(type: string | null): void;
|
|
103
|
+
registerDrawingType(type: string, factory: (id: string, points: AnchorPoint[], options: DrawingOptions) => ISeriesPrimitive & DrawingPrimitive): void;
|
|
104
|
+
serializeDrawings(): SerializedDrawing[];
|
|
105
|
+
deserializeDrawings(data: SerializedDrawing[]): void;
|
|
106
|
+
/** Export the current chart configuration (no bar data) as a serializable state object. */
|
|
107
|
+
exportState(): ChartState;
|
|
108
|
+
/** Restore a previously exported chart state, loading bar data via the provided loader. */
|
|
109
|
+
importState(state: ChartState, dataLoader: (seriesId: string) => Promise<Bar[]>): Promise<void>;
|
|
110
|
+
setPeriodicity(periodicity: Periodicity): void;
|
|
111
|
+
getPeriodicity(): Periodicity;
|
|
112
|
+
subscribePeriodicityChange(handler: (p: Periodicity) => void): void;
|
|
113
|
+
unsubscribePeriodicityChange(handler: (p: Periodicity) => void): void;
|
|
114
|
+
subscribeDblClick(callback: DblClickCallback): void;
|
|
115
|
+
unsubscribeDblClick(callback: DblClickCallback): void;
|
|
116
|
+
subscribeDrawingEvent(callback: DrawingEventCallback): void;
|
|
117
|
+
unsubscribeDrawingEvent(callback: DrawingEventCallback): void;
|
|
118
|
+
subscribeIndicatorEvent(callback: IndicatorEventCallback): void;
|
|
119
|
+
unsubscribeIndicatorEvent(callback: IndicatorEventCallback): void;
|
|
120
|
+
subscribeResize(callback: ResizeCallback): void;
|
|
121
|
+
unsubscribeResize(callback: ResizeCallback): void;
|
|
122
|
+
subscribeSymbolChange(callback: SymbolChangeCallback): void;
|
|
123
|
+
unsubscribeSymbolChange(callback: SymbolChangeCallback): void;
|
|
124
|
+
subscribeChartTypeChange(callback: ChartTypeChangeCallback): void;
|
|
125
|
+
unsubscribeChartTypeChange(callback: ChartTypeChangeCallback): void;
|
|
126
|
+
subscribePreferencesChange(callback: PreferencesChangeCallback): void;
|
|
127
|
+
unsubscribePreferencesChange(callback: PreferencesChangeCallback): void;
|
|
128
|
+
subscribeLayoutChange(callback: LayoutChangeCallback): void;
|
|
129
|
+
unsubscribeLayoutChange(callback: LayoutChangeCallback): void;
|
|
130
|
+
setMarketSessions(sessions: MarketSession[]): void;
|
|
131
|
+
getMarketSessions(): MarketSession[];
|
|
132
|
+
setSessionFilter(filter: 'regular' | 'extended' | 'all'): void;
|
|
133
|
+
getSessionFilter(): string;
|
|
134
|
+
/** Export visible OHLCV data (and optionally indicator values) as a CSV string. */
|
|
135
|
+
exportCSV(options?: import('./export').CSVExportOptions): string;
|
|
136
|
+
/** Export the current chart view as an SVG string (PNG image embedded in SVG wrapper). */
|
|
137
|
+
exportSVG(): string;
|
|
138
|
+
/** Export the current chart view as a PDF Blob. */
|
|
139
|
+
exportPDF(options?: import('./export').PDFExportOptions): Blob;
|
|
140
|
+
/** Undo the last drawing/chart modification. */
|
|
141
|
+
undo(): boolean;
|
|
142
|
+
/** Redo the last undone modification. */
|
|
143
|
+
redo(): boolean;
|
|
144
|
+
/** Whether undo is available. */
|
|
145
|
+
canUndo(): boolean;
|
|
146
|
+
/** Whether redo is available. */
|
|
147
|
+
canRedo(): boolean;
|
|
148
|
+
/** Activate the range selection mode (drag to highlight a time range). */
|
|
149
|
+
setRangeSelectionActive(active: boolean): void;
|
|
150
|
+
/** Subscribe to range selection results. */
|
|
151
|
+
onRangeSelected(callback: import('../interactions/range-selection').RangeSelectionCallback): void;
|
|
152
|
+
/** Unsubscribe from range selection results. */
|
|
153
|
+
offRangeSelected(callback: import('../interactions/range-selection').RangeSelectionCallback): void;
|
|
154
|
+
/** Activate the measure tool (click two points to see stats). */
|
|
155
|
+
setMeasureActive(active: boolean): void;
|
|
156
|
+
/** Subscribe to measure results. */
|
|
157
|
+
onMeasure(callback: import('../interactions/range-selection').MeasureCallback): void;
|
|
158
|
+
/** Unsubscribe from measure results. */
|
|
159
|
+
offMeasure(callback: import('../interactions/range-selection').MeasureCallback): void;
|
|
160
|
+
/** Add an alert line at the given price level. */
|
|
161
|
+
addAlertLine(price: number, options?: Partial<import('../core/alert-line').AlertLineOptions>): import('../core/alert-line').AlertLine;
|
|
162
|
+
/** Remove an alert line. */
|
|
163
|
+
removeAlertLine(alert: import('../core/alert-line').AlertLine): void;
|
|
164
|
+
/** Get all alert lines. */
|
|
165
|
+
getAlertLines(): import('../core/alert-line').AlertLine[];
|
|
166
|
+
/** Add a text label anchored to a bar index and price. Use DataLayer.findIndex(timestamp) to convert a timestamp to a bar index. */
|
|
167
|
+
addTextLabel(barIndex: number, price: number, text: string, options?: Partial<import('../core/text-label').TextLabelOptions>): import('../core/text-label').TextLabel;
|
|
168
|
+
/** Remove a text label. */
|
|
169
|
+
removeTextLabel(label: import('../core/text-label').TextLabel): void;
|
|
170
|
+
/** Get all text labels. */
|
|
171
|
+
getTextLabels(): import('../core/text-label').TextLabel[];
|
|
172
|
+
}
|
|
173
|
+
export declare function createChart(container: HTMLElement, options?: DeepPartial<ChartOptions>): IChartApi;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ColumnStore, VisibleRange } from '../core/types';
|
|
2
|
+
export interface CSVExportOptions {
|
|
3
|
+
/** Include only bars within this date range (Unix timestamps in seconds). */
|
|
4
|
+
from?: number;
|
|
5
|
+
/** Include only bars within this date range (Unix timestamps in seconds). */
|
|
6
|
+
to?: number;
|
|
7
|
+
/** Column separator (default: ','). */
|
|
8
|
+
separator?: string;
|
|
9
|
+
/** Include indicator columns. */
|
|
10
|
+
includeIndicators?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SeriesInfo {
|
|
13
|
+
label: string;
|
|
14
|
+
store: ColumnStore;
|
|
15
|
+
}
|
|
16
|
+
export interface IndicatorInfo {
|
|
17
|
+
label: string;
|
|
18
|
+
/** Map of output name -> Float64Array values aligned with source series. */
|
|
19
|
+
outputs: Map<string, Float64Array>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Export visible OHLCV data as a CSV string.
|
|
23
|
+
*/
|
|
24
|
+
export declare function exportCSV(series: SeriesInfo[], indicators: IndicatorInfo[], range: VisibleRange | null, options?: CSVExportOptions): string;
|
|
25
|
+
/**
|
|
26
|
+
* Generate an SVG string from a screenshot canvas.
|
|
27
|
+
* The canvas pixel data is embedded as a base64 PNG <image> element within
|
|
28
|
+
* an SVG wrapper, preserving the exact chart appearance including themes
|
|
29
|
+
* and annotations.
|
|
30
|
+
*/
|
|
31
|
+
export declare function exportSVG(screenshotCanvas: HTMLCanvasElement): string;
|
|
32
|
+
export interface PDFExportOptions {
|
|
33
|
+
/** Paper size (default: 'letter'). */
|
|
34
|
+
pageSize?: 'letter' | 'a4';
|
|
35
|
+
/** Page orientation (default: 'landscape'). */
|
|
36
|
+
orientation?: 'portrait' | 'landscape';
|
|
37
|
+
/** Optional title text at top of page. */
|
|
38
|
+
title?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Generate a minimal PDF document containing the chart image.
|
|
42
|
+
*
|
|
43
|
+
* Uses a minimal PDF 1.4 generator (no external dependencies) that embeds
|
|
44
|
+
* the chart as a JPEG image stream.
|
|
45
|
+
*/
|
|
46
|
+
export declare function exportPDF(screenshotCanvas: HTMLCanvasElement, options?: PDFExportOptions): Blob;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SeriesType } from '../core/types';
|
|
2
|
+
import { ISeriesApi } from './series-api';
|
|
3
|
+
import { IndicatorType, IndicatorOptions } from './options';
|
|
4
|
+
export interface IIndicatorApi {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
indicatorType(): IndicatorType;
|
|
7
|
+
applyOptions(options: Partial<IndicatorOptions>): void;
|
|
8
|
+
options(): IndicatorOptions;
|
|
9
|
+
paneId(): string;
|
|
10
|
+
isVisible(): boolean;
|
|
11
|
+
remove(): void;
|
|
12
|
+
label(): string;
|
|
13
|
+
}
|
|
14
|
+
export declare class IndicatorApi implements IIndicatorApi {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
private _type;
|
|
17
|
+
private _options;
|
|
18
|
+
private _paneId;
|
|
19
|
+
private _visible;
|
|
20
|
+
private _label;
|
|
21
|
+
/** The line/histogram series created internally for this indicator. */
|
|
22
|
+
internalSeries: ISeriesApi<SeriesType>[];
|
|
23
|
+
/** If we auto-created a pane for this indicator, track it for cleanup. */
|
|
24
|
+
autoCreatedPaneId: string | null;
|
|
25
|
+
/** Called by remove() to clean up via ChartApi. */
|
|
26
|
+
_removeCallback: () => void;
|
|
27
|
+
/** Subscription callback for source dataChanged, stored for unsubscribe. */
|
|
28
|
+
_dataChangedCallback: (() => void) | null;
|
|
29
|
+
constructor(id: string, type: IndicatorType, options: IndicatorOptions, paneId: string, removeCallback: () => void);
|
|
30
|
+
indicatorType(): IndicatorType;
|
|
31
|
+
applyOptions(options: Partial<IndicatorOptions>): void;
|
|
32
|
+
options(): IndicatorOptions;
|
|
33
|
+
paneId(): string;
|
|
34
|
+
isVisible(): boolean;
|
|
35
|
+
remove(): void;
|
|
36
|
+
label(): string;
|
|
37
|
+
private _autoLabel;
|
|
38
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { Bar, ColumnData, DeepPartial } from '../core/types';
|
|
2
|
+
import { CandlestickRendererOptions } from '../renderers/candlestick';
|
|
3
|
+
import { LineRendererOptions } from '../renderers/line';
|
|
4
|
+
import { AreaRendererOptions } from '../renderers/area';
|
|
5
|
+
import { BarOHLCRendererOptions } from '../renderers/bar-ohlc';
|
|
6
|
+
import { BaselineRendererOptions } from '../renderers/baseline';
|
|
7
|
+
import { HollowCandleRendererOptions } from '../renderers/hollow-candle';
|
|
8
|
+
import { HistogramRendererOptions } from '../renderers/histogram';
|
|
9
|
+
import { StepLineRendererOptions } from '../renderers/step-line';
|
|
10
|
+
import { ColoredLineRendererOptions } from '../renderers/colored-line';
|
|
11
|
+
import { ColoredMountainRendererOptions } from '../renderers/colored-mountain';
|
|
12
|
+
import { HLCAreaRendererOptions } from '../renderers/hlc-area';
|
|
13
|
+
import { HighLowRendererOptions } from '../renderers/high-low';
|
|
14
|
+
import { ColumnRendererOptions } from '../renderers/column';
|
|
15
|
+
import { VolumeCandleRendererOptions } from '../renderers/volume-candle';
|
|
16
|
+
import { BaselineDeltaMountainRendererOptions } from '../renderers/baseline-delta-mountain';
|
|
17
|
+
import { RenkoRendererOptions } from '../renderers/renko';
|
|
18
|
+
import { KagiRendererOptions } from '../renderers/kagi';
|
|
19
|
+
import { LineBreakRendererOptions } from '../renderers/line-break';
|
|
20
|
+
import { PointFigureRendererOptions } from '../renderers/point-figure';
|
|
21
|
+
export interface LayoutOptions {
|
|
22
|
+
backgroundColor: string;
|
|
23
|
+
textColor: string;
|
|
24
|
+
fontSize: number;
|
|
25
|
+
fontFamily: string;
|
|
26
|
+
}
|
|
27
|
+
export interface TimeScaleApiOptions {
|
|
28
|
+
barSpacing: number;
|
|
29
|
+
rightOffset: number;
|
|
30
|
+
minBarSpacing: number;
|
|
31
|
+
maxBarSpacing: number;
|
|
32
|
+
tickMarkFormatter?: (time: number, tickType: 'year' | 'month' | 'day' | 'time') => string;
|
|
33
|
+
}
|
|
34
|
+
export interface CrosshairOptions {
|
|
35
|
+
vertLineColor: string;
|
|
36
|
+
vertLineWidth: number;
|
|
37
|
+
vertLineDash: number[];
|
|
38
|
+
horzLineColor: string;
|
|
39
|
+
horzLineWidth: number;
|
|
40
|
+
horzLineDash: number[];
|
|
41
|
+
}
|
|
42
|
+
export interface GridOptions {
|
|
43
|
+
vertLinesVisible: boolean;
|
|
44
|
+
vertLinesColor: string;
|
|
45
|
+
horzLinesVisible: boolean;
|
|
46
|
+
horzLinesColor: string;
|
|
47
|
+
}
|
|
48
|
+
export interface LastPriceLineOptions {
|
|
49
|
+
visible: boolean;
|
|
50
|
+
}
|
|
51
|
+
export interface TooltipOptions {
|
|
52
|
+
enabled: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface WatermarkOptions {
|
|
55
|
+
visible: boolean;
|
|
56
|
+
text: string;
|
|
57
|
+
color: string;
|
|
58
|
+
fontSize: number;
|
|
59
|
+
horzAlign: 'left' | 'center' | 'right';
|
|
60
|
+
vertAlign: 'top' | 'center' | 'bottom';
|
|
61
|
+
}
|
|
62
|
+
export interface VolumeOverlayOptions {
|
|
63
|
+
visible: boolean;
|
|
64
|
+
upColor: string;
|
|
65
|
+
downColor: string;
|
|
66
|
+
scaleMarginTop: number;
|
|
67
|
+
}
|
|
68
|
+
export interface PriceScaleOptions {
|
|
69
|
+
visible: boolean;
|
|
70
|
+
/** Scale mode: 'linear' (default) or 'logarithmic'. */
|
|
71
|
+
mode?: import('../core/price-scale').PriceScaleMode;
|
|
72
|
+
}
|
|
73
|
+
export interface TimeGapsOptions {
|
|
74
|
+
visible: boolean;
|
|
75
|
+
}
|
|
76
|
+
export type RendererType = 'canvas2d' | 'webgl';
|
|
77
|
+
export interface ChartOptions {
|
|
78
|
+
symbol?: string;
|
|
79
|
+
width: number;
|
|
80
|
+
height: number;
|
|
81
|
+
autoSize: boolean;
|
|
82
|
+
layout: LayoutOptions;
|
|
83
|
+
timeScale: TimeScaleApiOptions;
|
|
84
|
+
crosshair: CrosshairOptions;
|
|
85
|
+
grid: GridOptions;
|
|
86
|
+
lastPriceLine: LastPriceLineOptions;
|
|
87
|
+
tooltip: TooltipOptions;
|
|
88
|
+
watermark: WatermarkOptions;
|
|
89
|
+
volume: VolumeOverlayOptions;
|
|
90
|
+
rightPriceScale: PriceScaleOptions;
|
|
91
|
+
leftPriceScale: PriceScaleOptions;
|
|
92
|
+
timeGaps: TimeGapsOptions;
|
|
93
|
+
priceFormatter?: (price: number) => string;
|
|
94
|
+
theme?: 'dark' | 'light' | 'colorful';
|
|
95
|
+
locale?: string;
|
|
96
|
+
timezone?: string;
|
|
97
|
+
currency?: string;
|
|
98
|
+
/** Text direction: 'ltr' (default) or 'rtl'. Set to 'auto' to detect from locale. */
|
|
99
|
+
direction?: import('../core/rtl').TextDirection | 'auto';
|
|
100
|
+
/**
|
|
101
|
+
* Rendering backend. `'webgl'` uses WebGL2 for supported series types
|
|
102
|
+
* (candlestick, line, area) and falls back to Canvas 2D for the rest.
|
|
103
|
+
* Automatically falls back to `'canvas2d'` when WebGL is unavailable.
|
|
104
|
+
*
|
|
105
|
+
* **Note:** Only honored at chart creation time; cannot be changed via
|
|
106
|
+
* `applyOptions()` after the chart is created.
|
|
107
|
+
*/
|
|
108
|
+
renderer?: RendererType;
|
|
109
|
+
}
|
|
110
|
+
export declare const DARK_THEME: DeepPartial<ChartOptions>;
|
|
111
|
+
export declare const COLORFUL_THEME: DeepPartial<ChartOptions>;
|
|
112
|
+
export declare const LIGHT_THEME: DeepPartial<ChartOptions>;
|
|
113
|
+
export declare const DEFAULT_CHART_OPTIONS: ChartOptions;
|
|
114
|
+
export interface BaseSeriesOptions {
|
|
115
|
+
data?: Bar[] | ColumnData;
|
|
116
|
+
priceScaleId?: string;
|
|
117
|
+
visible?: boolean;
|
|
118
|
+
paneId?: string;
|
|
119
|
+
label?: string;
|
|
120
|
+
}
|
|
121
|
+
export type CandlestickSeriesOptions = BaseSeriesOptions & Partial<CandlestickRendererOptions>;
|
|
122
|
+
export type LineSeriesOptions = BaseSeriesOptions & Partial<LineRendererOptions>;
|
|
123
|
+
export type AreaSeriesOptions = BaseSeriesOptions & Partial<AreaRendererOptions>;
|
|
124
|
+
export type BarSeriesOptions = BaseSeriesOptions & Partial<BarOHLCRendererOptions>;
|
|
125
|
+
export type BaselineSeriesOptions = BaseSeriesOptions & Partial<BaselineRendererOptions>;
|
|
126
|
+
export type HollowCandleSeriesOptions = BaseSeriesOptions & Partial<HollowCandleRendererOptions>;
|
|
127
|
+
export type HistogramSeriesOptions = BaseSeriesOptions & Partial<HistogramRendererOptions>;
|
|
128
|
+
export type StepLineSeriesOptions = BaseSeriesOptions & Partial<StepLineRendererOptions>;
|
|
129
|
+
export type ColoredLineSeriesOptions = BaseSeriesOptions & Partial<ColoredLineRendererOptions>;
|
|
130
|
+
export type ColoredMountainSeriesOptions = BaseSeriesOptions & Partial<ColoredMountainRendererOptions>;
|
|
131
|
+
export type HLCAreaSeriesOptions = BaseSeriesOptions & Partial<HLCAreaRendererOptions>;
|
|
132
|
+
export type HighLowSeriesOptions = BaseSeriesOptions & Partial<HighLowRendererOptions>;
|
|
133
|
+
export type ColumnSeriesOptions = BaseSeriesOptions & Partial<ColumnRendererOptions>;
|
|
134
|
+
export type VolumeCandleSeriesOptions = BaseSeriesOptions & Partial<VolumeCandleRendererOptions>;
|
|
135
|
+
export type BaselineDeltaMountainSeriesOptions = BaseSeriesOptions & Partial<BaselineDeltaMountainRendererOptions>;
|
|
136
|
+
export type RenkoSeriesOptions = BaseSeriesOptions & Partial<RenkoRendererOptions>;
|
|
137
|
+
export type KagiSeriesOptions = BaseSeriesOptions & Partial<KagiRendererOptions>;
|
|
138
|
+
export type LineBreakSeriesOptions = BaseSeriesOptions & Partial<LineBreakRendererOptions>;
|
|
139
|
+
export type PointFigureSeriesOptions = BaseSeriesOptions & Partial<PointFigureRendererOptions>;
|
|
140
|
+
export interface PaneOptions {
|
|
141
|
+
height?: number;
|
|
142
|
+
}
|
|
143
|
+
export interface SeriesOptionsMap {
|
|
144
|
+
candlestick: CandlestickSeriesOptions;
|
|
145
|
+
bar: BarSeriesOptions;
|
|
146
|
+
line: LineSeriesOptions;
|
|
147
|
+
area: AreaSeriesOptions;
|
|
148
|
+
histogram: HistogramSeriesOptions;
|
|
149
|
+
baseline: BaselineSeriesOptions;
|
|
150
|
+
'hollow-candle': HollowCandleSeriesOptions;
|
|
151
|
+
'heikin-ashi': CandlestickSeriesOptions;
|
|
152
|
+
'step-line': StepLineSeriesOptions;
|
|
153
|
+
'colored-line': ColoredLineSeriesOptions;
|
|
154
|
+
'colored-mountain': ColoredMountainSeriesOptions;
|
|
155
|
+
'hlc-area': HLCAreaSeriesOptions;
|
|
156
|
+
'high-low': HighLowSeriesOptions;
|
|
157
|
+
column: ColumnSeriesOptions;
|
|
158
|
+
'volume-candle': VolumeCandleSeriesOptions;
|
|
159
|
+
'baseline-delta-mountain': BaselineDeltaMountainSeriesOptions;
|
|
160
|
+
renko: RenkoSeriesOptions;
|
|
161
|
+
kagi: KagiSeriesOptions;
|
|
162
|
+
'line-break': LineBreakSeriesOptions;
|
|
163
|
+
'point-figure': PointFigureSeriesOptions;
|
|
164
|
+
}
|
|
165
|
+
/** Discriminated union for the unified addSeries() API. */
|
|
166
|
+
export type SeriesOptions = ({
|
|
167
|
+
type: 'candlestick';
|
|
168
|
+
} & Partial<CandlestickSeriesOptions>) | ({
|
|
169
|
+
type: 'line';
|
|
170
|
+
} & Partial<LineSeriesOptions>) | ({
|
|
171
|
+
type: 'area';
|
|
172
|
+
} & Partial<AreaSeriesOptions>) | ({
|
|
173
|
+
type: 'bar';
|
|
174
|
+
} & Partial<BarSeriesOptions>) | ({
|
|
175
|
+
type: 'baseline';
|
|
176
|
+
} & Partial<BaselineSeriesOptions>) | ({
|
|
177
|
+
type: 'hollow-candle';
|
|
178
|
+
} & Partial<HollowCandleSeriesOptions>) | ({
|
|
179
|
+
type: 'histogram';
|
|
180
|
+
} & Partial<HistogramSeriesOptions>) | ({
|
|
181
|
+
type: 'heikin-ashi';
|
|
182
|
+
} & Partial<CandlestickSeriesOptions>) | ({
|
|
183
|
+
type: 'step-line';
|
|
184
|
+
} & Partial<StepLineSeriesOptions>) | ({
|
|
185
|
+
type: 'colored-line';
|
|
186
|
+
} & Partial<ColoredLineSeriesOptions>) | ({
|
|
187
|
+
type: 'colored-mountain';
|
|
188
|
+
} & Partial<ColoredMountainSeriesOptions>) | ({
|
|
189
|
+
type: 'hlc-area';
|
|
190
|
+
} & Partial<HLCAreaSeriesOptions>) | ({
|
|
191
|
+
type: 'high-low';
|
|
192
|
+
} & Partial<HighLowSeriesOptions>) | ({
|
|
193
|
+
type: 'column';
|
|
194
|
+
} & Partial<ColumnSeriesOptions>) | ({
|
|
195
|
+
type: 'volume-candle';
|
|
196
|
+
} & Partial<VolumeCandleSeriesOptions>) | ({
|
|
197
|
+
type: 'baseline-delta-mountain';
|
|
198
|
+
} & Partial<BaselineDeltaMountainSeriesOptions>) | ({
|
|
199
|
+
type: 'renko';
|
|
200
|
+
} & Partial<RenkoSeriesOptions>) | ({
|
|
201
|
+
type: 'kagi';
|
|
202
|
+
} & Partial<KagiSeriesOptions>) | ({
|
|
203
|
+
type: 'line-break';
|
|
204
|
+
} & Partial<LineBreakSeriesOptions>) | ({
|
|
205
|
+
type: 'point-figure';
|
|
206
|
+
} & Partial<PointFigureSeriesOptions>);
|
|
207
|
+
export type IndicatorType = 'sma' | 'ema' | 'rsi' | 'macd' | 'bollinger' | 'vwap' | 'stochastic' | 'atr' | 'adx' | 'obv' | 'williams-r' | 'ichimoku' | 'parabolic-sar' | 'keltner' | 'donchian' | 'cci' | 'pivot-points' | 'aroon' | 'awesome-oscillator' | 'chaikin-mf' | 'coppock' | 'elder-force' | 'trix' | 'supertrend' | 'vwma' | 'choppiness' | 'mfi' | 'roc' | 'linear-regression';
|
|
208
|
+
export interface IndicatorOptions {
|
|
209
|
+
source: import('./series-api').ISeriesApi<import('../core/types').SeriesType>;
|
|
210
|
+
params?: Record<string, number>;
|
|
211
|
+
paneId?: string;
|
|
212
|
+
color?: string;
|
|
213
|
+
lineWidth?: number;
|
|
214
|
+
visible?: boolean;
|
|
215
|
+
label?: string;
|
|
216
|
+
/** Per-output color overrides, e.g. { upper: '#ff0', middle: '#0f0', lower: '#ff0' }. */
|
|
217
|
+
colors?: Record<string, string>;
|
|
218
|
+
/** Histogram up-bar color override (default: green). */
|
|
219
|
+
histogramUpColor?: string;
|
|
220
|
+
/** Histogram down-bar color override (default: red). */
|
|
221
|
+
histogramDownColor?: string;
|
|
222
|
+
}
|
|
223
|
+
export declare const OVERLAY_INDICATORS: Set<IndicatorType>;
|
|
224
|
+
export declare const DEFAULT_INDICATOR_PARAMS: Record<IndicatorType, Record<string, number>>;
|
|
225
|
+
/** Deep merge `overrides` into a copy of `defaults`. */
|
|
226
|
+
export declare function mergeOptions<T extends object>(defaults: T, overrides: DeepPartial<T>): T;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IPanePrimitive } from '../core/types';
|
|
2
|
+
import { Pane } from '../core/pane';
|
|
3
|
+
export interface IPaneApi {
|
|
4
|
+
/** Unique pane identifier. */
|
|
5
|
+
readonly id: string;
|
|
6
|
+
/** Set the pane height in CSS pixels. */
|
|
7
|
+
setHeight(height: number): void;
|
|
8
|
+
/** Get the pane height in CSS pixels. */
|
|
9
|
+
getHeight(): number;
|
|
10
|
+
/** Attach a pane primitive (plugin). */
|
|
11
|
+
attachPrimitive(primitive: IPanePrimitive): void;
|
|
12
|
+
/** Detach a pane primitive. */
|
|
13
|
+
detachPrimitive(primitive: IPanePrimitive): void;
|
|
14
|
+
}
|
|
15
|
+
export declare class PaneApi implements IPaneApi {
|
|
16
|
+
readonly id: string;
|
|
17
|
+
private _pane;
|
|
18
|
+
private _primitives;
|
|
19
|
+
private _requestRepaint;
|
|
20
|
+
constructor(id: string, pane: Pane, requestRepaint: () => void);
|
|
21
|
+
setHeight(height: number): void;
|
|
22
|
+
getHeight(): number;
|
|
23
|
+
/** Get the internal Pane instance. */
|
|
24
|
+
getPane(): Pane;
|
|
25
|
+
attachPrimitive(primitive: IPanePrimitive): void;
|
|
26
|
+
detachPrimitive(primitive: IPanePrimitive): void;
|
|
27
|
+
getPrimitives(): readonly IPanePrimitive[];
|
|
28
|
+
}
|