katucharts.js 0.2.1
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/LICENSE +106 -0
- package/README.md +1100 -0
- package/dist/__vite-optional-peer-dep_jspdf_katucharts-BDMct_Gn.js +4 -0
- package/dist/accessibility/A11yModule.d.ts +26 -0
- package/dist/axis/Axis.d.ts +140 -0
- package/dist/axis/AxisCoordinator.d.ts +38 -0
- package/dist/bio.d.ts +22 -0
- package/dist/components/Credits.d.ts +38 -0
- package/dist/components/Crosshair.d.ts +15 -0
- package/dist/components/DataLabels.d.ts +7 -0
- package/dist/components/ExportButton.d.ts +27 -0
- package/dist/components/Legend.d.ts +53 -0
- package/dist/components/TitleRenderer.d.ts +19 -0
- package/dist/components/Tooltip.d.ts +61 -0
- package/dist/core/Chart.d.ts +156 -0
- package/dist/core/EventBus.d.ts +14 -0
- package/dist/core/InteractionController.d.ts +62 -0
- package/dist/core/OptionsParser.d.ts +61 -0
- package/dist/core/Registry.d.ts +27 -0
- package/dist/core/SVGRenderer.d.ts +48 -0
- package/dist/core/ScrollablePlotOverlay.d.ts +31 -0
- package/dist/core/StackComputer.d.ts +25 -0
- package/dist/core/StateManager.d.ts +21 -0
- package/dist/core/UpdateScheduler.d.ts +28 -0
- package/dist/core/animationConstants.d.ts +20 -0
- package/dist/core/chartTypes.d.ts +46 -0
- package/dist/core/registerAll.d.ts +4 -0
- package/dist/core/registerBio.d.ts +4 -0
- package/dist/core/registerCore.d.ts +4 -0
- package/dist/core/registerFinance.d.ts +4 -0
- package/dist/core/registerFinancial.d.ts +4 -0
- package/dist/core/registerFlow.d.ts +4 -0
- package/dist/core/registerGeneral.d.ts +4 -0
- package/dist/datatable/DataTable.d.ts +162 -0
- package/dist/datatable/DataTableDefaults.d.ts +7 -0
- package/dist/datatable/api/TableApi.d.ts +35 -0
- package/dist/datatable/columns/ColumnDef.d.ts +16 -0
- package/dist/datatable/columns/ColumnManager.d.ts +31 -0
- package/dist/datatable/data/DataProcessor.d.ts +46 -0
- package/dist/datatable/data/DataSource.d.ts +26 -0
- package/dist/datatable/editing/CellEditor.d.ts +29 -0
- package/dist/datatable/export/TableExport.d.ts +23 -0
- package/dist/datatable/locales/en.d.ts +9 -0
- package/dist/datatable/locales/es.d.ts +6 -0
- package/dist/datatable/locales/index.d.ts +22 -0
- package/dist/datatable/locales/pt-BR.d.ts +6 -0
- package/dist/datatable/locales/resolveLocale.d.ts +16 -0
- package/dist/datatable/locales/zh.d.ts +6 -0
- package/dist/datatable/render/CellRenderer.d.ts +24 -0
- package/dist/datatable/render/HeaderRenderer.d.ts +51 -0
- package/dist/datatable/render/PaginationRenderer.d.ts +26 -0
- package/dist/datatable/render/SearchRenderer.d.ts +21 -0
- package/dist/datatable/render/TableRenderer.d.ts +81 -0
- package/dist/datatable/render/ToolbarRenderer.d.ts +34 -0
- package/dist/datatable/render/icons.d.ts +24 -0
- package/dist/datatable/render/popover.d.ts +15 -0
- package/dist/datatable/selection/SelectionManager.d.ts +29 -0
- package/dist/datatable/themes/TableTheme.d.ts +36 -0
- package/dist/datatable/themes/styleSheet.d.ts +16 -0
- package/dist/datatable.d.ts +19 -0
- package/dist/export/ChartExporter.d.ts +50 -0
- package/dist/export/Export.d.ts +76 -0
- package/dist/finance.d.ts +49 -0
- package/dist/index.d.ts +67 -0
- package/dist/indicators/Indicator.d.ts +23 -0
- package/dist/indicators/expandIndicators.d.ts +18 -0
- package/dist/indicators/moving-averages/DEMA.d.ts +10 -0
- package/dist/indicators/moving-averages/EMA.d.ts +12 -0
- package/dist/indicators/moving-averages/SMA.d.ts +11 -0
- package/dist/indicators/moving-averages/TEMA.d.ts +10 -0
- package/dist/indicators/moving-averages/WMA.d.ts +12 -0
- package/dist/indicators/oscillators/CCI.d.ts +11 -0
- package/dist/indicators/oscillators/MACD.d.ts +20 -0
- package/dist/indicators/oscillators/Momentum.d.ts +10 -0
- package/dist/indicators/oscillators/ROC.d.ts +10 -0
- package/dist/indicators/oscillators/RSI.d.ts +11 -0
- package/dist/indicators/oscillators/Stochastic.d.ts +20 -0
- package/dist/indicators/registry.d.ts +9 -0
- package/dist/indicators/trend/ADX.d.ts +11 -0
- package/dist/indicators/trend/IchimokuCloud.d.ts +14 -0
- package/dist/indicators/trend/PSAR.d.ts +11 -0
- package/dist/indicators/util.d.ts +8 -0
- package/dist/indicators/volatility/ATR.d.ts +11 -0
- package/dist/indicators/volatility/BollingerBands.d.ts +11 -0
- package/dist/indicators/volume/OBV.d.ts +11 -0
- package/dist/indicators/volume/VBP.d.ts +12 -0
- package/dist/indicators/volume/VWAP.d.ts +12 -0
- package/dist/interaction/Drilldown.d.ts +29 -0
- package/dist/interaction/HoverManager.d.ts +47 -0
- package/dist/interaction/Zoom.d.ts +68 -0
- package/dist/katucharts-bio.es.js +5861 -0
- package/dist/katucharts-bio.umd.js +1 -0
- package/dist/katucharts-datatable.es.js +3363 -0
- package/dist/katucharts-datatable.umd.js +296 -0
- package/dist/katucharts-finance.es.js +4364 -0
- package/dist/katucharts-finance.umd.js +1 -0
- package/dist/katucharts-react.es.js +35 -0
- package/dist/katucharts-react.umd.js +1 -0
- package/dist/katucharts.es.js +20531 -0
- package/dist/katucharts.umd.js +9 -0
- package/dist/layout/LayoutEngine.d.ts +44 -0
- package/dist/license/LicenseManager.d.ts +63 -0
- package/dist/options/defaults.d.ts +5 -0
- package/dist/react/KatuChartsReact.d.ts +16 -0
- package/dist/react.d.ts +2 -0
- package/dist/responsive/ResponsiveEngine.d.ts +15 -0
- package/dist/series/BaseSeries.d.ts +186 -0
- package/dist/series/bioinformatics/CircosChart.d.ts +4 -0
- package/dist/series/bioinformatics/ClusteredHeatmapChart.d.ts +22 -0
- package/dist/series/bioinformatics/ForestPlotChart.d.ts +21 -0
- package/dist/series/bioinformatics/KaplanMeierChart.d.ts +22 -0
- package/dist/series/bioinformatics/ManhattanChart.d.ts +34 -0
- package/dist/series/bioinformatics/PCoAChart.d.ts +22 -0
- package/dist/series/bioinformatics/PhyloTreeChart.d.ts +27 -0
- package/dist/series/bioinformatics/SequenceLogoChart.d.ts +21 -0
- package/dist/series/bioinformatics/ViolinChart.d.ts +23 -0
- package/dist/series/bioinformatics/VolcanoChart.d.ts +28 -0
- package/dist/series/bioinformatics/circos/CircosChart.d.ts +20 -0
- package/dist/series/bioinformatics/circos/CircosColorScales.d.ts +6 -0
- package/dist/series/bioinformatics/circos/CircosComparativeChart.d.ts +41 -0
- package/dist/series/bioinformatics/circos/CircosHeatmapChart.d.ts +31 -0
- package/dist/series/bioinformatics/circos/CircosLayoutEngine.d.ts +37 -0
- package/dist/series/bioinformatics/circos/CircosRules.d.ts +6 -0
- package/dist/series/bioinformatics/circos/CircosSpiralChart.d.ts +39 -0
- package/dist/series/bioinformatics/circos/CircosTypes.d.ts +131 -0
- package/dist/series/bioinformatics/circos/tracks/AreaTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/ConnectorTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/GlyphTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/HeatmapTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/HighlightTrackRenderer.d.ts +6 -0
- package/dist/series/bioinformatics/circos/tracks/HistogramTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/LineTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/LinkTrackRenderer.d.ts +8 -0
- package/dist/series/bioinformatics/circos/tracks/LollipopTrackRenderer.d.ts +9 -0
- package/dist/series/bioinformatics/circos/tracks/RibbonTrackRenderer.d.ts +9 -0
- package/dist/series/bioinformatics/circos/tracks/ScatterTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/StackTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/TextTrackRenderer.d.ts +8 -0
- package/dist/series/bioinformatics/circos/tracks/TileTrackRenderer.d.ts +7 -0
- package/dist/series/bioinformatics/circos/tracks/TrackAxesRenderer.d.ts +6 -0
- package/dist/series/bioinformatics/circos/tracks/TrackBackgroundRenderer.d.ts +5 -0
- package/dist/series/cartesian/AreaChart.d.ts +33 -0
- package/dist/series/cartesian/BoxPlotChart.d.ts +24 -0
- package/dist/series/cartesian/BubbleChart.d.ts +34 -0
- package/dist/series/cartesian/ColumnChart.d.ts +37 -0
- package/dist/series/cartesian/LineChart.d.ts +28 -0
- package/dist/series/cartesian/ScatterChart.d.ts +20 -0
- package/dist/series/cartesian/SplineChart.d.ts +9 -0
- package/dist/series/cartesian/WaterfallChart.d.ts +25 -0
- package/dist/series/financial/AreaRangeChart.d.ts +24 -0
- package/dist/series/financial/BaselineChart.d.ts +20 -0
- package/dist/series/financial/CandlestickChart.d.ts +55 -0
- package/dist/series/financial/ColumnRangeChart.d.ts +16 -0
- package/dist/series/financial/FlagsChart.d.ts +34 -0
- package/dist/series/financial/HeikinAshiChart.d.ts +11 -0
- package/dist/series/financial/HollowCandlestickChart.d.ts +17 -0
- package/dist/series/financial/KagiChart.d.ts +23 -0
- package/dist/series/financial/LineBreakChart.d.ts +23 -0
- package/dist/series/financial/PointAndFigureChart.d.ts +24 -0
- package/dist/series/financial/RenkoChart.d.ts +22 -0
- package/dist/series/financial/VBPChart.d.ts +18 -0
- package/dist/series/financial/VolumeChart.d.ts +15 -0
- package/dist/series/flow/DependencyWheelChart.d.ts +23 -0
- package/dist/series/flow/NetworkGraphChart.d.ts +18 -0
- package/dist/series/flow/SankeyChart.d.ts +24 -0
- package/dist/series/gauge/GaugeChart.d.ts +40 -0
- package/dist/series/heatmap/HeatmapChart.d.ts +18 -0
- package/dist/series/hierarchical/SunburstChart.d.ts +44 -0
- package/dist/series/hierarchical/TreegraphChart.d.ts +19 -0
- package/dist/series/hierarchical/TreemapChart.d.ts +20 -0
- package/dist/series/hierarchical/WordcloudChart.d.ts +19 -0
- package/dist/series/index.d.ts +45 -0
- package/dist/series/map/FlowmapChart.d.ts +33 -0
- package/dist/series/map/MapChart.d.ts +53 -0
- package/dist/series/map/MapPointChart.d.ts +26 -0
- package/dist/series/map/mapProjection.d.ts +46 -0
- package/dist/series/pie/PieChart.d.ts +53 -0
- package/dist/series/polar/PolarChart.d.ts +18 -0
- package/dist/series/race/BarRaceChart.d.ts +44 -0
- package/dist/series/timeline/TimelineChart.d.ts +23 -0
- package/dist/series/venn/VennChart.d.ts +28 -0
- package/dist/stock/DataGrouping.d.ts +21 -0
- package/dist/stock/Navigator.d.ts +25 -0
- package/dist/stock/RangeSelector.d.ts +9 -0
- package/dist/stock/StockController.d.ts +47 -0
- package/dist/stockcharts.d.ts +8 -0
- package/dist/streaming/StreamAdapter.d.ts +36 -0
- package/dist/types/datatable-options.d.ts +633 -0
- package/dist/types/options.d.ts +1333 -0
- package/dist/utils/CircularBuffer.d.ts +24 -0
- package/dist/utils/chartText.d.ts +18 -0
- package/dist/utils/color.d.ts +23 -0
- package/dist/utils/decimation.d.ts +19 -0
- package/dist/utils/deepMerge.d.ts +5 -0
- package/dist/utils/dom.d.ts +10 -0
- package/dist/utils/format.d.ts +42 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/math.d.ts +6 -0
- package/dist/utils/throttle.d.ts +2 -0
- package/package.json +95 -0
|
@@ -0,0 +1,4364 @@
|
|
|
1
|
+
class ti {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.types = /* @__PURE__ */ new Map();
|
|
4
|
+
}
|
|
5
|
+
registerType(t, n) {
|
|
6
|
+
this.types.set(t, n);
|
|
7
|
+
}
|
|
8
|
+
getType(t) {
|
|
9
|
+
return this.types.get(t);
|
|
10
|
+
}
|
|
11
|
+
hasType(t) {
|
|
12
|
+
return this.types.has(t);
|
|
13
|
+
}
|
|
14
|
+
getRegisteredTypes() {
|
|
15
|
+
return Array.from(this.types.keys());
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const Fe = globalThis, G = Fe.__katuChartRegistry || (Fe.__katuChartRegistry = new ti());
|
|
19
|
+
var ae = "http://www.w3.org/1999/xhtml";
|
|
20
|
+
const Ve = {
|
|
21
|
+
svg: "http://www.w3.org/2000/svg",
|
|
22
|
+
xhtml: ae,
|
|
23
|
+
xlink: "http://www.w3.org/1999/xlink",
|
|
24
|
+
xml: "http://www.w3.org/XML/1998/namespace",
|
|
25
|
+
xmlns: "http://www.w3.org/2000/xmlns/"
|
|
26
|
+
};
|
|
27
|
+
function Zt(e) {
|
|
28
|
+
var t = e += "", n = t.indexOf(":");
|
|
29
|
+
return n >= 0 && (t = e.slice(0, n)) !== "xmlns" && (e = e.slice(n + 1)), Ve.hasOwnProperty(t) ? { space: Ve[t], local: e } : e;
|
|
30
|
+
}
|
|
31
|
+
function ei(e) {
|
|
32
|
+
return function() {
|
|
33
|
+
var t = this.ownerDocument, n = this.namespaceURI;
|
|
34
|
+
return n === ae && t.documentElement.namespaceURI === ae ? t.createElement(e) : t.createElementNS(n, e);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function ni(e) {
|
|
38
|
+
return function() {
|
|
39
|
+
return this.ownerDocument.createElementNS(e.space, e.local);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function hn(e) {
|
|
43
|
+
var t = Zt(e);
|
|
44
|
+
return (t.local ? ni : ei)(t);
|
|
45
|
+
}
|
|
46
|
+
function ii() {
|
|
47
|
+
}
|
|
48
|
+
function _e(e) {
|
|
49
|
+
return e == null ? ii : function() {
|
|
50
|
+
return this.querySelector(e);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function ri(e) {
|
|
54
|
+
typeof e != "function" && (e = _e(e));
|
|
55
|
+
for (var t = this._groups, n = t.length, i = new Array(n), r = 0; r < n; ++r)
|
|
56
|
+
for (var s = t[r], o = s.length, a = i[r] = new Array(o), c, l, u = 0; u < o; ++u)
|
|
57
|
+
(c = s[u]) && (l = e.call(c, c.__data__, u, s)) && ("__data__" in c && (l.__data__ = c.__data__), a[u] = l);
|
|
58
|
+
return new K(i, this._parents);
|
|
59
|
+
}
|
|
60
|
+
function si(e) {
|
|
61
|
+
return e == null ? [] : Array.isArray(e) ? e : Array.from(e);
|
|
62
|
+
}
|
|
63
|
+
function oi() {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
function un(e) {
|
|
67
|
+
return e == null ? oi : function() {
|
|
68
|
+
return this.querySelectorAll(e);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function ai(e) {
|
|
72
|
+
return function() {
|
|
73
|
+
return si(e.apply(this, arguments));
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function li(e) {
|
|
77
|
+
typeof e == "function" ? e = ai(e) : e = un(e);
|
|
78
|
+
for (var t = this._groups, n = t.length, i = [], r = [], s = 0; s < n; ++s)
|
|
79
|
+
for (var o = t[s], a = o.length, c, l = 0; l < a; ++l)
|
|
80
|
+
(c = o[l]) && (i.push(e.call(c, c.__data__, l, o)), r.push(c));
|
|
81
|
+
return new K(i, r);
|
|
82
|
+
}
|
|
83
|
+
function fn(e) {
|
|
84
|
+
return function() {
|
|
85
|
+
return this.matches(e);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function dn(e) {
|
|
89
|
+
return function(t) {
|
|
90
|
+
return t.matches(e);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
var ci = Array.prototype.find;
|
|
94
|
+
function hi(e) {
|
|
95
|
+
return function() {
|
|
96
|
+
return ci.call(this.children, e);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function ui() {
|
|
100
|
+
return this.firstElementChild;
|
|
101
|
+
}
|
|
102
|
+
function fi(e) {
|
|
103
|
+
return this.select(e == null ? ui : hi(typeof e == "function" ? e : dn(e)));
|
|
104
|
+
}
|
|
105
|
+
var di = Array.prototype.filter;
|
|
106
|
+
function pi() {
|
|
107
|
+
return Array.from(this.children);
|
|
108
|
+
}
|
|
109
|
+
function gi(e) {
|
|
110
|
+
return function() {
|
|
111
|
+
return di.call(this.children, e);
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function xi(e) {
|
|
115
|
+
return this.selectAll(e == null ? pi : gi(typeof e == "function" ? e : dn(e)));
|
|
116
|
+
}
|
|
117
|
+
function yi(e) {
|
|
118
|
+
typeof e != "function" && (e = fn(e));
|
|
119
|
+
for (var t = this._groups, n = t.length, i = new Array(n), r = 0; r < n; ++r)
|
|
120
|
+
for (var s = t[r], o = s.length, a = i[r] = [], c, l = 0; l < o; ++l)
|
|
121
|
+
(c = s[l]) && e.call(c, c.__data__, l, s) && a.push(c);
|
|
122
|
+
return new K(i, this._parents);
|
|
123
|
+
}
|
|
124
|
+
function pn(e) {
|
|
125
|
+
return new Array(e.length);
|
|
126
|
+
}
|
|
127
|
+
function mi() {
|
|
128
|
+
return new K(this._enter || this._groups.map(pn), this._parents);
|
|
129
|
+
}
|
|
130
|
+
function Bt(e, t) {
|
|
131
|
+
this.ownerDocument = e.ownerDocument, this.namespaceURI = e.namespaceURI, this._next = null, this._parent = e, this.__data__ = t;
|
|
132
|
+
}
|
|
133
|
+
Bt.prototype = {
|
|
134
|
+
constructor: Bt,
|
|
135
|
+
appendChild: function(e) {
|
|
136
|
+
return this._parent.insertBefore(e, this._next);
|
|
137
|
+
},
|
|
138
|
+
insertBefore: function(e, t) {
|
|
139
|
+
return this._parent.insertBefore(e, t);
|
|
140
|
+
},
|
|
141
|
+
querySelector: function(e) {
|
|
142
|
+
return this._parent.querySelector(e);
|
|
143
|
+
},
|
|
144
|
+
querySelectorAll: function(e) {
|
|
145
|
+
return this._parent.querySelectorAll(e);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
function _i(e) {
|
|
149
|
+
return function() {
|
|
150
|
+
return e;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function wi(e, t, n, i, r, s) {
|
|
154
|
+
for (var o = 0, a, c = t.length, l = s.length; o < l; ++o)
|
|
155
|
+
(a = t[o]) ? (a.__data__ = s[o], i[o] = a) : n[o] = new Bt(e, s[o]);
|
|
156
|
+
for (; o < c; ++o)
|
|
157
|
+
(a = t[o]) && (r[o] = a);
|
|
158
|
+
}
|
|
159
|
+
function vi(e, t, n, i, r, s, o) {
|
|
160
|
+
var a, c, l = /* @__PURE__ */ new Map(), u = t.length, h = s.length, f = new Array(u), p;
|
|
161
|
+
for (a = 0; a < u; ++a)
|
|
162
|
+
(c = t[a]) && (f[a] = p = o.call(c, c.__data__, a, t) + "", l.has(p) ? r[a] = c : l.set(p, c));
|
|
163
|
+
for (a = 0; a < h; ++a)
|
|
164
|
+
p = o.call(e, s[a], a, s) + "", (c = l.get(p)) ? (i[a] = c, c.__data__ = s[a], l.delete(p)) : n[a] = new Bt(e, s[a]);
|
|
165
|
+
for (a = 0; a < u; ++a)
|
|
166
|
+
(c = t[a]) && l.get(f[a]) === c && (r[a] = c);
|
|
167
|
+
}
|
|
168
|
+
function bi(e) {
|
|
169
|
+
return e.__data__;
|
|
170
|
+
}
|
|
171
|
+
function ki(e, t) {
|
|
172
|
+
if (!arguments.length) return Array.from(this, bi);
|
|
173
|
+
var n = t ? vi : wi, i = this._parents, r = this._groups;
|
|
174
|
+
typeof e != "function" && (e = _i(e));
|
|
175
|
+
for (var s = r.length, o = new Array(s), a = new Array(s), c = new Array(s), l = 0; l < s; ++l) {
|
|
176
|
+
var u = i[l], h = r[l], f = h.length, p = Mi(e.call(u, u && u.__data__, l, i)), d = p.length, y = a[l] = new Array(d), m = o[l] = new Array(d), g = c[l] = new Array(f);
|
|
177
|
+
n(u, h, y, m, g, p, t);
|
|
178
|
+
for (var x = 0, _ = 0, w, v; x < d; ++x)
|
|
179
|
+
if (w = y[x]) {
|
|
180
|
+
for (x >= _ && (_ = x + 1); !(v = m[_]) && ++_ < d; ) ;
|
|
181
|
+
w._next = v || null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return o = new K(o, i), o._enter = a, o._exit = c, o;
|
|
185
|
+
}
|
|
186
|
+
function Mi(e) {
|
|
187
|
+
return typeof e == "object" && "length" in e ? e : Array.from(e);
|
|
188
|
+
}
|
|
189
|
+
function Ai() {
|
|
190
|
+
return new K(this._exit || this._groups.map(pn), this._parents);
|
|
191
|
+
}
|
|
192
|
+
function Pi(e, t, n) {
|
|
193
|
+
var i = this.enter(), r = this, s = this.exit();
|
|
194
|
+
return typeof e == "function" ? (i = e(i), i && (i = i.selection())) : i = i.append(e + ""), t != null && (r = t(r), r && (r = r.selection())), n == null ? s.remove() : n(s), i && r ? i.merge(r).order() : r;
|
|
195
|
+
}
|
|
196
|
+
function Ci(e) {
|
|
197
|
+
for (var t = e.selection ? e.selection() : e, n = this._groups, i = t._groups, r = n.length, s = i.length, o = Math.min(r, s), a = new Array(r), c = 0; c < o; ++c)
|
|
198
|
+
for (var l = n[c], u = i[c], h = l.length, f = a[c] = new Array(h), p, d = 0; d < h; ++d)
|
|
199
|
+
(p = l[d] || u[d]) && (f[d] = p);
|
|
200
|
+
for (; c < r; ++c)
|
|
201
|
+
a[c] = n[c];
|
|
202
|
+
return new K(a, this._parents);
|
|
203
|
+
}
|
|
204
|
+
function Ei() {
|
|
205
|
+
for (var e = this._groups, t = -1, n = e.length; ++t < n; )
|
|
206
|
+
for (var i = e[t], r = i.length - 1, s = i[r], o; --r >= 0; )
|
|
207
|
+
(o = i[r]) && (s && o.compareDocumentPosition(s) ^ 4 && s.parentNode.insertBefore(o, s), s = o);
|
|
208
|
+
return this;
|
|
209
|
+
}
|
|
210
|
+
function Si(e) {
|
|
211
|
+
e || (e = Ii);
|
|
212
|
+
function t(h, f) {
|
|
213
|
+
return h && f ? e(h.__data__, f.__data__) : !h - !f;
|
|
214
|
+
}
|
|
215
|
+
for (var n = this._groups, i = n.length, r = new Array(i), s = 0; s < i; ++s) {
|
|
216
|
+
for (var o = n[s], a = o.length, c = r[s] = new Array(a), l, u = 0; u < a; ++u)
|
|
217
|
+
(l = o[u]) && (c[u] = l);
|
|
218
|
+
c.sort(t);
|
|
219
|
+
}
|
|
220
|
+
return new K(r, this._parents).order();
|
|
221
|
+
}
|
|
222
|
+
function Ii(e, t) {
|
|
223
|
+
return e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
|
|
224
|
+
}
|
|
225
|
+
function Ti() {
|
|
226
|
+
var e = arguments[0];
|
|
227
|
+
return arguments[0] = this, e.apply(null, arguments), this;
|
|
228
|
+
}
|
|
229
|
+
function $i() {
|
|
230
|
+
return Array.from(this);
|
|
231
|
+
}
|
|
232
|
+
function Ni() {
|
|
233
|
+
for (var e = this._groups, t = 0, n = e.length; t < n; ++t)
|
|
234
|
+
for (var i = e[t], r = 0, s = i.length; r < s; ++r) {
|
|
235
|
+
var o = i[r];
|
|
236
|
+
if (o) return o;
|
|
237
|
+
}
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
function Fi() {
|
|
241
|
+
let e = 0;
|
|
242
|
+
for (const t of this) ++e;
|
|
243
|
+
return e;
|
|
244
|
+
}
|
|
245
|
+
function Vi() {
|
|
246
|
+
return !this.node();
|
|
247
|
+
}
|
|
248
|
+
function Di(e) {
|
|
249
|
+
for (var t = this._groups, n = 0, i = t.length; n < i; ++n)
|
|
250
|
+
for (var r = t[n], s = 0, o = r.length, a; s < o; ++s)
|
|
251
|
+
(a = r[s]) && e.call(a, a.__data__, s, r);
|
|
252
|
+
return this;
|
|
253
|
+
}
|
|
254
|
+
function Li(e) {
|
|
255
|
+
return function() {
|
|
256
|
+
this.removeAttribute(e);
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function Ri(e) {
|
|
260
|
+
return function() {
|
|
261
|
+
this.removeAttributeNS(e.space, e.local);
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function Oi(e, t) {
|
|
265
|
+
return function() {
|
|
266
|
+
this.setAttribute(e, t);
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function zi(e, t) {
|
|
270
|
+
return function() {
|
|
271
|
+
this.setAttributeNS(e.space, e.local, t);
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function Hi(e, t) {
|
|
275
|
+
return function() {
|
|
276
|
+
var n = t.apply(this, arguments);
|
|
277
|
+
n == null ? this.removeAttribute(e) : this.setAttribute(e, n);
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function Bi(e, t) {
|
|
281
|
+
return function() {
|
|
282
|
+
var n = t.apply(this, arguments);
|
|
283
|
+
n == null ? this.removeAttributeNS(e.space, e.local) : this.setAttributeNS(e.space, e.local, n);
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
function Xi(e, t) {
|
|
287
|
+
var n = Zt(e);
|
|
288
|
+
if (arguments.length < 2) {
|
|
289
|
+
var i = this.node();
|
|
290
|
+
return n.local ? i.getAttributeNS(n.space, n.local) : i.getAttribute(n);
|
|
291
|
+
}
|
|
292
|
+
return this.each((t == null ? n.local ? Ri : Li : typeof t == "function" ? n.local ? Bi : Hi : n.local ? zi : Oi)(n, t));
|
|
293
|
+
}
|
|
294
|
+
function gn(e) {
|
|
295
|
+
return e.ownerDocument && e.ownerDocument.defaultView || e.document && e || e.defaultView;
|
|
296
|
+
}
|
|
297
|
+
function Wi(e) {
|
|
298
|
+
return function() {
|
|
299
|
+
this.style.removeProperty(e);
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
function Ui(e, t, n) {
|
|
303
|
+
return function() {
|
|
304
|
+
this.style.setProperty(e, t, n);
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
function Yi(e, t, n) {
|
|
308
|
+
return function() {
|
|
309
|
+
var i = t.apply(this, arguments);
|
|
310
|
+
i == null ? this.style.removeProperty(e) : this.style.setProperty(e, i, n);
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function qi(e, t, n) {
|
|
314
|
+
return arguments.length > 1 ? this.each((t == null ? Wi : typeof t == "function" ? Yi : Ui)(e, t, n ?? "")) : yt(this.node(), e);
|
|
315
|
+
}
|
|
316
|
+
function yt(e, t) {
|
|
317
|
+
return e.style.getPropertyValue(t) || gn(e).getComputedStyle(e, null).getPropertyValue(t);
|
|
318
|
+
}
|
|
319
|
+
function Gi(e) {
|
|
320
|
+
return function() {
|
|
321
|
+
delete this[e];
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function Ki(e, t) {
|
|
325
|
+
return function() {
|
|
326
|
+
this[e] = t;
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
function Zi(e, t) {
|
|
330
|
+
return function() {
|
|
331
|
+
var n = t.apply(this, arguments);
|
|
332
|
+
n == null ? delete this[e] : this[e] = n;
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
function Ji(e, t) {
|
|
336
|
+
return arguments.length > 1 ? this.each((t == null ? Gi : typeof t == "function" ? Zi : Ki)(e, t)) : this.node()[e];
|
|
337
|
+
}
|
|
338
|
+
function xn(e) {
|
|
339
|
+
return e.trim().split(/^|\s+/);
|
|
340
|
+
}
|
|
341
|
+
function we(e) {
|
|
342
|
+
return e.classList || new yn(e);
|
|
343
|
+
}
|
|
344
|
+
function yn(e) {
|
|
345
|
+
this._node = e, this._names = xn(e.getAttribute("class") || "");
|
|
346
|
+
}
|
|
347
|
+
yn.prototype = {
|
|
348
|
+
add: function(e) {
|
|
349
|
+
var t = this._names.indexOf(e);
|
|
350
|
+
t < 0 && (this._names.push(e), this._node.setAttribute("class", this._names.join(" ")));
|
|
351
|
+
},
|
|
352
|
+
remove: function(e) {
|
|
353
|
+
var t = this._names.indexOf(e);
|
|
354
|
+
t >= 0 && (this._names.splice(t, 1), this._node.setAttribute("class", this._names.join(" ")));
|
|
355
|
+
},
|
|
356
|
+
contains: function(e) {
|
|
357
|
+
return this._names.indexOf(e) >= 0;
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
function mn(e, t) {
|
|
361
|
+
for (var n = we(e), i = -1, r = t.length; ++i < r; ) n.add(t[i]);
|
|
362
|
+
}
|
|
363
|
+
function _n(e, t) {
|
|
364
|
+
for (var n = we(e), i = -1, r = t.length; ++i < r; ) n.remove(t[i]);
|
|
365
|
+
}
|
|
366
|
+
function Qi(e) {
|
|
367
|
+
return function() {
|
|
368
|
+
mn(this, e);
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
function ji(e) {
|
|
372
|
+
return function() {
|
|
373
|
+
_n(this, e);
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
function tr(e, t) {
|
|
377
|
+
return function() {
|
|
378
|
+
(t.apply(this, arguments) ? mn : _n)(this, e);
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
function er(e, t) {
|
|
382
|
+
var n = xn(e + "");
|
|
383
|
+
if (arguments.length < 2) {
|
|
384
|
+
for (var i = we(this.node()), r = -1, s = n.length; ++r < s; ) if (!i.contains(n[r])) return !1;
|
|
385
|
+
return !0;
|
|
386
|
+
}
|
|
387
|
+
return this.each((typeof t == "function" ? tr : t ? Qi : ji)(n, t));
|
|
388
|
+
}
|
|
389
|
+
function nr() {
|
|
390
|
+
this.textContent = "";
|
|
391
|
+
}
|
|
392
|
+
function ir(e) {
|
|
393
|
+
return function() {
|
|
394
|
+
this.textContent = e;
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
function rr(e) {
|
|
398
|
+
return function() {
|
|
399
|
+
var t = e.apply(this, arguments);
|
|
400
|
+
this.textContent = t ?? "";
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
function sr(e) {
|
|
404
|
+
return arguments.length ? this.each(e == null ? nr : (typeof e == "function" ? rr : ir)(e)) : this.node().textContent;
|
|
405
|
+
}
|
|
406
|
+
function or() {
|
|
407
|
+
this.innerHTML = "";
|
|
408
|
+
}
|
|
409
|
+
function ar(e) {
|
|
410
|
+
return function() {
|
|
411
|
+
this.innerHTML = e;
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function lr(e) {
|
|
415
|
+
return function() {
|
|
416
|
+
var t = e.apply(this, arguments);
|
|
417
|
+
this.innerHTML = t ?? "";
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
function cr(e) {
|
|
421
|
+
return arguments.length ? this.each(e == null ? or : (typeof e == "function" ? lr : ar)(e)) : this.node().innerHTML;
|
|
422
|
+
}
|
|
423
|
+
function hr() {
|
|
424
|
+
this.nextSibling && this.parentNode.appendChild(this);
|
|
425
|
+
}
|
|
426
|
+
function ur() {
|
|
427
|
+
return this.each(hr);
|
|
428
|
+
}
|
|
429
|
+
function fr() {
|
|
430
|
+
this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
|
|
431
|
+
}
|
|
432
|
+
function dr() {
|
|
433
|
+
return this.each(fr);
|
|
434
|
+
}
|
|
435
|
+
function pr(e) {
|
|
436
|
+
var t = typeof e == "function" ? e : hn(e);
|
|
437
|
+
return this.select(function() {
|
|
438
|
+
return this.appendChild(t.apply(this, arguments));
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
function gr() {
|
|
442
|
+
return null;
|
|
443
|
+
}
|
|
444
|
+
function xr(e, t) {
|
|
445
|
+
var n = typeof e == "function" ? e : hn(e), i = t == null ? gr : typeof t == "function" ? t : _e(t);
|
|
446
|
+
return this.select(function() {
|
|
447
|
+
return this.insertBefore(n.apply(this, arguments), i.apply(this, arguments) || null);
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
function yr() {
|
|
451
|
+
var e = this.parentNode;
|
|
452
|
+
e && e.removeChild(this);
|
|
453
|
+
}
|
|
454
|
+
function mr() {
|
|
455
|
+
return this.each(yr);
|
|
456
|
+
}
|
|
457
|
+
function _r() {
|
|
458
|
+
var e = this.cloneNode(!1), t = this.parentNode;
|
|
459
|
+
return t ? t.insertBefore(e, this.nextSibling) : e;
|
|
460
|
+
}
|
|
461
|
+
function wr() {
|
|
462
|
+
var e = this.cloneNode(!0), t = this.parentNode;
|
|
463
|
+
return t ? t.insertBefore(e, this.nextSibling) : e;
|
|
464
|
+
}
|
|
465
|
+
function vr(e) {
|
|
466
|
+
return this.select(e ? wr : _r);
|
|
467
|
+
}
|
|
468
|
+
function br(e) {
|
|
469
|
+
return arguments.length ? this.property("__data__", e) : this.node().__data__;
|
|
470
|
+
}
|
|
471
|
+
function kr(e) {
|
|
472
|
+
return function(t) {
|
|
473
|
+
e.call(this, t, this.__data__);
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
function Mr(e) {
|
|
477
|
+
return e.trim().split(/^|\s+/).map(function(t) {
|
|
478
|
+
var n = "", i = t.indexOf(".");
|
|
479
|
+
return i >= 0 && (n = t.slice(i + 1), t = t.slice(0, i)), { type: t, name: n };
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
function Ar(e) {
|
|
483
|
+
return function() {
|
|
484
|
+
var t = this.__on;
|
|
485
|
+
if (t) {
|
|
486
|
+
for (var n = 0, i = -1, r = t.length, s; n < r; ++n)
|
|
487
|
+
s = t[n], (!e.type || s.type === e.type) && s.name === e.name ? this.removeEventListener(s.type, s.listener, s.options) : t[++i] = s;
|
|
488
|
+
++i ? t.length = i : delete this.__on;
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
function Pr(e, t, n) {
|
|
493
|
+
return function() {
|
|
494
|
+
var i = this.__on, r, s = kr(t);
|
|
495
|
+
if (i) {
|
|
496
|
+
for (var o = 0, a = i.length; o < a; ++o)
|
|
497
|
+
if ((r = i[o]).type === e.type && r.name === e.name) {
|
|
498
|
+
this.removeEventListener(r.type, r.listener, r.options), this.addEventListener(r.type, r.listener = s, r.options = n), r.value = t;
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
this.addEventListener(e.type, s, n), r = { type: e.type, name: e.name, value: t, listener: s, options: n }, i ? i.push(r) : this.__on = [r];
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
function Cr(e, t, n) {
|
|
506
|
+
var i = Mr(e + ""), r, s = i.length, o;
|
|
507
|
+
if (arguments.length < 2) {
|
|
508
|
+
var a = this.node().__on;
|
|
509
|
+
if (a) {
|
|
510
|
+
for (var c = 0, l = a.length, u; c < l; ++c)
|
|
511
|
+
for (r = 0, u = a[c]; r < s; ++r)
|
|
512
|
+
if ((o = i[r]).type === u.type && o.name === u.name)
|
|
513
|
+
return u.value;
|
|
514
|
+
}
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
for (a = t ? Pr : Ar, r = 0; r < s; ++r) this.each(a(i[r], t, n));
|
|
518
|
+
return this;
|
|
519
|
+
}
|
|
520
|
+
function wn(e, t, n) {
|
|
521
|
+
var i = gn(e), r = i.CustomEvent;
|
|
522
|
+
typeof r == "function" ? r = new r(t, n) : (r = i.document.createEvent("Event"), n ? (r.initEvent(t, n.bubbles, n.cancelable), r.detail = n.detail) : r.initEvent(t, !1, !1)), e.dispatchEvent(r);
|
|
523
|
+
}
|
|
524
|
+
function Er(e, t) {
|
|
525
|
+
return function() {
|
|
526
|
+
return wn(this, e, t);
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
function Sr(e, t) {
|
|
530
|
+
return function() {
|
|
531
|
+
return wn(this, e, t.apply(this, arguments));
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
function Ir(e, t) {
|
|
535
|
+
return this.each((typeof t == "function" ? Sr : Er)(e, t));
|
|
536
|
+
}
|
|
537
|
+
function* Tr() {
|
|
538
|
+
for (var e = this._groups, t = 0, n = e.length; t < n; ++t)
|
|
539
|
+
for (var i = e[t], r = 0, s = i.length, o; r < s; ++r)
|
|
540
|
+
(o = i[r]) && (yield o);
|
|
541
|
+
}
|
|
542
|
+
var vn = [null];
|
|
543
|
+
function K(e, t) {
|
|
544
|
+
this._groups = e, this._parents = t;
|
|
545
|
+
}
|
|
546
|
+
function $t() {
|
|
547
|
+
return new K([[document.documentElement]], vn);
|
|
548
|
+
}
|
|
549
|
+
function $r() {
|
|
550
|
+
return this;
|
|
551
|
+
}
|
|
552
|
+
K.prototype = $t.prototype = {
|
|
553
|
+
constructor: K,
|
|
554
|
+
select: ri,
|
|
555
|
+
selectAll: li,
|
|
556
|
+
selectChild: fi,
|
|
557
|
+
selectChildren: xi,
|
|
558
|
+
filter: yi,
|
|
559
|
+
data: ki,
|
|
560
|
+
enter: mi,
|
|
561
|
+
exit: Ai,
|
|
562
|
+
join: Pi,
|
|
563
|
+
merge: Ci,
|
|
564
|
+
selection: $r,
|
|
565
|
+
order: Ei,
|
|
566
|
+
sort: Si,
|
|
567
|
+
call: Ti,
|
|
568
|
+
nodes: $i,
|
|
569
|
+
node: Ni,
|
|
570
|
+
size: Fi,
|
|
571
|
+
empty: Vi,
|
|
572
|
+
each: Di,
|
|
573
|
+
attr: Xi,
|
|
574
|
+
style: qi,
|
|
575
|
+
property: Ji,
|
|
576
|
+
classed: er,
|
|
577
|
+
text: sr,
|
|
578
|
+
html: cr,
|
|
579
|
+
raise: ur,
|
|
580
|
+
lower: dr,
|
|
581
|
+
append: pr,
|
|
582
|
+
insert: xr,
|
|
583
|
+
remove: mr,
|
|
584
|
+
clone: vr,
|
|
585
|
+
datum: br,
|
|
586
|
+
on: Cr,
|
|
587
|
+
dispatch: Ir,
|
|
588
|
+
[Symbol.iterator]: Tr
|
|
589
|
+
};
|
|
590
|
+
function Nr(e) {
|
|
591
|
+
return typeof e == "string" ? new K([[document.querySelector(e)]], [document.documentElement]) : new K([[e]], vn);
|
|
592
|
+
}
|
|
593
|
+
var Fr = { value: () => {
|
|
594
|
+
} };
|
|
595
|
+
function bn() {
|
|
596
|
+
for (var e = 0, t = arguments.length, n = {}, i; e < t; ++e) {
|
|
597
|
+
if (!(i = arguments[e] + "") || i in n || /[\s.]/.test(i)) throw new Error("illegal type: " + i);
|
|
598
|
+
n[i] = [];
|
|
599
|
+
}
|
|
600
|
+
return new Ot(n);
|
|
601
|
+
}
|
|
602
|
+
function Ot(e) {
|
|
603
|
+
this._ = e;
|
|
604
|
+
}
|
|
605
|
+
function Vr(e, t) {
|
|
606
|
+
return e.trim().split(/^|\s+/).map(function(n) {
|
|
607
|
+
var i = "", r = n.indexOf(".");
|
|
608
|
+
if (r >= 0 && (i = n.slice(r + 1), n = n.slice(0, r)), n && !t.hasOwnProperty(n)) throw new Error("unknown type: " + n);
|
|
609
|
+
return { type: n, name: i };
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
Ot.prototype = bn.prototype = {
|
|
613
|
+
constructor: Ot,
|
|
614
|
+
on: function(e, t) {
|
|
615
|
+
var n = this._, i = Vr(e + "", n), r, s = -1, o = i.length;
|
|
616
|
+
if (arguments.length < 2) {
|
|
617
|
+
for (; ++s < o; ) if ((r = (e = i[s]).type) && (r = Dr(n[r], e.name))) return r;
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
if (t != null && typeof t != "function") throw new Error("invalid callback: " + t);
|
|
621
|
+
for (; ++s < o; )
|
|
622
|
+
if (r = (e = i[s]).type) n[r] = De(n[r], e.name, t);
|
|
623
|
+
else if (t == null) for (r in n) n[r] = De(n[r], e.name, null);
|
|
624
|
+
return this;
|
|
625
|
+
},
|
|
626
|
+
copy: function() {
|
|
627
|
+
var e = {}, t = this._;
|
|
628
|
+
for (var n in t) e[n] = t[n].slice();
|
|
629
|
+
return new Ot(e);
|
|
630
|
+
},
|
|
631
|
+
call: function(e, t) {
|
|
632
|
+
if ((r = arguments.length - 2) > 0) for (var n = new Array(r), i = 0, r, s; i < r; ++i) n[i] = arguments[i + 2];
|
|
633
|
+
if (!this._.hasOwnProperty(e)) throw new Error("unknown type: " + e);
|
|
634
|
+
for (s = this._[e], i = 0, r = s.length; i < r; ++i) s[i].value.apply(t, n);
|
|
635
|
+
},
|
|
636
|
+
apply: function(e, t, n) {
|
|
637
|
+
if (!this._.hasOwnProperty(e)) throw new Error("unknown type: " + e);
|
|
638
|
+
for (var i = this._[e], r = 0, s = i.length; r < s; ++r) i[r].value.apply(t, n);
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
function Dr(e, t) {
|
|
642
|
+
for (var n = 0, i = e.length, r; n < i; ++n)
|
|
643
|
+
if ((r = e[n]).name === t)
|
|
644
|
+
return r.value;
|
|
645
|
+
}
|
|
646
|
+
function De(e, t, n) {
|
|
647
|
+
for (var i = 0, r = e.length; i < r; ++i)
|
|
648
|
+
if (e[i].name === t) {
|
|
649
|
+
e[i] = Fr, e = e.slice(0, i).concat(e.slice(i + 1));
|
|
650
|
+
break;
|
|
651
|
+
}
|
|
652
|
+
return n != null && e.push({ name: t, value: n }), e;
|
|
653
|
+
}
|
|
654
|
+
var mt = 0, At = 0, kt = 0, kn = 1e3, Xt, Pt, Wt = 0, pt = 0, Jt = 0, Et = typeof performance == "object" && performance.now ? performance : Date, Mn = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(e) {
|
|
655
|
+
setTimeout(e, 17);
|
|
656
|
+
};
|
|
657
|
+
function ve() {
|
|
658
|
+
return pt || (Mn(Lr), pt = Et.now() + Jt);
|
|
659
|
+
}
|
|
660
|
+
function Lr() {
|
|
661
|
+
pt = 0;
|
|
662
|
+
}
|
|
663
|
+
function Ut() {
|
|
664
|
+
this._call = this._time = this._next = null;
|
|
665
|
+
}
|
|
666
|
+
Ut.prototype = An.prototype = {
|
|
667
|
+
constructor: Ut,
|
|
668
|
+
restart: function(e, t, n) {
|
|
669
|
+
if (typeof e != "function") throw new TypeError("callback is not a function");
|
|
670
|
+
n = (n == null ? ve() : +n) + (t == null ? 0 : +t), !this._next && Pt !== this && (Pt ? Pt._next = this : Xt = this, Pt = this), this._call = e, this._time = n, le();
|
|
671
|
+
},
|
|
672
|
+
stop: function() {
|
|
673
|
+
this._call && (this._call = null, this._time = 1 / 0, le());
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
function An(e, t, n) {
|
|
677
|
+
var i = new Ut();
|
|
678
|
+
return i.restart(e, t, n), i;
|
|
679
|
+
}
|
|
680
|
+
function Rr() {
|
|
681
|
+
ve(), ++mt;
|
|
682
|
+
for (var e = Xt, t; e; )
|
|
683
|
+
(t = pt - e._time) >= 0 && e._call.call(void 0, t), e = e._next;
|
|
684
|
+
--mt;
|
|
685
|
+
}
|
|
686
|
+
function Le() {
|
|
687
|
+
pt = (Wt = Et.now()) + Jt, mt = At = 0;
|
|
688
|
+
try {
|
|
689
|
+
Rr();
|
|
690
|
+
} finally {
|
|
691
|
+
mt = 0, zr(), pt = 0;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
function Or() {
|
|
695
|
+
var e = Et.now(), t = e - Wt;
|
|
696
|
+
t > kn && (Jt -= t, Wt = e);
|
|
697
|
+
}
|
|
698
|
+
function zr() {
|
|
699
|
+
for (var e, t = Xt, n, i = 1 / 0; t; )
|
|
700
|
+
t._call ? (i > t._time && (i = t._time), e = t, t = t._next) : (n = t._next, t._next = null, t = e ? e._next = n : Xt = n);
|
|
701
|
+
Pt = e, le(i);
|
|
702
|
+
}
|
|
703
|
+
function le(e) {
|
|
704
|
+
if (!mt) {
|
|
705
|
+
At && (At = clearTimeout(At));
|
|
706
|
+
var t = e - pt;
|
|
707
|
+
t > 24 ? (e < 1 / 0 && (At = setTimeout(Le, e - Et.now() - Jt)), kt && (kt = clearInterval(kt))) : (kt || (Wt = Et.now(), kt = setInterval(Or, kn)), mt = 1, Mn(Le));
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
function Re(e, t, n) {
|
|
711
|
+
var i = new Ut();
|
|
712
|
+
return t = t == null ? 0 : +t, i.restart((r) => {
|
|
713
|
+
i.stop(), e(r + t);
|
|
714
|
+
}, t, n), i;
|
|
715
|
+
}
|
|
716
|
+
var Hr = bn("start", "end", "cancel", "interrupt"), Br = [], Pn = 0, Oe = 1, ce = 2, zt = 3, ze = 4, he = 5, Ht = 6;
|
|
717
|
+
function Qt(e, t, n, i, r, s) {
|
|
718
|
+
var o = e.__transition;
|
|
719
|
+
if (!o) e.__transition = {};
|
|
720
|
+
else if (n in o) return;
|
|
721
|
+
Xr(e, n, {
|
|
722
|
+
name: t,
|
|
723
|
+
index: i,
|
|
724
|
+
// For context during callback.
|
|
725
|
+
group: r,
|
|
726
|
+
// For context during callback.
|
|
727
|
+
on: Hr,
|
|
728
|
+
tween: Br,
|
|
729
|
+
time: s.time,
|
|
730
|
+
delay: s.delay,
|
|
731
|
+
duration: s.duration,
|
|
732
|
+
ease: s.ease,
|
|
733
|
+
timer: null,
|
|
734
|
+
state: Pn
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
function be(e, t) {
|
|
738
|
+
var n = Q(e, t);
|
|
739
|
+
if (n.state > Pn) throw new Error("too late; already scheduled");
|
|
740
|
+
return n;
|
|
741
|
+
}
|
|
742
|
+
function et(e, t) {
|
|
743
|
+
var n = Q(e, t);
|
|
744
|
+
if (n.state > zt) throw new Error("too late; already running");
|
|
745
|
+
return n;
|
|
746
|
+
}
|
|
747
|
+
function Q(e, t) {
|
|
748
|
+
var n = e.__transition;
|
|
749
|
+
if (!n || !(n = n[t])) throw new Error("transition not found");
|
|
750
|
+
return n;
|
|
751
|
+
}
|
|
752
|
+
function Xr(e, t, n) {
|
|
753
|
+
var i = e.__transition, r;
|
|
754
|
+
i[t] = n, n.timer = An(s, 0, n.time);
|
|
755
|
+
function s(l) {
|
|
756
|
+
n.state = Oe, n.timer.restart(o, n.delay, n.time), n.delay <= l && o(l - n.delay);
|
|
757
|
+
}
|
|
758
|
+
function o(l) {
|
|
759
|
+
var u, h, f, p;
|
|
760
|
+
if (n.state !== Oe) return c();
|
|
761
|
+
for (u in i)
|
|
762
|
+
if (p = i[u], p.name === n.name) {
|
|
763
|
+
if (p.state === zt) return Re(o);
|
|
764
|
+
p.state === ze ? (p.state = Ht, p.timer.stop(), p.on.call("interrupt", e, e.__data__, p.index, p.group), delete i[u]) : +u < t && (p.state = Ht, p.timer.stop(), p.on.call("cancel", e, e.__data__, p.index, p.group), delete i[u]);
|
|
765
|
+
}
|
|
766
|
+
if (Re(function() {
|
|
767
|
+
n.state === zt && (n.state = ze, n.timer.restart(a, n.delay, n.time), a(l));
|
|
768
|
+
}), n.state = ce, n.on.call("start", e, e.__data__, n.index, n.group), n.state === ce) {
|
|
769
|
+
for (n.state = zt, r = new Array(f = n.tween.length), u = 0, h = -1; u < f; ++u)
|
|
770
|
+
(p = n.tween[u].value.call(e, e.__data__, n.index, n.group)) && (r[++h] = p);
|
|
771
|
+
r.length = h + 1;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
function a(l) {
|
|
775
|
+
for (var u = l < n.duration ? n.ease.call(null, l / n.duration) : (n.timer.restart(c), n.state = he, 1), h = -1, f = r.length; ++h < f; )
|
|
776
|
+
r[h].call(e, u);
|
|
777
|
+
n.state === he && (n.on.call("end", e, e.__data__, n.index, n.group), c());
|
|
778
|
+
}
|
|
779
|
+
function c() {
|
|
780
|
+
n.state = Ht, n.timer.stop(), delete i[t];
|
|
781
|
+
for (var l in i) return;
|
|
782
|
+
delete e.__transition;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
function Wr(e, t) {
|
|
786
|
+
var n = e.__transition, i, r, s = !0, o;
|
|
787
|
+
if (n) {
|
|
788
|
+
t = t == null ? null : t + "";
|
|
789
|
+
for (o in n) {
|
|
790
|
+
if ((i = n[o]).name !== t) {
|
|
791
|
+
s = !1;
|
|
792
|
+
continue;
|
|
793
|
+
}
|
|
794
|
+
r = i.state > ce && i.state < he, i.state = Ht, i.timer.stop(), i.on.call(r ? "interrupt" : "cancel", e, e.__data__, i.index, i.group), delete n[o];
|
|
795
|
+
}
|
|
796
|
+
s && delete e.__transition;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
function Ur(e) {
|
|
800
|
+
return this.each(function() {
|
|
801
|
+
Wr(this, e);
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
function ke(e, t, n) {
|
|
805
|
+
e.prototype = t.prototype = n, n.constructor = e;
|
|
806
|
+
}
|
|
807
|
+
function Cn(e, t) {
|
|
808
|
+
var n = Object.create(e.prototype);
|
|
809
|
+
for (var i in t) n[i] = t[i];
|
|
810
|
+
return n;
|
|
811
|
+
}
|
|
812
|
+
function Nt() {
|
|
813
|
+
}
|
|
814
|
+
var St = 0.7, Yt = 1 / St, xt = "\\s*([+-]?\\d+)\\s*", It = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", tt = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", Yr = /^#([0-9a-f]{3,8})$/, qr = new RegExp(`^rgb\\(${xt},${xt},${xt}\\)$`), Gr = new RegExp(`^rgb\\(${tt},${tt},${tt}\\)$`), Kr = new RegExp(`^rgba\\(${xt},${xt},${xt},${It}\\)$`), Zr = new RegExp(`^rgba\\(${tt},${tt},${tt},${It}\\)$`), Jr = new RegExp(`^hsl\\(${It},${tt},${tt}\\)$`), Qr = new RegExp(`^hsla\\(${It},${tt},${tt},${It}\\)$`), He = {
|
|
815
|
+
aliceblue: 15792383,
|
|
816
|
+
antiquewhite: 16444375,
|
|
817
|
+
aqua: 65535,
|
|
818
|
+
aquamarine: 8388564,
|
|
819
|
+
azure: 15794175,
|
|
820
|
+
beige: 16119260,
|
|
821
|
+
bisque: 16770244,
|
|
822
|
+
black: 0,
|
|
823
|
+
blanchedalmond: 16772045,
|
|
824
|
+
blue: 255,
|
|
825
|
+
blueviolet: 9055202,
|
|
826
|
+
brown: 10824234,
|
|
827
|
+
burlywood: 14596231,
|
|
828
|
+
cadetblue: 6266528,
|
|
829
|
+
chartreuse: 8388352,
|
|
830
|
+
chocolate: 13789470,
|
|
831
|
+
coral: 16744272,
|
|
832
|
+
cornflowerblue: 6591981,
|
|
833
|
+
cornsilk: 16775388,
|
|
834
|
+
crimson: 14423100,
|
|
835
|
+
cyan: 65535,
|
|
836
|
+
darkblue: 139,
|
|
837
|
+
darkcyan: 35723,
|
|
838
|
+
darkgoldenrod: 12092939,
|
|
839
|
+
darkgray: 11119017,
|
|
840
|
+
darkgreen: 25600,
|
|
841
|
+
darkgrey: 11119017,
|
|
842
|
+
darkkhaki: 12433259,
|
|
843
|
+
darkmagenta: 9109643,
|
|
844
|
+
darkolivegreen: 5597999,
|
|
845
|
+
darkorange: 16747520,
|
|
846
|
+
darkorchid: 10040012,
|
|
847
|
+
darkred: 9109504,
|
|
848
|
+
darksalmon: 15308410,
|
|
849
|
+
darkseagreen: 9419919,
|
|
850
|
+
darkslateblue: 4734347,
|
|
851
|
+
darkslategray: 3100495,
|
|
852
|
+
darkslategrey: 3100495,
|
|
853
|
+
darkturquoise: 52945,
|
|
854
|
+
darkviolet: 9699539,
|
|
855
|
+
deeppink: 16716947,
|
|
856
|
+
deepskyblue: 49151,
|
|
857
|
+
dimgray: 6908265,
|
|
858
|
+
dimgrey: 6908265,
|
|
859
|
+
dodgerblue: 2003199,
|
|
860
|
+
firebrick: 11674146,
|
|
861
|
+
floralwhite: 16775920,
|
|
862
|
+
forestgreen: 2263842,
|
|
863
|
+
fuchsia: 16711935,
|
|
864
|
+
gainsboro: 14474460,
|
|
865
|
+
ghostwhite: 16316671,
|
|
866
|
+
gold: 16766720,
|
|
867
|
+
goldenrod: 14329120,
|
|
868
|
+
gray: 8421504,
|
|
869
|
+
green: 32768,
|
|
870
|
+
greenyellow: 11403055,
|
|
871
|
+
grey: 8421504,
|
|
872
|
+
honeydew: 15794160,
|
|
873
|
+
hotpink: 16738740,
|
|
874
|
+
indianred: 13458524,
|
|
875
|
+
indigo: 4915330,
|
|
876
|
+
ivory: 16777200,
|
|
877
|
+
khaki: 15787660,
|
|
878
|
+
lavender: 15132410,
|
|
879
|
+
lavenderblush: 16773365,
|
|
880
|
+
lawngreen: 8190976,
|
|
881
|
+
lemonchiffon: 16775885,
|
|
882
|
+
lightblue: 11393254,
|
|
883
|
+
lightcoral: 15761536,
|
|
884
|
+
lightcyan: 14745599,
|
|
885
|
+
lightgoldenrodyellow: 16448210,
|
|
886
|
+
lightgray: 13882323,
|
|
887
|
+
lightgreen: 9498256,
|
|
888
|
+
lightgrey: 13882323,
|
|
889
|
+
lightpink: 16758465,
|
|
890
|
+
lightsalmon: 16752762,
|
|
891
|
+
lightseagreen: 2142890,
|
|
892
|
+
lightskyblue: 8900346,
|
|
893
|
+
lightslategray: 7833753,
|
|
894
|
+
lightslategrey: 7833753,
|
|
895
|
+
lightsteelblue: 11584734,
|
|
896
|
+
lightyellow: 16777184,
|
|
897
|
+
lime: 65280,
|
|
898
|
+
limegreen: 3329330,
|
|
899
|
+
linen: 16445670,
|
|
900
|
+
magenta: 16711935,
|
|
901
|
+
maroon: 8388608,
|
|
902
|
+
mediumaquamarine: 6737322,
|
|
903
|
+
mediumblue: 205,
|
|
904
|
+
mediumorchid: 12211667,
|
|
905
|
+
mediumpurple: 9662683,
|
|
906
|
+
mediumseagreen: 3978097,
|
|
907
|
+
mediumslateblue: 8087790,
|
|
908
|
+
mediumspringgreen: 64154,
|
|
909
|
+
mediumturquoise: 4772300,
|
|
910
|
+
mediumvioletred: 13047173,
|
|
911
|
+
midnightblue: 1644912,
|
|
912
|
+
mintcream: 16121850,
|
|
913
|
+
mistyrose: 16770273,
|
|
914
|
+
moccasin: 16770229,
|
|
915
|
+
navajowhite: 16768685,
|
|
916
|
+
navy: 128,
|
|
917
|
+
oldlace: 16643558,
|
|
918
|
+
olive: 8421376,
|
|
919
|
+
olivedrab: 7048739,
|
|
920
|
+
orange: 16753920,
|
|
921
|
+
orangered: 16729344,
|
|
922
|
+
orchid: 14315734,
|
|
923
|
+
palegoldenrod: 15657130,
|
|
924
|
+
palegreen: 10025880,
|
|
925
|
+
paleturquoise: 11529966,
|
|
926
|
+
palevioletred: 14381203,
|
|
927
|
+
papayawhip: 16773077,
|
|
928
|
+
peachpuff: 16767673,
|
|
929
|
+
peru: 13468991,
|
|
930
|
+
pink: 16761035,
|
|
931
|
+
plum: 14524637,
|
|
932
|
+
powderblue: 11591910,
|
|
933
|
+
purple: 8388736,
|
|
934
|
+
rebeccapurple: 6697881,
|
|
935
|
+
red: 16711680,
|
|
936
|
+
rosybrown: 12357519,
|
|
937
|
+
royalblue: 4286945,
|
|
938
|
+
saddlebrown: 9127187,
|
|
939
|
+
salmon: 16416882,
|
|
940
|
+
sandybrown: 16032864,
|
|
941
|
+
seagreen: 3050327,
|
|
942
|
+
seashell: 16774638,
|
|
943
|
+
sienna: 10506797,
|
|
944
|
+
silver: 12632256,
|
|
945
|
+
skyblue: 8900331,
|
|
946
|
+
slateblue: 6970061,
|
|
947
|
+
slategray: 7372944,
|
|
948
|
+
slategrey: 7372944,
|
|
949
|
+
snow: 16775930,
|
|
950
|
+
springgreen: 65407,
|
|
951
|
+
steelblue: 4620980,
|
|
952
|
+
tan: 13808780,
|
|
953
|
+
teal: 32896,
|
|
954
|
+
thistle: 14204888,
|
|
955
|
+
tomato: 16737095,
|
|
956
|
+
turquoise: 4251856,
|
|
957
|
+
violet: 15631086,
|
|
958
|
+
wheat: 16113331,
|
|
959
|
+
white: 16777215,
|
|
960
|
+
whitesmoke: 16119285,
|
|
961
|
+
yellow: 16776960,
|
|
962
|
+
yellowgreen: 10145074
|
|
963
|
+
};
|
|
964
|
+
ke(Nt, _t, {
|
|
965
|
+
copy(e) {
|
|
966
|
+
return Object.assign(new this.constructor(), this, e);
|
|
967
|
+
},
|
|
968
|
+
displayable() {
|
|
969
|
+
return this.rgb().displayable();
|
|
970
|
+
},
|
|
971
|
+
hex: Be,
|
|
972
|
+
// Deprecated! Use color.formatHex.
|
|
973
|
+
formatHex: Be,
|
|
974
|
+
formatHex8: jr,
|
|
975
|
+
formatHsl: ts,
|
|
976
|
+
formatRgb: Xe,
|
|
977
|
+
toString: Xe
|
|
978
|
+
});
|
|
979
|
+
function Be() {
|
|
980
|
+
return this.rgb().formatHex();
|
|
981
|
+
}
|
|
982
|
+
function jr() {
|
|
983
|
+
return this.rgb().formatHex8();
|
|
984
|
+
}
|
|
985
|
+
function ts() {
|
|
986
|
+
return En(this).formatHsl();
|
|
987
|
+
}
|
|
988
|
+
function Xe() {
|
|
989
|
+
return this.rgb().formatRgb();
|
|
990
|
+
}
|
|
991
|
+
function _t(e) {
|
|
992
|
+
var t, n;
|
|
993
|
+
return e = (e + "").trim().toLowerCase(), (t = Yr.exec(e)) ? (n = t[1].length, t = parseInt(t[1], 16), n === 6 ? We(t) : n === 3 ? new U(t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, (t & 15) << 4 | t & 15, 1) : n === 8 ? Vt(t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, (t & 255) / 255) : n === 4 ? Vt(t >> 12 & 15 | t >> 8 & 240, t >> 8 & 15 | t >> 4 & 240, t >> 4 & 15 | t & 240, ((t & 15) << 4 | t & 15) / 255) : null) : (t = qr.exec(e)) ? new U(t[1], t[2], t[3], 1) : (t = Gr.exec(e)) ? new U(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, 1) : (t = Kr.exec(e)) ? Vt(t[1], t[2], t[3], t[4]) : (t = Zr.exec(e)) ? Vt(t[1] * 255 / 100, t[2] * 255 / 100, t[3] * 255 / 100, t[4]) : (t = Jr.exec(e)) ? qe(t[1], t[2] / 100, t[3] / 100, 1) : (t = Qr.exec(e)) ? qe(t[1], t[2] / 100, t[3] / 100, t[4]) : He.hasOwnProperty(e) ? We(He[e]) : e === "transparent" ? new U(NaN, NaN, NaN, 0) : null;
|
|
994
|
+
}
|
|
995
|
+
function We(e) {
|
|
996
|
+
return new U(e >> 16 & 255, e >> 8 & 255, e & 255, 1);
|
|
997
|
+
}
|
|
998
|
+
function Vt(e, t, n, i) {
|
|
999
|
+
return i <= 0 && (e = t = n = NaN), new U(e, t, n, i);
|
|
1000
|
+
}
|
|
1001
|
+
function es(e) {
|
|
1002
|
+
return e instanceof Nt || (e = _t(e)), e ? (e = e.rgb(), new U(e.r, e.g, e.b, e.opacity)) : new U();
|
|
1003
|
+
}
|
|
1004
|
+
function ue(e, t, n, i) {
|
|
1005
|
+
return arguments.length === 1 ? es(e) : new U(e, t, n, i ?? 1);
|
|
1006
|
+
}
|
|
1007
|
+
function U(e, t, n, i) {
|
|
1008
|
+
this.r = +e, this.g = +t, this.b = +n, this.opacity = +i;
|
|
1009
|
+
}
|
|
1010
|
+
ke(U, ue, Cn(Nt, {
|
|
1011
|
+
brighter(e) {
|
|
1012
|
+
return e = e == null ? Yt : Math.pow(Yt, e), new U(this.r * e, this.g * e, this.b * e, this.opacity);
|
|
1013
|
+
},
|
|
1014
|
+
darker(e) {
|
|
1015
|
+
return e = e == null ? St : Math.pow(St, e), new U(this.r * e, this.g * e, this.b * e, this.opacity);
|
|
1016
|
+
},
|
|
1017
|
+
rgb() {
|
|
1018
|
+
return this;
|
|
1019
|
+
},
|
|
1020
|
+
clamp() {
|
|
1021
|
+
return new U(dt(this.r), dt(this.g), dt(this.b), qt(this.opacity));
|
|
1022
|
+
},
|
|
1023
|
+
displayable() {
|
|
1024
|
+
return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
|
|
1025
|
+
},
|
|
1026
|
+
hex: Ue,
|
|
1027
|
+
// Deprecated! Use color.formatHex.
|
|
1028
|
+
formatHex: Ue,
|
|
1029
|
+
formatHex8: ns,
|
|
1030
|
+
formatRgb: Ye,
|
|
1031
|
+
toString: Ye
|
|
1032
|
+
}));
|
|
1033
|
+
function Ue() {
|
|
1034
|
+
return `#${ft(this.r)}${ft(this.g)}${ft(this.b)}`;
|
|
1035
|
+
}
|
|
1036
|
+
function ns() {
|
|
1037
|
+
return `#${ft(this.r)}${ft(this.g)}${ft(this.b)}${ft((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
|
1038
|
+
}
|
|
1039
|
+
function Ye() {
|
|
1040
|
+
const e = qt(this.opacity);
|
|
1041
|
+
return `${e === 1 ? "rgb(" : "rgba("}${dt(this.r)}, ${dt(this.g)}, ${dt(this.b)}${e === 1 ? ")" : `, ${e})`}`;
|
|
1042
|
+
}
|
|
1043
|
+
function qt(e) {
|
|
1044
|
+
return isNaN(e) ? 1 : Math.max(0, Math.min(1, e));
|
|
1045
|
+
}
|
|
1046
|
+
function dt(e) {
|
|
1047
|
+
return Math.max(0, Math.min(255, Math.round(e) || 0));
|
|
1048
|
+
}
|
|
1049
|
+
function ft(e) {
|
|
1050
|
+
return e = dt(e), (e < 16 ? "0" : "") + e.toString(16);
|
|
1051
|
+
}
|
|
1052
|
+
function qe(e, t, n, i) {
|
|
1053
|
+
return i <= 0 ? e = t = n = NaN : n <= 0 || n >= 1 ? e = t = NaN : t <= 0 && (e = NaN), new J(e, t, n, i);
|
|
1054
|
+
}
|
|
1055
|
+
function En(e) {
|
|
1056
|
+
if (e instanceof J) return new J(e.h, e.s, e.l, e.opacity);
|
|
1057
|
+
if (e instanceof Nt || (e = _t(e)), !e) return new J();
|
|
1058
|
+
if (e instanceof J) return e;
|
|
1059
|
+
e = e.rgb();
|
|
1060
|
+
var t = e.r / 255, n = e.g / 255, i = e.b / 255, r = Math.min(t, n, i), s = Math.max(t, n, i), o = NaN, a = s - r, c = (s + r) / 2;
|
|
1061
|
+
return a ? (t === s ? o = (n - i) / a + (n < i) * 6 : n === s ? o = (i - t) / a + 2 : o = (t - n) / a + 4, a /= c < 0.5 ? s + r : 2 - s - r, o *= 60) : a = c > 0 && c < 1 ? 0 : o, new J(o, a, c, e.opacity);
|
|
1062
|
+
}
|
|
1063
|
+
function is(e, t, n, i) {
|
|
1064
|
+
return arguments.length === 1 ? En(e) : new J(e, t, n, i ?? 1);
|
|
1065
|
+
}
|
|
1066
|
+
function J(e, t, n, i) {
|
|
1067
|
+
this.h = +e, this.s = +t, this.l = +n, this.opacity = +i;
|
|
1068
|
+
}
|
|
1069
|
+
ke(J, is, Cn(Nt, {
|
|
1070
|
+
brighter(e) {
|
|
1071
|
+
return e = e == null ? Yt : Math.pow(Yt, e), new J(this.h, this.s, this.l * e, this.opacity);
|
|
1072
|
+
},
|
|
1073
|
+
darker(e) {
|
|
1074
|
+
return e = e == null ? St : Math.pow(St, e), new J(this.h, this.s, this.l * e, this.opacity);
|
|
1075
|
+
},
|
|
1076
|
+
rgb() {
|
|
1077
|
+
var e = this.h % 360 + (this.h < 0) * 360, t = isNaN(e) || isNaN(this.s) ? 0 : this.s, n = this.l, i = n + (n < 0.5 ? n : 1 - n) * t, r = 2 * n - i;
|
|
1078
|
+
return new U(
|
|
1079
|
+
ee(e >= 240 ? e - 240 : e + 120, r, i),
|
|
1080
|
+
ee(e, r, i),
|
|
1081
|
+
ee(e < 120 ? e + 240 : e - 120, r, i),
|
|
1082
|
+
this.opacity
|
|
1083
|
+
);
|
|
1084
|
+
},
|
|
1085
|
+
clamp() {
|
|
1086
|
+
return new J(Ge(this.h), Dt(this.s), Dt(this.l), qt(this.opacity));
|
|
1087
|
+
},
|
|
1088
|
+
displayable() {
|
|
1089
|
+
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
|
|
1090
|
+
},
|
|
1091
|
+
formatHsl() {
|
|
1092
|
+
const e = qt(this.opacity);
|
|
1093
|
+
return `${e === 1 ? "hsl(" : "hsla("}${Ge(this.h)}, ${Dt(this.s) * 100}%, ${Dt(this.l) * 100}%${e === 1 ? ")" : `, ${e})`}`;
|
|
1094
|
+
}
|
|
1095
|
+
}));
|
|
1096
|
+
function Ge(e) {
|
|
1097
|
+
return e = (e || 0) % 360, e < 0 ? e + 360 : e;
|
|
1098
|
+
}
|
|
1099
|
+
function Dt(e) {
|
|
1100
|
+
return Math.max(0, Math.min(1, e || 0));
|
|
1101
|
+
}
|
|
1102
|
+
function ee(e, t, n) {
|
|
1103
|
+
return (e < 60 ? t + (n - t) * e / 60 : e < 180 ? n : e < 240 ? t + (n - t) * (240 - e) / 60 : t) * 255;
|
|
1104
|
+
}
|
|
1105
|
+
const Sn = (e) => () => e;
|
|
1106
|
+
function rs(e, t) {
|
|
1107
|
+
return function(n) {
|
|
1108
|
+
return e + n * t;
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
function ss(e, t, n) {
|
|
1112
|
+
return e = Math.pow(e, n), t = Math.pow(t, n) - e, n = 1 / n, function(i) {
|
|
1113
|
+
return Math.pow(e + i * t, n);
|
|
1114
|
+
};
|
|
1115
|
+
}
|
|
1116
|
+
function os(e) {
|
|
1117
|
+
return (e = +e) == 1 ? In : function(t, n) {
|
|
1118
|
+
return n - t ? ss(t, n, e) : Sn(isNaN(t) ? n : t);
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
function In(e, t) {
|
|
1122
|
+
var n = t - e;
|
|
1123
|
+
return n ? rs(e, n) : Sn(isNaN(e) ? t : e);
|
|
1124
|
+
}
|
|
1125
|
+
const Ke = function e(t) {
|
|
1126
|
+
var n = os(t);
|
|
1127
|
+
function i(r, s) {
|
|
1128
|
+
var o = n((r = ue(r)).r, (s = ue(s)).r), a = n(r.g, s.g), c = n(r.b, s.b), l = In(r.opacity, s.opacity);
|
|
1129
|
+
return function(u) {
|
|
1130
|
+
return r.r = o(u), r.g = a(u), r.b = c(u), r.opacity = l(u), r + "";
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
return i.gamma = e, i;
|
|
1134
|
+
}(1);
|
|
1135
|
+
function at(e, t) {
|
|
1136
|
+
return e = +e, t = +t, function(n) {
|
|
1137
|
+
return e * (1 - n) + t * n;
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
var fe = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, ne = new RegExp(fe.source, "g");
|
|
1141
|
+
function as(e) {
|
|
1142
|
+
return function() {
|
|
1143
|
+
return e;
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
function ls(e) {
|
|
1147
|
+
return function(t) {
|
|
1148
|
+
return e(t) + "";
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1151
|
+
function cs(e, t) {
|
|
1152
|
+
var n = fe.lastIndex = ne.lastIndex = 0, i, r, s, o = -1, a = [], c = [];
|
|
1153
|
+
for (e = e + "", t = t + ""; (i = fe.exec(e)) && (r = ne.exec(t)); )
|
|
1154
|
+
(s = r.index) > n && (s = t.slice(n, s), a[o] ? a[o] += s : a[++o] = s), (i = i[0]) === (r = r[0]) ? a[o] ? a[o] += r : a[++o] = r : (a[++o] = null, c.push({ i: o, x: at(i, r) })), n = ne.lastIndex;
|
|
1155
|
+
return n < t.length && (s = t.slice(n), a[o] ? a[o] += s : a[++o] = s), a.length < 2 ? c[0] ? ls(c[0].x) : as(t) : (t = c.length, function(l) {
|
|
1156
|
+
for (var u = 0, h; u < t; ++u) a[(h = c[u]).i] = h.x(l);
|
|
1157
|
+
return a.join("");
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
var Ze = 180 / Math.PI, de = {
|
|
1161
|
+
translateX: 0,
|
|
1162
|
+
translateY: 0,
|
|
1163
|
+
rotate: 0,
|
|
1164
|
+
skewX: 0,
|
|
1165
|
+
scaleX: 1,
|
|
1166
|
+
scaleY: 1
|
|
1167
|
+
};
|
|
1168
|
+
function Tn(e, t, n, i, r, s) {
|
|
1169
|
+
var o, a, c;
|
|
1170
|
+
return (o = Math.sqrt(e * e + t * t)) && (e /= o, t /= o), (c = e * n + t * i) && (n -= e * c, i -= t * c), (a = Math.sqrt(n * n + i * i)) && (n /= a, i /= a, c /= a), e * i < t * n && (e = -e, t = -t, c = -c, o = -o), {
|
|
1171
|
+
translateX: r,
|
|
1172
|
+
translateY: s,
|
|
1173
|
+
rotate: Math.atan2(t, e) * Ze,
|
|
1174
|
+
skewX: Math.atan(c) * Ze,
|
|
1175
|
+
scaleX: o,
|
|
1176
|
+
scaleY: a
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
var Lt;
|
|
1180
|
+
function hs(e) {
|
|
1181
|
+
const t = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(e + "");
|
|
1182
|
+
return t.isIdentity ? de : Tn(t.a, t.b, t.c, t.d, t.e, t.f);
|
|
1183
|
+
}
|
|
1184
|
+
function us(e) {
|
|
1185
|
+
return e == null || (Lt || (Lt = document.createElementNS("http://www.w3.org/2000/svg", "g")), Lt.setAttribute("transform", e), !(e = Lt.transform.baseVal.consolidate())) ? de : (e = e.matrix, Tn(e.a, e.b, e.c, e.d, e.e, e.f));
|
|
1186
|
+
}
|
|
1187
|
+
function $n(e, t, n, i) {
|
|
1188
|
+
function r(l) {
|
|
1189
|
+
return l.length ? l.pop() + " " : "";
|
|
1190
|
+
}
|
|
1191
|
+
function s(l, u, h, f, p, d) {
|
|
1192
|
+
if (l !== h || u !== f) {
|
|
1193
|
+
var y = p.push("translate(", null, t, null, n);
|
|
1194
|
+
d.push({ i: y - 4, x: at(l, h) }, { i: y - 2, x: at(u, f) });
|
|
1195
|
+
} else (h || f) && p.push("translate(" + h + t + f + n);
|
|
1196
|
+
}
|
|
1197
|
+
function o(l, u, h, f) {
|
|
1198
|
+
l !== u ? (l - u > 180 ? u += 360 : u - l > 180 && (l += 360), f.push({ i: h.push(r(h) + "rotate(", null, i) - 2, x: at(l, u) })) : u && h.push(r(h) + "rotate(" + u + i);
|
|
1199
|
+
}
|
|
1200
|
+
function a(l, u, h, f) {
|
|
1201
|
+
l !== u ? f.push({ i: h.push(r(h) + "skewX(", null, i) - 2, x: at(l, u) }) : u && h.push(r(h) + "skewX(" + u + i);
|
|
1202
|
+
}
|
|
1203
|
+
function c(l, u, h, f, p, d) {
|
|
1204
|
+
if (l !== h || u !== f) {
|
|
1205
|
+
var y = p.push(r(p) + "scale(", null, ",", null, ")");
|
|
1206
|
+
d.push({ i: y - 4, x: at(l, h) }, { i: y - 2, x: at(u, f) });
|
|
1207
|
+
} else (h !== 1 || f !== 1) && p.push(r(p) + "scale(" + h + "," + f + ")");
|
|
1208
|
+
}
|
|
1209
|
+
return function(l, u) {
|
|
1210
|
+
var h = [], f = [];
|
|
1211
|
+
return l = e(l), u = e(u), s(l.translateX, l.translateY, u.translateX, u.translateY, h, f), o(l.rotate, u.rotate, h, f), a(l.skewX, u.skewX, h, f), c(l.scaleX, l.scaleY, u.scaleX, u.scaleY, h, f), l = u = null, function(p) {
|
|
1212
|
+
for (var d = -1, y = f.length, m; ++d < y; ) h[(m = f[d]).i] = m.x(p);
|
|
1213
|
+
return h.join("");
|
|
1214
|
+
};
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
var fs = $n(hs, "px, ", "px)", "deg)"), ds = $n(us, ", ", ")", ")");
|
|
1218
|
+
function ps(e, t) {
|
|
1219
|
+
var n, i;
|
|
1220
|
+
return function() {
|
|
1221
|
+
var r = et(this, e), s = r.tween;
|
|
1222
|
+
if (s !== n) {
|
|
1223
|
+
i = n = s;
|
|
1224
|
+
for (var o = 0, a = i.length; o < a; ++o)
|
|
1225
|
+
if (i[o].name === t) {
|
|
1226
|
+
i = i.slice(), i.splice(o, 1);
|
|
1227
|
+
break;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
r.tween = i;
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
function gs(e, t, n) {
|
|
1234
|
+
var i, r;
|
|
1235
|
+
if (typeof n != "function") throw new Error();
|
|
1236
|
+
return function() {
|
|
1237
|
+
var s = et(this, e), o = s.tween;
|
|
1238
|
+
if (o !== i) {
|
|
1239
|
+
r = (i = o).slice();
|
|
1240
|
+
for (var a = { name: t, value: n }, c = 0, l = r.length; c < l; ++c)
|
|
1241
|
+
if (r[c].name === t) {
|
|
1242
|
+
r[c] = a;
|
|
1243
|
+
break;
|
|
1244
|
+
}
|
|
1245
|
+
c === l && r.push(a);
|
|
1246
|
+
}
|
|
1247
|
+
s.tween = r;
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
1250
|
+
function xs(e, t) {
|
|
1251
|
+
var n = this._id;
|
|
1252
|
+
if (e += "", arguments.length < 2) {
|
|
1253
|
+
for (var i = Q(this.node(), n).tween, r = 0, s = i.length, o; r < s; ++r)
|
|
1254
|
+
if ((o = i[r]).name === e)
|
|
1255
|
+
return o.value;
|
|
1256
|
+
return null;
|
|
1257
|
+
}
|
|
1258
|
+
return this.each((t == null ? ps : gs)(n, e, t));
|
|
1259
|
+
}
|
|
1260
|
+
function Me(e, t, n) {
|
|
1261
|
+
var i = e._id;
|
|
1262
|
+
return e.each(function() {
|
|
1263
|
+
var r = et(this, i);
|
|
1264
|
+
(r.value || (r.value = {}))[t] = n.apply(this, arguments);
|
|
1265
|
+
}), function(r) {
|
|
1266
|
+
return Q(r, i).value[t];
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
function Nn(e, t) {
|
|
1270
|
+
var n;
|
|
1271
|
+
return (typeof t == "number" ? at : t instanceof _t ? Ke : (n = _t(t)) ? (t = n, Ke) : cs)(e, t);
|
|
1272
|
+
}
|
|
1273
|
+
function ys(e) {
|
|
1274
|
+
return function() {
|
|
1275
|
+
this.removeAttribute(e);
|
|
1276
|
+
};
|
|
1277
|
+
}
|
|
1278
|
+
function ms(e) {
|
|
1279
|
+
return function() {
|
|
1280
|
+
this.removeAttributeNS(e.space, e.local);
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
function _s(e, t, n) {
|
|
1284
|
+
var i, r = n + "", s;
|
|
1285
|
+
return function() {
|
|
1286
|
+
var o = this.getAttribute(e);
|
|
1287
|
+
return o === r ? null : o === i ? s : s = t(i = o, n);
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
function ws(e, t, n) {
|
|
1291
|
+
var i, r = n + "", s;
|
|
1292
|
+
return function() {
|
|
1293
|
+
var o = this.getAttributeNS(e.space, e.local);
|
|
1294
|
+
return o === r ? null : o === i ? s : s = t(i = o, n);
|
|
1295
|
+
};
|
|
1296
|
+
}
|
|
1297
|
+
function vs(e, t, n) {
|
|
1298
|
+
var i, r, s;
|
|
1299
|
+
return function() {
|
|
1300
|
+
var o, a = n(this), c;
|
|
1301
|
+
return a == null ? void this.removeAttribute(e) : (o = this.getAttribute(e), c = a + "", o === c ? null : o === i && c === r ? s : (r = c, s = t(i = o, a)));
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
function bs(e, t, n) {
|
|
1305
|
+
var i, r, s;
|
|
1306
|
+
return function() {
|
|
1307
|
+
var o, a = n(this), c;
|
|
1308
|
+
return a == null ? void this.removeAttributeNS(e.space, e.local) : (o = this.getAttributeNS(e.space, e.local), c = a + "", o === c ? null : o === i && c === r ? s : (r = c, s = t(i = o, a)));
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
function ks(e, t) {
|
|
1312
|
+
var n = Zt(e), i = n === "transform" ? ds : Nn;
|
|
1313
|
+
return this.attrTween(e, typeof t == "function" ? (n.local ? bs : vs)(n, i, Me(this, "attr." + e, t)) : t == null ? (n.local ? ms : ys)(n) : (n.local ? ws : _s)(n, i, t));
|
|
1314
|
+
}
|
|
1315
|
+
function Ms(e, t) {
|
|
1316
|
+
return function(n) {
|
|
1317
|
+
this.setAttribute(e, t.call(this, n));
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
function As(e, t) {
|
|
1321
|
+
return function(n) {
|
|
1322
|
+
this.setAttributeNS(e.space, e.local, t.call(this, n));
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
function Ps(e, t) {
|
|
1326
|
+
var n, i;
|
|
1327
|
+
function r() {
|
|
1328
|
+
var s = t.apply(this, arguments);
|
|
1329
|
+
return s !== i && (n = (i = s) && As(e, s)), n;
|
|
1330
|
+
}
|
|
1331
|
+
return r._value = t, r;
|
|
1332
|
+
}
|
|
1333
|
+
function Cs(e, t) {
|
|
1334
|
+
var n, i;
|
|
1335
|
+
function r() {
|
|
1336
|
+
var s = t.apply(this, arguments);
|
|
1337
|
+
return s !== i && (n = (i = s) && Ms(e, s)), n;
|
|
1338
|
+
}
|
|
1339
|
+
return r._value = t, r;
|
|
1340
|
+
}
|
|
1341
|
+
function Es(e, t) {
|
|
1342
|
+
var n = "attr." + e;
|
|
1343
|
+
if (arguments.length < 2) return (n = this.tween(n)) && n._value;
|
|
1344
|
+
if (t == null) return this.tween(n, null);
|
|
1345
|
+
if (typeof t != "function") throw new Error();
|
|
1346
|
+
var i = Zt(e);
|
|
1347
|
+
return this.tween(n, (i.local ? Ps : Cs)(i, t));
|
|
1348
|
+
}
|
|
1349
|
+
function Ss(e, t) {
|
|
1350
|
+
return function() {
|
|
1351
|
+
be(this, e).delay = +t.apply(this, arguments);
|
|
1352
|
+
};
|
|
1353
|
+
}
|
|
1354
|
+
function Is(e, t) {
|
|
1355
|
+
return t = +t, function() {
|
|
1356
|
+
be(this, e).delay = t;
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1359
|
+
function Ts(e) {
|
|
1360
|
+
var t = this._id;
|
|
1361
|
+
return arguments.length ? this.each((typeof e == "function" ? Ss : Is)(t, e)) : Q(this.node(), t).delay;
|
|
1362
|
+
}
|
|
1363
|
+
function $s(e, t) {
|
|
1364
|
+
return function() {
|
|
1365
|
+
et(this, e).duration = +t.apply(this, arguments);
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
function Ns(e, t) {
|
|
1369
|
+
return t = +t, function() {
|
|
1370
|
+
et(this, e).duration = t;
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
function Fs(e) {
|
|
1374
|
+
var t = this._id;
|
|
1375
|
+
return arguments.length ? this.each((typeof e == "function" ? $s : Ns)(t, e)) : Q(this.node(), t).duration;
|
|
1376
|
+
}
|
|
1377
|
+
function Vs(e, t) {
|
|
1378
|
+
if (typeof t != "function") throw new Error();
|
|
1379
|
+
return function() {
|
|
1380
|
+
et(this, e).ease = t;
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
function Ds(e) {
|
|
1384
|
+
var t = this._id;
|
|
1385
|
+
return arguments.length ? this.each(Vs(t, e)) : Q(this.node(), t).ease;
|
|
1386
|
+
}
|
|
1387
|
+
function Ls(e, t) {
|
|
1388
|
+
return function() {
|
|
1389
|
+
var n = t.apply(this, arguments);
|
|
1390
|
+
if (typeof n != "function") throw new Error();
|
|
1391
|
+
et(this, e).ease = n;
|
|
1392
|
+
};
|
|
1393
|
+
}
|
|
1394
|
+
function Rs(e) {
|
|
1395
|
+
if (typeof e != "function") throw new Error();
|
|
1396
|
+
return this.each(Ls(this._id, e));
|
|
1397
|
+
}
|
|
1398
|
+
function Os(e) {
|
|
1399
|
+
typeof e != "function" && (e = fn(e));
|
|
1400
|
+
for (var t = this._groups, n = t.length, i = new Array(n), r = 0; r < n; ++r)
|
|
1401
|
+
for (var s = t[r], o = s.length, a = i[r] = [], c, l = 0; l < o; ++l)
|
|
1402
|
+
(c = s[l]) && e.call(c, c.__data__, l, s) && a.push(c);
|
|
1403
|
+
return new rt(i, this._parents, this._name, this._id);
|
|
1404
|
+
}
|
|
1405
|
+
function zs(e) {
|
|
1406
|
+
if (e._id !== this._id) throw new Error();
|
|
1407
|
+
for (var t = this._groups, n = e._groups, i = t.length, r = n.length, s = Math.min(i, r), o = new Array(i), a = 0; a < s; ++a)
|
|
1408
|
+
for (var c = t[a], l = n[a], u = c.length, h = o[a] = new Array(u), f, p = 0; p < u; ++p)
|
|
1409
|
+
(f = c[p] || l[p]) && (h[p] = f);
|
|
1410
|
+
for (; a < i; ++a)
|
|
1411
|
+
o[a] = t[a];
|
|
1412
|
+
return new rt(o, this._parents, this._name, this._id);
|
|
1413
|
+
}
|
|
1414
|
+
function Hs(e) {
|
|
1415
|
+
return (e + "").trim().split(/^|\s+/).every(function(t) {
|
|
1416
|
+
var n = t.indexOf(".");
|
|
1417
|
+
return n >= 0 && (t = t.slice(0, n)), !t || t === "start";
|
|
1418
|
+
});
|
|
1419
|
+
}
|
|
1420
|
+
function Bs(e, t, n) {
|
|
1421
|
+
var i, r, s = Hs(t) ? be : et;
|
|
1422
|
+
return function() {
|
|
1423
|
+
var o = s(this, e), a = o.on;
|
|
1424
|
+
a !== i && (r = (i = a).copy()).on(t, n), o.on = r;
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
function Xs(e, t) {
|
|
1428
|
+
var n = this._id;
|
|
1429
|
+
return arguments.length < 2 ? Q(this.node(), n).on.on(e) : this.each(Bs(n, e, t));
|
|
1430
|
+
}
|
|
1431
|
+
function Ws(e) {
|
|
1432
|
+
return function() {
|
|
1433
|
+
var t = this.parentNode;
|
|
1434
|
+
for (var n in this.__transition) if (+n !== e) return;
|
|
1435
|
+
t && t.removeChild(this);
|
|
1436
|
+
};
|
|
1437
|
+
}
|
|
1438
|
+
function Us() {
|
|
1439
|
+
return this.on("end.remove", Ws(this._id));
|
|
1440
|
+
}
|
|
1441
|
+
function Ys(e) {
|
|
1442
|
+
var t = this._name, n = this._id;
|
|
1443
|
+
typeof e != "function" && (e = _e(e));
|
|
1444
|
+
for (var i = this._groups, r = i.length, s = new Array(r), o = 0; o < r; ++o)
|
|
1445
|
+
for (var a = i[o], c = a.length, l = s[o] = new Array(c), u, h, f = 0; f < c; ++f)
|
|
1446
|
+
(u = a[f]) && (h = e.call(u, u.__data__, f, a)) && ("__data__" in u && (h.__data__ = u.__data__), l[f] = h, Qt(l[f], t, n, f, l, Q(u, n)));
|
|
1447
|
+
return new rt(s, this._parents, t, n);
|
|
1448
|
+
}
|
|
1449
|
+
function qs(e) {
|
|
1450
|
+
var t = this._name, n = this._id;
|
|
1451
|
+
typeof e != "function" && (e = un(e));
|
|
1452
|
+
for (var i = this._groups, r = i.length, s = [], o = [], a = 0; a < r; ++a)
|
|
1453
|
+
for (var c = i[a], l = c.length, u, h = 0; h < l; ++h)
|
|
1454
|
+
if (u = c[h]) {
|
|
1455
|
+
for (var f = e.call(u, u.__data__, h, c), p, d = Q(u, n), y = 0, m = f.length; y < m; ++y)
|
|
1456
|
+
(p = f[y]) && Qt(p, t, n, y, f, d);
|
|
1457
|
+
s.push(f), o.push(u);
|
|
1458
|
+
}
|
|
1459
|
+
return new rt(s, o, t, n);
|
|
1460
|
+
}
|
|
1461
|
+
var Gs = $t.prototype.constructor;
|
|
1462
|
+
function Ks() {
|
|
1463
|
+
return new Gs(this._groups, this._parents);
|
|
1464
|
+
}
|
|
1465
|
+
function Zs(e, t) {
|
|
1466
|
+
var n, i, r;
|
|
1467
|
+
return function() {
|
|
1468
|
+
var s = yt(this, e), o = (this.style.removeProperty(e), yt(this, e));
|
|
1469
|
+
return s === o ? null : s === n && o === i ? r : r = t(n = s, i = o);
|
|
1470
|
+
};
|
|
1471
|
+
}
|
|
1472
|
+
function Fn(e) {
|
|
1473
|
+
return function() {
|
|
1474
|
+
this.style.removeProperty(e);
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
function Js(e, t, n) {
|
|
1478
|
+
var i, r = n + "", s;
|
|
1479
|
+
return function() {
|
|
1480
|
+
var o = yt(this, e);
|
|
1481
|
+
return o === r ? null : o === i ? s : s = t(i = o, n);
|
|
1482
|
+
};
|
|
1483
|
+
}
|
|
1484
|
+
function Qs(e, t, n) {
|
|
1485
|
+
var i, r, s;
|
|
1486
|
+
return function() {
|
|
1487
|
+
var o = yt(this, e), a = n(this), c = a + "";
|
|
1488
|
+
return a == null && (c = a = (this.style.removeProperty(e), yt(this, e))), o === c ? null : o === i && c === r ? s : (r = c, s = t(i = o, a));
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1491
|
+
function js(e, t) {
|
|
1492
|
+
var n, i, r, s = "style." + t, o = "end." + s, a;
|
|
1493
|
+
return function() {
|
|
1494
|
+
var c = et(this, e), l = c.on, u = c.value[s] == null ? a || (a = Fn(t)) : void 0;
|
|
1495
|
+
(l !== n || r !== u) && (i = (n = l).copy()).on(o, r = u), c.on = i;
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
function to(e, t, n) {
|
|
1499
|
+
var i = (e += "") == "transform" ? fs : Nn;
|
|
1500
|
+
return t == null ? this.styleTween(e, Zs(e, i)).on("end.style." + e, Fn(e)) : typeof t == "function" ? this.styleTween(e, Qs(e, i, Me(this, "style." + e, t))).each(js(this._id, e)) : this.styleTween(e, Js(e, i, t), n).on("end.style." + e, null);
|
|
1501
|
+
}
|
|
1502
|
+
function eo(e, t, n) {
|
|
1503
|
+
return function(i) {
|
|
1504
|
+
this.style.setProperty(e, t.call(this, i), n);
|
|
1505
|
+
};
|
|
1506
|
+
}
|
|
1507
|
+
function no(e, t, n) {
|
|
1508
|
+
var i, r;
|
|
1509
|
+
function s() {
|
|
1510
|
+
var o = t.apply(this, arguments);
|
|
1511
|
+
return o !== r && (i = (r = o) && eo(e, o, n)), i;
|
|
1512
|
+
}
|
|
1513
|
+
return s._value = t, s;
|
|
1514
|
+
}
|
|
1515
|
+
function io(e, t, n) {
|
|
1516
|
+
var i = "style." + (e += "");
|
|
1517
|
+
if (arguments.length < 2) return (i = this.tween(i)) && i._value;
|
|
1518
|
+
if (t == null) return this.tween(i, null);
|
|
1519
|
+
if (typeof t != "function") throw new Error();
|
|
1520
|
+
return this.tween(i, no(e, t, n ?? ""));
|
|
1521
|
+
}
|
|
1522
|
+
function ro(e) {
|
|
1523
|
+
return function() {
|
|
1524
|
+
this.textContent = e;
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
function so(e) {
|
|
1528
|
+
return function() {
|
|
1529
|
+
var t = e(this);
|
|
1530
|
+
this.textContent = t ?? "";
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
function oo(e) {
|
|
1534
|
+
return this.tween("text", typeof e == "function" ? so(Me(this, "text", e)) : ro(e == null ? "" : e + ""));
|
|
1535
|
+
}
|
|
1536
|
+
function ao(e) {
|
|
1537
|
+
return function(t) {
|
|
1538
|
+
this.textContent = e.call(this, t);
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
function lo(e) {
|
|
1542
|
+
var t, n;
|
|
1543
|
+
function i() {
|
|
1544
|
+
var r = e.apply(this, arguments);
|
|
1545
|
+
return r !== n && (t = (n = r) && ao(r)), t;
|
|
1546
|
+
}
|
|
1547
|
+
return i._value = e, i;
|
|
1548
|
+
}
|
|
1549
|
+
function co(e) {
|
|
1550
|
+
var t = "text";
|
|
1551
|
+
if (arguments.length < 1) return (t = this.tween(t)) && t._value;
|
|
1552
|
+
if (e == null) return this.tween(t, null);
|
|
1553
|
+
if (typeof e != "function") throw new Error();
|
|
1554
|
+
return this.tween(t, lo(e));
|
|
1555
|
+
}
|
|
1556
|
+
function ho() {
|
|
1557
|
+
for (var e = this._name, t = this._id, n = Vn(), i = this._groups, r = i.length, s = 0; s < r; ++s)
|
|
1558
|
+
for (var o = i[s], a = o.length, c, l = 0; l < a; ++l)
|
|
1559
|
+
if (c = o[l]) {
|
|
1560
|
+
var u = Q(c, t);
|
|
1561
|
+
Qt(c, e, n, l, o, {
|
|
1562
|
+
time: u.time + u.delay + u.duration,
|
|
1563
|
+
delay: 0,
|
|
1564
|
+
duration: u.duration,
|
|
1565
|
+
ease: u.ease
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
return new rt(i, this._parents, e, n);
|
|
1569
|
+
}
|
|
1570
|
+
function uo() {
|
|
1571
|
+
var e, t, n = this, i = n._id, r = n.size();
|
|
1572
|
+
return new Promise(function(s, o) {
|
|
1573
|
+
var a = { value: o }, c = { value: function() {
|
|
1574
|
+
--r === 0 && s();
|
|
1575
|
+
} };
|
|
1576
|
+
n.each(function() {
|
|
1577
|
+
var l = et(this, i), u = l.on;
|
|
1578
|
+
u !== e && (t = (e = u).copy(), t._.cancel.push(a), t._.interrupt.push(a), t._.end.push(c)), l.on = t;
|
|
1579
|
+
}), r === 0 && s();
|
|
1580
|
+
});
|
|
1581
|
+
}
|
|
1582
|
+
var fo = 0;
|
|
1583
|
+
function rt(e, t, n, i) {
|
|
1584
|
+
this._groups = e, this._parents = t, this._name = n, this._id = i;
|
|
1585
|
+
}
|
|
1586
|
+
function Vn() {
|
|
1587
|
+
return ++fo;
|
|
1588
|
+
}
|
|
1589
|
+
var it = $t.prototype;
|
|
1590
|
+
rt.prototype = {
|
|
1591
|
+
constructor: rt,
|
|
1592
|
+
select: Ys,
|
|
1593
|
+
selectAll: qs,
|
|
1594
|
+
selectChild: it.selectChild,
|
|
1595
|
+
selectChildren: it.selectChildren,
|
|
1596
|
+
filter: Os,
|
|
1597
|
+
merge: zs,
|
|
1598
|
+
selection: Ks,
|
|
1599
|
+
transition: ho,
|
|
1600
|
+
call: it.call,
|
|
1601
|
+
nodes: it.nodes,
|
|
1602
|
+
node: it.node,
|
|
1603
|
+
size: it.size,
|
|
1604
|
+
empty: it.empty,
|
|
1605
|
+
each: it.each,
|
|
1606
|
+
on: Xs,
|
|
1607
|
+
attr: ks,
|
|
1608
|
+
attrTween: Es,
|
|
1609
|
+
style: to,
|
|
1610
|
+
styleTween: io,
|
|
1611
|
+
text: oo,
|
|
1612
|
+
textTween: co,
|
|
1613
|
+
remove: Us,
|
|
1614
|
+
tween: xs,
|
|
1615
|
+
delay: Ts,
|
|
1616
|
+
duration: Fs,
|
|
1617
|
+
ease: Ds,
|
|
1618
|
+
easeVarying: Rs,
|
|
1619
|
+
end: uo,
|
|
1620
|
+
[Symbol.iterator]: it[Symbol.iterator]
|
|
1621
|
+
};
|
|
1622
|
+
function Dn(e) {
|
|
1623
|
+
return --e * e * e + 1;
|
|
1624
|
+
}
|
|
1625
|
+
function po(e) {
|
|
1626
|
+
return ((e *= 2) <= 1 ? e * e * e : (e -= 2) * e * e + 2) / 2;
|
|
1627
|
+
}
|
|
1628
|
+
var go = {
|
|
1629
|
+
time: null,
|
|
1630
|
+
// Set on use.
|
|
1631
|
+
delay: 0,
|
|
1632
|
+
duration: 250,
|
|
1633
|
+
ease: po
|
|
1634
|
+
};
|
|
1635
|
+
function xo(e, t) {
|
|
1636
|
+
for (var n; !(n = e.__transition) || !(n = n[t]); )
|
|
1637
|
+
if (!(e = e.parentNode))
|
|
1638
|
+
throw new Error(`transition ${t} not found`);
|
|
1639
|
+
return n;
|
|
1640
|
+
}
|
|
1641
|
+
function yo(e) {
|
|
1642
|
+
var t, n;
|
|
1643
|
+
e instanceof rt ? (t = e._id, e = e._name) : (t = Vn(), (n = go).time = ve(), e = e == null ? null : e + "");
|
|
1644
|
+
for (var i = this._groups, r = i.length, s = 0; s < r; ++s)
|
|
1645
|
+
for (var o = i[s], a = o.length, c, l = 0; l < a; ++l)
|
|
1646
|
+
(c = o[l]) && Qt(c, e, t, l, o, n || xo(c, t));
|
|
1647
|
+
return new rt(i, this._parents, e, t);
|
|
1648
|
+
}
|
|
1649
|
+
$t.prototype.interrupt = Ur;
|
|
1650
|
+
$t.prototype.transition = yo;
|
|
1651
|
+
function mo(e) {
|
|
1652
|
+
return Math.abs(e = Math.round(e)) >= 1e21 ? e.toLocaleString("en").replace(/,/g, "") : e.toString(10);
|
|
1653
|
+
}
|
|
1654
|
+
function Gt(e, t) {
|
|
1655
|
+
if (!isFinite(e) || e === 0) return null;
|
|
1656
|
+
var n = (e = t ? e.toExponential(t - 1) : e.toExponential()).indexOf("e"), i = e.slice(0, n);
|
|
1657
|
+
return [
|
|
1658
|
+
i.length > 1 ? i[0] + i.slice(2) : i,
|
|
1659
|
+
+e.slice(n + 1)
|
|
1660
|
+
];
|
|
1661
|
+
}
|
|
1662
|
+
function _o(e) {
|
|
1663
|
+
return e = Gt(Math.abs(e)), e ? e[1] : NaN;
|
|
1664
|
+
}
|
|
1665
|
+
function wo(e, t) {
|
|
1666
|
+
return function(n, i) {
|
|
1667
|
+
for (var r = n.length, s = [], o = 0, a = e[0], c = 0; r > 0 && a > 0 && (c + a + 1 > i && (a = Math.max(1, i - c)), s.push(n.substring(r -= a, r + a)), !((c += a + 1) > i)); )
|
|
1668
|
+
a = e[o = (o + 1) % e.length];
|
|
1669
|
+
return s.reverse().join(t);
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
function vo(e) {
|
|
1673
|
+
return function(t) {
|
|
1674
|
+
return t.replace(/[0-9]/g, function(n) {
|
|
1675
|
+
return e[+n];
|
|
1676
|
+
});
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
var bo = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
|
|
1680
|
+
function pe(e) {
|
|
1681
|
+
if (!(t = bo.exec(e))) throw new Error("invalid format: " + e);
|
|
1682
|
+
var t;
|
|
1683
|
+
return new Ae({
|
|
1684
|
+
fill: t[1],
|
|
1685
|
+
align: t[2],
|
|
1686
|
+
sign: t[3],
|
|
1687
|
+
symbol: t[4],
|
|
1688
|
+
zero: t[5],
|
|
1689
|
+
width: t[6],
|
|
1690
|
+
comma: t[7],
|
|
1691
|
+
precision: t[8] && t[8].slice(1),
|
|
1692
|
+
trim: t[9],
|
|
1693
|
+
type: t[10]
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
pe.prototype = Ae.prototype;
|
|
1697
|
+
function Ae(e) {
|
|
1698
|
+
this.fill = e.fill === void 0 ? " " : e.fill + "", this.align = e.align === void 0 ? ">" : e.align + "", this.sign = e.sign === void 0 ? "-" : e.sign + "", this.symbol = e.symbol === void 0 ? "" : e.symbol + "", this.zero = !!e.zero, this.width = e.width === void 0 ? void 0 : +e.width, this.comma = !!e.comma, this.precision = e.precision === void 0 ? void 0 : +e.precision, this.trim = !!e.trim, this.type = e.type === void 0 ? "" : e.type + "";
|
|
1699
|
+
}
|
|
1700
|
+
Ae.prototype.toString = function() {
|
|
1701
|
+
return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
|
|
1702
|
+
};
|
|
1703
|
+
function ko(e) {
|
|
1704
|
+
t: for (var t = e.length, n = 1, i = -1, r; n < t; ++n)
|
|
1705
|
+
switch (e[n]) {
|
|
1706
|
+
case ".":
|
|
1707
|
+
i = r = n;
|
|
1708
|
+
break;
|
|
1709
|
+
case "0":
|
|
1710
|
+
i === 0 && (i = n), r = n;
|
|
1711
|
+
break;
|
|
1712
|
+
default:
|
|
1713
|
+
if (!+e[n]) break t;
|
|
1714
|
+
i > 0 && (i = 0);
|
|
1715
|
+
break;
|
|
1716
|
+
}
|
|
1717
|
+
return i > 0 ? e.slice(0, i) + e.slice(r + 1) : e;
|
|
1718
|
+
}
|
|
1719
|
+
var Kt;
|
|
1720
|
+
function Mo(e, t) {
|
|
1721
|
+
var n = Gt(e, t);
|
|
1722
|
+
if (!n) return Kt = void 0, e.toPrecision(t);
|
|
1723
|
+
var i = n[0], r = n[1], s = r - (Kt = Math.max(-8, Math.min(8, Math.floor(r / 3))) * 3) + 1, o = i.length;
|
|
1724
|
+
return s === o ? i : s > o ? i + new Array(s - o + 1).join("0") : s > 0 ? i.slice(0, s) + "." + i.slice(s) : "0." + new Array(1 - s).join("0") + Gt(e, Math.max(0, t + s - 1))[0];
|
|
1725
|
+
}
|
|
1726
|
+
function Je(e, t) {
|
|
1727
|
+
var n = Gt(e, t);
|
|
1728
|
+
if (!n) return e + "";
|
|
1729
|
+
var i = n[0], r = n[1];
|
|
1730
|
+
return r < 0 ? "0." + new Array(-r).join("0") + i : i.length > r + 1 ? i.slice(0, r + 1) + "." + i.slice(r + 1) : i + new Array(r - i.length + 2).join("0");
|
|
1731
|
+
}
|
|
1732
|
+
const Qe = {
|
|
1733
|
+
"%": (e, t) => (e * 100).toFixed(t),
|
|
1734
|
+
b: (e) => Math.round(e).toString(2),
|
|
1735
|
+
c: (e) => e + "",
|
|
1736
|
+
d: mo,
|
|
1737
|
+
e: (e, t) => e.toExponential(t),
|
|
1738
|
+
f: (e, t) => e.toFixed(t),
|
|
1739
|
+
g: (e, t) => e.toPrecision(t),
|
|
1740
|
+
o: (e) => Math.round(e).toString(8),
|
|
1741
|
+
p: (e, t) => Je(e * 100, t),
|
|
1742
|
+
r: Je,
|
|
1743
|
+
s: Mo,
|
|
1744
|
+
X: (e) => Math.round(e).toString(16).toUpperCase(),
|
|
1745
|
+
x: (e) => Math.round(e).toString(16)
|
|
1746
|
+
};
|
|
1747
|
+
function je(e) {
|
|
1748
|
+
return e;
|
|
1749
|
+
}
|
|
1750
|
+
var tn = Array.prototype.map, en = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
|
|
1751
|
+
function Ao(e) {
|
|
1752
|
+
var t = e.grouping === void 0 || e.thousands === void 0 ? je : wo(tn.call(e.grouping, Number), e.thousands + ""), n = e.currency === void 0 ? "" : e.currency[0] + "", i = e.currency === void 0 ? "" : e.currency[1] + "", r = e.decimal === void 0 ? "." : e.decimal + "", s = e.numerals === void 0 ? je : vo(tn.call(e.numerals, String)), o = e.percent === void 0 ? "%" : e.percent + "", a = e.minus === void 0 ? "−" : e.minus + "", c = e.nan === void 0 ? "NaN" : e.nan + "";
|
|
1753
|
+
function l(h, f) {
|
|
1754
|
+
h = pe(h);
|
|
1755
|
+
var p = h.fill, d = h.align, y = h.sign, m = h.symbol, g = h.zero, x = h.width, _ = h.comma, w = h.precision, v = h.trim, b = h.type;
|
|
1756
|
+
b === "n" ? (_ = !0, b = "g") : Qe[b] || (w === void 0 && (w = 12), v = !0, b = "g"), (g || p === "0" && d === "=") && (g = !0, p = "0", d = "=");
|
|
1757
|
+
var k = (f && f.prefix !== void 0 ? f.prefix : "") + (m === "$" ? n : m === "#" && /[boxX]/.test(b) ? "0" + b.toLowerCase() : ""), E = (m === "$" ? i : /[%p]/.test(b) ? o : "") + (f && f.suffix !== void 0 ? f.suffix : ""), C = Qe[b], P = /[defgprs%]/.test(b);
|
|
1758
|
+
w = w === void 0 ? 6 : /[gprs]/.test(b) ? Math.max(1, Math.min(21, w)) : Math.max(0, Math.min(20, w));
|
|
1759
|
+
function R(M) {
|
|
1760
|
+
var N = k, $ = E, F, S, A;
|
|
1761
|
+
if (b === "c")
|
|
1762
|
+
$ = C(M) + $, M = "";
|
|
1763
|
+
else {
|
|
1764
|
+
M = +M;
|
|
1765
|
+
var L = M < 0 || 1 / M < 0;
|
|
1766
|
+
if (M = isNaN(M) ? c : C(Math.abs(M), w), v && (M = ko(M)), L && +M == 0 && y !== "+" && (L = !1), N = (L ? y === "(" ? y : a : y === "-" || y === "(" ? "" : y) + N, $ = (b === "s" && !isNaN(M) && Kt !== void 0 ? en[8 + Kt / 3] : "") + $ + (L && y === "(" ? ")" : ""), P) {
|
|
1767
|
+
for (F = -1, S = M.length; ++F < S; )
|
|
1768
|
+
if (A = M.charCodeAt(F), 48 > A || A > 57) {
|
|
1769
|
+
$ = (A === 46 ? r + M.slice(F + 1) : M.slice(F)) + $, M = M.slice(0, F);
|
|
1770
|
+
break;
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
_ && !g && (M = t(M, 1 / 0));
|
|
1775
|
+
var O = N.length + M.length + $.length, D = O < x ? new Array(x - O + 1).join(p) : "";
|
|
1776
|
+
switch (_ && g && (M = t(D + M, D.length ? x - $.length : 1 / 0), D = ""), d) {
|
|
1777
|
+
case "<":
|
|
1778
|
+
M = N + M + $ + D;
|
|
1779
|
+
break;
|
|
1780
|
+
case "=":
|
|
1781
|
+
M = N + D + M + $;
|
|
1782
|
+
break;
|
|
1783
|
+
case "^":
|
|
1784
|
+
M = D.slice(0, O = D.length >> 1) + N + M + $ + D.slice(O);
|
|
1785
|
+
break;
|
|
1786
|
+
default:
|
|
1787
|
+
M = D + N + M + $;
|
|
1788
|
+
break;
|
|
1789
|
+
}
|
|
1790
|
+
return s(M);
|
|
1791
|
+
}
|
|
1792
|
+
return R.toString = function() {
|
|
1793
|
+
return h + "";
|
|
1794
|
+
}, R;
|
|
1795
|
+
}
|
|
1796
|
+
function u(h, f) {
|
|
1797
|
+
var p = Math.max(-8, Math.min(8, Math.floor(_o(f) / 3))) * 3, d = Math.pow(10, -p), y = l((h = pe(h), h.type = "f", h), { suffix: en[8 + p / 3] });
|
|
1798
|
+
return function(m) {
|
|
1799
|
+
return y(d * m);
|
|
1800
|
+
};
|
|
1801
|
+
}
|
|
1802
|
+
return {
|
|
1803
|
+
format: l,
|
|
1804
|
+
formatPrefix: u
|
|
1805
|
+
};
|
|
1806
|
+
}
|
|
1807
|
+
var Rt, Ln;
|
|
1808
|
+
Po({
|
|
1809
|
+
thousands: ",",
|
|
1810
|
+
grouping: [3],
|
|
1811
|
+
currency: ["$", ""]
|
|
1812
|
+
});
|
|
1813
|
+
function Po(e) {
|
|
1814
|
+
return Rt = Ao(e), Ln = Rt.format, Rt.formatPrefix, Rt;
|
|
1815
|
+
}
|
|
1816
|
+
const Co = {
|
|
1817
|
+
"%A": "%A",
|
|
1818
|
+
"%a": "%a",
|
|
1819
|
+
"%d": "%d",
|
|
1820
|
+
"%e": "%-d",
|
|
1821
|
+
"%b": "%b",
|
|
1822
|
+
"%B": "%B",
|
|
1823
|
+
"%m": "%m",
|
|
1824
|
+
"%y": "%y",
|
|
1825
|
+
"%Y": "%Y",
|
|
1826
|
+
"%H": "%H",
|
|
1827
|
+
"%I": "%I",
|
|
1828
|
+
"%k": "%-H",
|
|
1829
|
+
"%l": "%-I",
|
|
1830
|
+
"%M": "%M",
|
|
1831
|
+
"%p": "%p",
|
|
1832
|
+
"%P": "%p",
|
|
1833
|
+
"%S": "%S",
|
|
1834
|
+
"%L": "%L"
|
|
1835
|
+
};
|
|
1836
|
+
Object.entries(Co).map(
|
|
1837
|
+
([e, t]) => [new RegExp(e.replace("%", "\\%"), "g"), t]
|
|
1838
|
+
);
|
|
1839
|
+
const Eo = /\{([^}]+)\}/g;
|
|
1840
|
+
function Rn(e, t, n = !1) {
|
|
1841
|
+
return e.replace(Eo, (i, r) => {
|
|
1842
|
+
const s = r.indexOf(":");
|
|
1843
|
+
let o = r, a = null;
|
|
1844
|
+
s !== -1 && (o = r.slice(0, s), a = r.slice(s + 1));
|
|
1845
|
+
const c = o.trim().split(".");
|
|
1846
|
+
let l = t;
|
|
1847
|
+
for (const h of c) {
|
|
1848
|
+
if (l == null) return "";
|
|
1849
|
+
l = l[h];
|
|
1850
|
+
}
|
|
1851
|
+
if (l == null) return "";
|
|
1852
|
+
let u;
|
|
1853
|
+
if (a) {
|
|
1854
|
+
const h = typeof l == "number" ? l : parseFloat(String(l));
|
|
1855
|
+
if (isNaN(h))
|
|
1856
|
+
u = String(l);
|
|
1857
|
+
else
|
|
1858
|
+
try {
|
|
1859
|
+
u = Ln(a)(h);
|
|
1860
|
+
} catch {
|
|
1861
|
+
u = String(l);
|
|
1862
|
+
}
|
|
1863
|
+
} else
|
|
1864
|
+
u = String(l);
|
|
1865
|
+
return n ? To(u) : u;
|
|
1866
|
+
});
|
|
1867
|
+
}
|
|
1868
|
+
const So = /[&<>"']/g, Io = {
|
|
1869
|
+
"&": "&",
|
|
1870
|
+
"<": "<",
|
|
1871
|
+
">": ">",
|
|
1872
|
+
'"': """,
|
|
1873
|
+
"'": "'"
|
|
1874
|
+
};
|
|
1875
|
+
function To(e) {
|
|
1876
|
+
return String(e).replace(So, (t) => Io[t]);
|
|
1877
|
+
}
|
|
1878
|
+
const $o = /<\/?[^>]+(>|$)/g, No = /<br\s*\/?>/gi;
|
|
1879
|
+
function On(e) {
|
|
1880
|
+
return e.replace(No, " ").replace($o, "").trim();
|
|
1881
|
+
}
|
|
1882
|
+
const V = 600, Y = 8, Fo = V + 100, T = 300, ge = 250, X = Dn, I = Dn, zn = "12px", Hn = "#000000", nn = "#1a1a1a", Vo = "#ffffff", Do = 3;
|
|
1883
|
+
function ie(e) {
|
|
1884
|
+
const t = e / 255;
|
|
1885
|
+
return t <= 0.03928 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4;
|
|
1886
|
+
}
|
|
1887
|
+
function Bn(e, t, n) {
|
|
1888
|
+
return 0.2126 * ie(e) + 0.7152 * ie(t) + 0.0722 * ie(n);
|
|
1889
|
+
}
|
|
1890
|
+
function rn(e, t) {
|
|
1891
|
+
return (Math.max(e, t) + 0.05) / (Math.min(e, t) + 0.05);
|
|
1892
|
+
}
|
|
1893
|
+
const Lo = Bn(26, 26, 26);
|
|
1894
|
+
function sn(e, t) {
|
|
1895
|
+
var o;
|
|
1896
|
+
if (t) return t;
|
|
1897
|
+
const n = e ? (o = _t(e)) == null ? void 0 : o.rgb() : null;
|
|
1898
|
+
if (!n || isNaN(n.r) || n.opacity === 0) return Hn;
|
|
1899
|
+
const i = Bn(n.r, n.g, n.b), r = rn(i, Lo);
|
|
1900
|
+
return r >= Do ? nn : rn(i, 1) >= r ? Vo : nn;
|
|
1901
|
+
}
|
|
1902
|
+
const Ro = 500;
|
|
1903
|
+
function lt(e, t, n, i) {
|
|
1904
|
+
return i > Ro ? t : t + e * n;
|
|
1905
|
+
}
|
|
1906
|
+
class Z {
|
|
1907
|
+
constructor(t) {
|
|
1908
|
+
this.selectedPoints = /* @__PURE__ */ new Set(), this._cachedExtents = null, this.config = t, this.visible = t.visible !== !1, this.data = t._processedData || [];
|
|
1909
|
+
}
|
|
1910
|
+
init(t) {
|
|
1911
|
+
this.context = t, this.group = t.chartGroup.append("g").attr("class", `katucharts-series katucharts-series-${this.config._internalType}`).attr("data-series-index", this.config.index), this.config.opacity !== void 0 && this.config.opacity !== 1 && this.group.attr("opacity", this.config.opacity), this.config.zIndex !== void 0 && this.group.style("z-index", String(this.config.zIndex)), this.config.className && this.group.classed(this.config.className, !0), this.config.shadow && this.applyShadowFilter(), this.visible || this.group.style("display", "none"), this.config.allowPointSelect && this.data.forEach((n, i) => {
|
|
1912
|
+
n.selected && this.selectedPoints.add(i);
|
|
1913
|
+
}), this.group.on("mouseenter", () => {
|
|
1914
|
+
var n, i;
|
|
1915
|
+
(i = (n = this.config.events) == null ? void 0 : n.mouseOver) == null || i.call(this, new Event("mouseOver")), this.context.events.emit("series:mouseenter", this);
|
|
1916
|
+
}).on("mouseleave", () => {
|
|
1917
|
+
var n, i;
|
|
1918
|
+
(i = (n = this.config.events) == null ? void 0 : n.mouseOut) == null || i.call(this, new Event("mouseOut")), this.context.events.emit("series:mouseleave", this);
|
|
1919
|
+
});
|
|
1920
|
+
}
|
|
1921
|
+
setOnVisibilityChange(t) {
|
|
1922
|
+
this._onVisibilityChange = t;
|
|
1923
|
+
}
|
|
1924
|
+
processData() {
|
|
1925
|
+
this.data = this.config._processedData || [], this._cachedExtents = null;
|
|
1926
|
+
}
|
|
1927
|
+
getColor() {
|
|
1928
|
+
return this.config.color || this.context.colors[this.context.colorIndex % this.context.colors.length];
|
|
1929
|
+
}
|
|
1930
|
+
/**
|
|
1931
|
+
* Readable color for a label drawn on the chart background. An explicit color
|
|
1932
|
+
* always wins; otherwise dark ink is used on light backgrounds and switched to
|
|
1933
|
+
* light on dark ones (WCAG-based), so labels stay legible under any theme.
|
|
1934
|
+
*/
|
|
1935
|
+
autoLabelColor(t) {
|
|
1936
|
+
return sn(this.context.backgroundColor, t);
|
|
1937
|
+
}
|
|
1938
|
+
/**
|
|
1939
|
+
* Text halo (`text-shadow`) for labels placed over busy fills like maps. The
|
|
1940
|
+
* halo contrasts with the label so the outline reads on both light and dark
|
|
1941
|
+
* backgrounds instead of glowing white on dark themes. `readableTextColor`
|
|
1942
|
+
* returns white only when the background is dark enough to need light text.
|
|
1943
|
+
*/
|
|
1944
|
+
labelHalo() {
|
|
1945
|
+
const t = this.labelHaloColor();
|
|
1946
|
+
return `0 0 3px ${t}, 0 0 3px ${t}`;
|
|
1947
|
+
}
|
|
1948
|
+
/** Single halo color (for SVG `stroke` outlines) that contrasts with the label. */
|
|
1949
|
+
labelHaloColor() {
|
|
1950
|
+
return sn(this.context.backgroundColor) === "#ffffff" ? "rgba(0,0,0,0.85)" : "#ffffff";
|
|
1951
|
+
}
|
|
1952
|
+
/**
|
|
1953
|
+
* Border/separator color for cells, slices, nodes and point markers. Matches
|
|
1954
|
+
* the chart background so adjacent shapes read as clean gaps on any theme —
|
|
1955
|
+
* dark gaps on dark backgrounds instead of harsh white grid lines. Falls back
|
|
1956
|
+
* to white on transparent/unset backgrounds (the light-theme default).
|
|
1957
|
+
*/
|
|
1958
|
+
autoBorderColor() {
|
|
1959
|
+
const t = this.context.backgroundColor;
|
|
1960
|
+
return !t || t === "transparent" || t === "none" ? "#ffffff" : t;
|
|
1961
|
+
}
|
|
1962
|
+
getMultiLegendItems() {
|
|
1963
|
+
return null;
|
|
1964
|
+
}
|
|
1965
|
+
getLegendSymbolShape() {
|
|
1966
|
+
return null;
|
|
1967
|
+
}
|
|
1968
|
+
/**
|
|
1969
|
+
* Size-reference data for a bubble legend. Returns null for every series
|
|
1970
|
+
* type except bubble, which overrides this to report the pixel radius that
|
|
1971
|
+
* maps to each reference z value so the legend can draw matching circles.
|
|
1972
|
+
*/
|
|
1973
|
+
getBubbleLegendInfo() {
|
|
1974
|
+
return null;
|
|
1975
|
+
}
|
|
1976
|
+
/**
|
|
1977
|
+
* Animate elements to new positions after axis domain change.
|
|
1978
|
+
*/
|
|
1979
|
+
animateUpdate(t) {
|
|
1980
|
+
this.group.selectAll("*").remove(), this.render();
|
|
1981
|
+
}
|
|
1982
|
+
/**
|
|
1983
|
+
* Update context (axes, grouping info) without re-init.
|
|
1984
|
+
*/
|
|
1985
|
+
updateContext(t) {
|
|
1986
|
+
Object.assign(this.context, t);
|
|
1987
|
+
}
|
|
1988
|
+
redraw() {
|
|
1989
|
+
this.group.selectAll("*").remove(), this.render();
|
|
1990
|
+
}
|
|
1991
|
+
setVisible(t, n = !0) {
|
|
1992
|
+
var i, r, s, o;
|
|
1993
|
+
this.visible = t, t ? (r = (i = this.config.events) == null ? void 0 : i.show) == null || r.call(this, new Event("show")) : (o = (s = this.config.events) == null ? void 0 : s.hide) == null || o.call(this, new Event("hide")), n && this._onVisibilityChange ? (t ? this.group.style("display", "").attr("opacity", 0).transition().duration(300).attr("opacity", this.config.opacity ?? 1) : this.group.transition().duration(300).attr("opacity", 0).on("end", () => {
|
|
1994
|
+
this.group.style("display", "none");
|
|
1995
|
+
}), this._onVisibilityChange(500)) : this.group.style("display", t ? "" : "none"), this.context.events.emit("series:visibilityChanged", this, t);
|
|
1996
|
+
}
|
|
1997
|
+
toggleVisible() {
|
|
1998
|
+
this.setVisible(!this.visible);
|
|
1999
|
+
}
|
|
2000
|
+
getDataExtents() {
|
|
2001
|
+
if (this._cachedExtents) return this._cachedExtents;
|
|
2002
|
+
let t = 1 / 0, n = -1 / 0, i = 1 / 0, r = -1 / 0;
|
|
2003
|
+
for (const s of this.data)
|
|
2004
|
+
s.x !== void 0 && s.x !== null && (s.x < t && (t = s.x), s.x > n && (n = s.x)), s.y !== void 0 && s.y !== null && (s.y < i && (i = s.y), s.y > r && (r = s.y));
|
|
2005
|
+
return this._cachedExtents = { xMin: t, xMax: n, yMin: i, yMax: r }, this._cachedExtents;
|
|
2006
|
+
}
|
|
2007
|
+
getCategories() {
|
|
2008
|
+
return this.data.filter((t) => t.name !== void 0).map((t) => t.name);
|
|
2009
|
+
}
|
|
2010
|
+
destroy() {
|
|
2011
|
+
var t;
|
|
2012
|
+
(t = this.group) == null || t.remove();
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* Replace all data in the series and optionally trigger a redraw.
|
|
2016
|
+
*/
|
|
2017
|
+
setData(t, n = !0, i = !0) {
|
|
2018
|
+
this.data = t, this.config._processedData = t, this._cachedExtents = null, n && (i ? this.animateUpdate(500) : this.redraw(), this.context.events.emit("series:dataChanged", this));
|
|
2019
|
+
}
|
|
2020
|
+
/**
|
|
2021
|
+
* Append a single point and optionally shift the oldest one off.
|
|
2022
|
+
*/
|
|
2023
|
+
addPoint(t, n = !0, i = !1, r = !0) {
|
|
2024
|
+
if (this.data.push(t), this.config._processedData = this.data, i && this.data.length > 1)
|
|
2025
|
+
this.data.shift(), this.config._processedData = this.data, this._cachedExtents = null;
|
|
2026
|
+
else if (this._cachedExtents) {
|
|
2027
|
+
const s = this._cachedExtents;
|
|
2028
|
+
t.x !== void 0 && t.x !== null && (t.x < s.xMin && (s.xMin = t.x), t.x > s.xMax && (s.xMax = t.x)), t.y !== void 0 && t.y !== null && (t.y < s.yMin && (s.yMin = t.y), t.y > s.yMax && (s.yMax = t.y));
|
|
2029
|
+
}
|
|
2030
|
+
n && (r ? this.animateUpdate(300) : this.redraw(), this.context.events.emit("series:dataChanged", this));
|
|
2031
|
+
}
|
|
2032
|
+
/**
|
|
2033
|
+
* Batch-append multiple points and optionally shift the oldest ones off.
|
|
2034
|
+
*/
|
|
2035
|
+
addPoints(t, n = !0, i = !1, r = !0) {
|
|
2036
|
+
for (const s of t)
|
|
2037
|
+
this.data.push(s);
|
|
2038
|
+
i && this.data.length > t.length && this.data.splice(0, t.length), this.config._processedData = this.data, this._cachedExtents = null, n && (r ? this.animateUpdate(300) : this.redraw(), this.context.events.emit("series:dataChanged", this));
|
|
2039
|
+
}
|
|
2040
|
+
/**
|
|
2041
|
+
* Remove a point by index.
|
|
2042
|
+
*/
|
|
2043
|
+
removePoint(t, n = !0, i = !0) {
|
|
2044
|
+
t >= 0 && t < this.data.length && (this.data.splice(t, 1), this.config._processedData = this.data, this._cachedExtents = null, n && (i ? this.animateUpdate(300) : this.redraw(), this.context.events.emit("series:dataChanged", this)));
|
|
2045
|
+
}
|
|
2046
|
+
/**
|
|
2047
|
+
* Merge new options into this series config and optionally redraw.
|
|
2048
|
+
*/
|
|
2049
|
+
updateSeries(t, n = !0) {
|
|
2050
|
+
Object.assign(this.config, t), t.data && (this.config._processedData = t.data, this.data = this.config._processedData, this._cachedExtents = null), n && this.redraw();
|
|
2051
|
+
}
|
|
2052
|
+
/**
|
|
2053
|
+
* Apply a coalesced batch of updates from the UpdateScheduler.
|
|
2054
|
+
* Override in subclasses for incremental rendering.
|
|
2055
|
+
*/
|
|
2056
|
+
applyBatch(t) {
|
|
2057
|
+
for (const n of t.entries)
|
|
2058
|
+
switch (n.type) {
|
|
2059
|
+
case "setData":
|
|
2060
|
+
this.data = n.payload, this.config._processedData = this.data;
|
|
2061
|
+
break;
|
|
2062
|
+
case "addPoint":
|
|
2063
|
+
this.data.push(n.payload.point), n.payload.shift && this.data.length > 1 && this.data.shift();
|
|
2064
|
+
break;
|
|
2065
|
+
case "addPoints":
|
|
2066
|
+
for (const i of n.payload.points)
|
|
2067
|
+
this.data.push(i);
|
|
2068
|
+
n.payload.shift && this.data.splice(0, n.payload.points.length);
|
|
2069
|
+
break;
|
|
2070
|
+
case "removePoint":
|
|
2071
|
+
n.payload.index >= 0 && n.payload.index < this.data.length && this.data.splice(n.payload.index, 1);
|
|
2072
|
+
break;
|
|
2073
|
+
}
|
|
2074
|
+
this.config._processedData = this.data, this._cachedExtents = null, this.redraw(), this.context.events.emit("series:dataChanged", this);
|
|
2075
|
+
}
|
|
2076
|
+
show() {
|
|
2077
|
+
this.setVisible(!0);
|
|
2078
|
+
}
|
|
2079
|
+
hide() {
|
|
2080
|
+
this.setVisible(!1);
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2083
|
+
* Return all currently selected point indices and their data.
|
|
2084
|
+
*/
|
|
2085
|
+
getSelectedPoints() {
|
|
2086
|
+
return Array.from(this.selectedPoints).map((t) => ({
|
|
2087
|
+
index: t,
|
|
2088
|
+
point: this.data[t]
|
|
2089
|
+
})).filter((t) => t.point !== void 0);
|
|
2090
|
+
}
|
|
2091
|
+
applyClipPath() {
|
|
2092
|
+
const { plotArea: t } = this.context;
|
|
2093
|
+
this.clipId = `katucharts-clip-${this.config.index}-${Date.now()}`;
|
|
2094
|
+
const n = this.group.select(function() {
|
|
2095
|
+
return this.ownerSVGElement;
|
|
2096
|
+
});
|
|
2097
|
+
if (!n.empty()) {
|
|
2098
|
+
let i = n.select("defs");
|
|
2099
|
+
i.empty() && (i = n.append("defs")), i.append("clipPath").attr("id", this.clipId).append("rect").attr("x", 0).attr("y", 0).attr("width", t.width).attr("height", t.height), this.group.attr("clip-path", `url(#${this.clipId})`);
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
applyShadowFilter() {
|
|
2103
|
+
const t = this.config.shadow;
|
|
2104
|
+
if (!t) return;
|
|
2105
|
+
const n = `katucharts-shadow-${this.config.index}-${Date.now()}`, i = this.group.select(function() {
|
|
2106
|
+
return this.ownerSVGElement;
|
|
2107
|
+
});
|
|
2108
|
+
if (!i.empty()) {
|
|
2109
|
+
let r = i.select("defs");
|
|
2110
|
+
r.empty() && (r = i.append("defs"));
|
|
2111
|
+
const s = typeof t == "object" ? t : {}, o = s.offsetX ?? 1, a = s.offsetY ?? 1, c = s.width ?? 3, l = s.opacity ?? 0.15;
|
|
2112
|
+
r.append("filter").attr("id", n).append("feDropShadow").attr("dx", o).attr("dy", a).attr("stdDeviation", c).attr("flood-opacity", l), this.group.style("filter", `url(#${n})`);
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
/**
|
|
2116
|
+
* Dim all other series when this series is hovered.
|
|
2117
|
+
*/
|
|
2118
|
+
applyInactiveState() {
|
|
2119
|
+
var r, s, o, a, c;
|
|
2120
|
+
const t = this.context.allSeries;
|
|
2121
|
+
if (!t || t.length <= 1) return;
|
|
2122
|
+
const n = ((s = (r = this.config.states) == null ? void 0 : r.inactive) == null ? void 0 : s.opacity) ?? 0.2, i = ((c = (a = (o = this.config.states) == null ? void 0 : o.inactive) == null ? void 0 : a.animation) == null ? void 0 : c.duration) ?? ge;
|
|
2123
|
+
for (const l of t)
|
|
2124
|
+
l !== this && l.visible && l.group.transition("inactive").duration(i).ease(I).attr("opacity", n);
|
|
2125
|
+
}
|
|
2126
|
+
clearInactiveState() {
|
|
2127
|
+
var i, r, s, o, a, c;
|
|
2128
|
+
const t = this.context.allSeries;
|
|
2129
|
+
if (!t || t.length <= 1) return;
|
|
2130
|
+
const n = ((s = (r = (i = this.config.states) == null ? void 0 : i.normal) == null ? void 0 : r.animation) == null ? void 0 : s.duration) ?? ((c = (a = (o = this.config.states) == null ? void 0 : o.inactive) == null ? void 0 : a.animation) == null ? void 0 : c.duration) ?? ge;
|
|
2131
|
+
for (const l of t)
|
|
2132
|
+
l !== this && l.visible && l.group.transition("inactive").duration(n).ease(I).attr("opacity", l.config.opacity ?? 1);
|
|
2133
|
+
}
|
|
2134
|
+
/**
|
|
2135
|
+
* Emit afterAnimate event and invoke animation.complete callback at the end of the entry animation.
|
|
2136
|
+
*/
|
|
2137
|
+
emitAfterAnimate(t) {
|
|
2138
|
+
var s;
|
|
2139
|
+
const n = !!((s = this.config.events) != null && s.afterAnimate), i = typeof this.config.animation == "object" ? this.config.animation : null, r = !!(i != null && i.complete);
|
|
2140
|
+
(n || r) && setTimeout(() => {
|
|
2141
|
+
var o, a, c;
|
|
2142
|
+
(a = (o = this.config.events) == null ? void 0 : o.afterAnimate) == null || a.call(this, new Event("afterAnimate")), (c = i == null ? void 0 : i.complete) == null || c.call(i);
|
|
2143
|
+
}, t);
|
|
2144
|
+
}
|
|
2145
|
+
/**
|
|
2146
|
+
* Render data labels for all visible points based on dataLabels config.
|
|
2147
|
+
*/
|
|
2148
|
+
renderDataLabels(t, n, i) {
|
|
2149
|
+
const r = this.config.dataLabels;
|
|
2150
|
+
if (!(r != null && r.enabled)) return;
|
|
2151
|
+
this.group.selectAll(".katucharts-data-labels").remove();
|
|
2152
|
+
const s = this.group.append("g").attr("class", "katucharts-data-labels");
|
|
2153
|
+
this.getColor(), t.forEach((o, a) => {
|
|
2154
|
+
var y, m;
|
|
2155
|
+
if (o.y === null || o.y === void 0) return;
|
|
2156
|
+
const c = o.dataLabels, l = { ...r, ...c };
|
|
2157
|
+
let u;
|
|
2158
|
+
if (l.formatter ? u = l.formatter.call({
|
|
2159
|
+
point: { ...o, index: a },
|
|
2160
|
+
series: this,
|
|
2161
|
+
x: o.x ?? a,
|
|
2162
|
+
y: o.y,
|
|
2163
|
+
percentage: o._percentage
|
|
2164
|
+
}) : l.format ? u = On(Rn(l.format, {
|
|
2165
|
+
point: o,
|
|
2166
|
+
series: { name: this.config.name ?? "" },
|
|
2167
|
+
x: o.x,
|
|
2168
|
+
y: o.y,
|
|
2169
|
+
percentage: o._percentage ?? o.percentage
|
|
2170
|
+
})) : u = String(o.y), l.filter) {
|
|
2171
|
+
const g = o[l.filter.property ?? "y"] ?? 0, x = l.filter.operator ?? ">", _ = l.filter.value ?? 0;
|
|
2172
|
+
if (!(x === ">" ? g > _ : x === "<" ? g < _ : x === ">=" ? g >= _ : x === "<=" ? g <= _ : x === "==" ? g === _ : !0)) return;
|
|
2173
|
+
}
|
|
2174
|
+
const h = n(o, a) + (l.x ?? 0), f = i(o, a) + (l.y ?? -10), p = s.append("text").attr("x", h).attr("y", f).attr(
|
|
2175
|
+
"text-anchor",
|
|
2176
|
+
l.align === "left" ? "start" : l.align === "right" ? "end" : "middle"
|
|
2177
|
+
).attr(
|
|
2178
|
+
"dominant-baseline",
|
|
2179
|
+
l.verticalAlign === "top" ? "text-before-edge" : l.verticalAlign === "bottom" ? "text-after-edge" : "central"
|
|
2180
|
+
).text(u), d = l.style || {};
|
|
2181
|
+
if (p.style("font-size", d.fontSize ?? zn).style("font-weight", d.fontWeight ?? "bold").style("fill", l.color || d.color || this.autoLabelColor()), d.textOutline && p.style("text-shadow", d.textOutline), l.rotation && p.attr("transform", `rotate(${l.rotation},${h},${f})`), l.backgroundColor || l.borderWidth) {
|
|
2182
|
+
const g = (m = (y = p.node()).getBBox) == null ? void 0 : m.call(y);
|
|
2183
|
+
if (g) {
|
|
2184
|
+
const x = l.padding ?? 5, _ = l.borderRadius ?? 0;
|
|
2185
|
+
s.insert("rect", ":last-child").attr("x", g.x - x).attr("y", g.y - x).attr("width", g.width + x * 2).attr("height", g.height + x * 2).attr("rx", _).attr("fill", l.backgroundColor || "none").attr("stroke", l.borderColor || "none").attr("stroke-width", l.borderWidth ?? 0);
|
|
2186
|
+
}
|
|
2187
|
+
}
|
|
2188
|
+
this.context.animate && l.defer !== !1 && p.attr("opacity", 0).transition().delay(Fo + a * Y).duration(400).ease(X).attr("opacity", 1);
|
|
2189
|
+
});
|
|
2190
|
+
}
|
|
2191
|
+
/**
|
|
2192
|
+
* Handle point selection toggle when allowPointSelect is enabled.
|
|
2193
|
+
*/
|
|
2194
|
+
handlePointSelect(t, n, i, r) {
|
|
2195
|
+
var o, a, c, l;
|
|
2196
|
+
if (!this.config.allowPointSelect) return;
|
|
2197
|
+
const s = this.selectedPoints.has(i);
|
|
2198
|
+
if (s) {
|
|
2199
|
+
if (((a = (o = n.events) == null ? void 0 : o.unselect) == null ? void 0 : a.call(n, r)) === !1) return;
|
|
2200
|
+
this.selectedPoints.delete(i), n.selected = !1, this.clearSelectStyle(t);
|
|
2201
|
+
} else {
|
|
2202
|
+
if (((l = (c = n.events) == null ? void 0 : c.select) == null ? void 0 : l.call(n, r)) === !1) return;
|
|
2203
|
+
this.selectedPoints.add(i), n.selected = !0, this.applySelectStyle(t);
|
|
2204
|
+
}
|
|
2205
|
+
this.context.events.emit("point:select", { point: n, index: i, series: this, selected: !s });
|
|
2206
|
+
}
|
|
2207
|
+
applySelectStyle(t) {
|
|
2208
|
+
var i;
|
|
2209
|
+
const n = (i = this.config.states) == null ? void 0 : i.select;
|
|
2210
|
+
n != null && n.color && t.attr("fill", n.color), n != null && n.borderColor && t.attr("stroke", n.borderColor), (n == null ? void 0 : n.borderWidth) !== void 0 && t.attr("stroke-width", n.borderWidth);
|
|
2211
|
+
}
|
|
2212
|
+
clearSelectStyle(t) {
|
|
2213
|
+
t.attr("fill", null).attr("stroke", null).attr("stroke-width", null);
|
|
2214
|
+
}
|
|
2215
|
+
attachPointEvents(t, n, i) {
|
|
2216
|
+
var o;
|
|
2217
|
+
if (this.config.enableMouseTracking === !1) return;
|
|
2218
|
+
const r = n.events || {}, s = ((o = this.config.point) == null ? void 0 : o.events) || {};
|
|
2219
|
+
t.on("mouseover", (a) => {
|
|
2220
|
+
var c, l;
|
|
2221
|
+
this.context.events.emit("point:mouseover", {
|
|
2222
|
+
point: n,
|
|
2223
|
+
index: i,
|
|
2224
|
+
series: this,
|
|
2225
|
+
event: a,
|
|
2226
|
+
plotX: this.context.xAxis.getPixelForValue(n.x ?? i),
|
|
2227
|
+
plotY: this.context.yAxis.getPixelForValue(n.y ?? 0)
|
|
2228
|
+
}), (c = r.mouseOver) == null || c.call(n, a), (l = s.mouseOver) == null || l.call(n, a);
|
|
2229
|
+
}).on("mouseout", (a) => {
|
|
2230
|
+
var c, l;
|
|
2231
|
+
this.context.events.emit("point:mouseout", { point: n, index: i, series: this, event: a }), (c = r.mouseOut) == null || c.call(n, a), (l = s.mouseOut) == null || l.call(n, a);
|
|
2232
|
+
}).on("click", (a) => {
|
|
2233
|
+
var c, l, u, h;
|
|
2234
|
+
this.context.events.emit("point:click", { point: n, index: i, series: this, event: a }), (c = r.click) == null || c.call(n, a), (l = s.click) == null || l.call(n, a), (h = (u = this.config.events) == null ? void 0 : u.click) == null || h.call(this, a), this.handlePointSelect(t, n, i, a);
|
|
2235
|
+
}), t.style("cursor", this.config.cursor || "pointer");
|
|
2236
|
+
}
|
|
2237
|
+
/**
|
|
2238
|
+
* Apply jitter offset to a coordinate value.
|
|
2239
|
+
*/
|
|
2240
|
+
applyJitter(t, n, i) {
|
|
2241
|
+
return i ? t + (Math.random() - 0.5) * i * n : t;
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
class Xn extends Z {
|
|
2245
|
+
constructor(t) {
|
|
2246
|
+
super(t), this.selectedIndices = /* @__PURE__ */ new Set();
|
|
2247
|
+
}
|
|
2248
|
+
/**
|
|
2249
|
+
* Per-candle body fill, border stroke and wick color. Standard candlesticks
|
|
2250
|
+
* fill solid by direction; subclasses (hollow) override this hook to change
|
|
2251
|
+
* the coloring rule without duplicating the render loop.
|
|
2252
|
+
*/
|
|
2253
|
+
getCandleStyle(t) {
|
|
2254
|
+
const n = t.isUp ? t.upLineColor : t.downLineColor;
|
|
2255
|
+
return { fill: t.isUp ? t.upColor : t.downColor, stroke: n, wick: n };
|
|
2256
|
+
}
|
|
2257
|
+
/** CSS class for each candle group; overridden by subclasses to add a marker class. */
|
|
2258
|
+
getCandleClass() {
|
|
2259
|
+
return "katucharts-candlestick";
|
|
2260
|
+
}
|
|
2261
|
+
render() {
|
|
2262
|
+
var E, C, P, R, M, N, $, F;
|
|
2263
|
+
const { xAxis: t, yAxis: n, plotArea: i } = this.context, r = this.context.animate, s = this.data, o = this.applyDataGrouping(s), a = this.config.pointRange, c = this.config.groupPadding ?? 0.2, l = this.config.pointPadding ?? 0.1, u = c + l, h = this.config.maxPointWidth ?? 1 / 0, f = a ? Math.max(1, Math.min(h, i.width / Math.max(1, ((E = t.domain) == null ? void 0 : E[1]) - ((C = t.domain) == null ? void 0 : C[0]) || o.length) * a * (1 - u))) : Math.max(1, Math.min(h, i.width / o.length * (1 - u))), p = this.config.pointWidth ?? f, d = this.config.color || "#f45b5b", y = this.config.upColor || "#2f7ed8", m = this.config.lineColor || d, g = this.config.upLineColor || y, x = this.config.lineWidth ?? 1, _ = ((R = (P = this.config.states) == null ? void 0 : P.inactive) == null ? void 0 : R.opacity) ?? 0.4, w = this.config.allowPointSelect === !0, v = (N = (M = this.config.states) == null ? void 0 : M.select) == null ? void 0 : N.color, b = (F = ($ = this.config.states) == null ? void 0 : $.select) == null ? void 0 : F.borderColor, k = [];
|
|
2264
|
+
for (let S = 0; S < o.length; S++) {
|
|
2265
|
+
const A = o[S];
|
|
2266
|
+
if (A.y === null && A.open === void 0) continue;
|
|
2267
|
+
const L = A.open ?? A.y ?? 0, O = A.high ?? L, D = A.low ?? L, wt = A.close ?? L, gt = t.getPixelForValue(A.x ?? S), jt = wt >= L, te = this.getCandleStyle({
|
|
2268
|
+
open: L,
|
|
2269
|
+
high: O,
|
|
2270
|
+
low: D,
|
|
2271
|
+
close: wt,
|
|
2272
|
+
isUp: jt,
|
|
2273
|
+
index: S,
|
|
2274
|
+
data: o,
|
|
2275
|
+
upColor: y,
|
|
2276
|
+
downColor: d,
|
|
2277
|
+
upLineColor: g,
|
|
2278
|
+
downLineColor: m
|
|
2279
|
+
}), Ce = te.fill, Qn = te.stroke, q = this.group.append("g").attr("class", this.getCandleClass()).style("cursor", this.config.cursor || "pointer");
|
|
2280
|
+
k.push(q);
|
|
2281
|
+
const Ee = q.append("line").attr("x1", gt).attr("x2", gt).attr("stroke", te.wick).attr("stroke-width", x), Se = jt ? wt : L, jn = jt ? L : wt, Ie = n.getPixelForValue(Se), Te = Math.max(1, Math.abs(n.getPixelForValue(jn) - n.getPixelForValue(Se))), $e = q.append("rect").attr("x", gt - p / 2).attr("width", p).attr("stroke", Qn).attr("stroke-width", x).attr("rx", 2);
|
|
2282
|
+
if (r) {
|
|
2283
|
+
const W = n.getPixelForValue((O + D) / 2), j = lt(S, 0, Y, o.length);
|
|
2284
|
+
Ee.attr("y1", W).attr("y2", W).transition().duration(V).ease(X).delay(j).attr("y1", n.getPixelForValue(O)).attr("y2", n.getPixelForValue(D)), $e.attr("y", W).attr("height", 0).attr("fill", Ce).transition().duration(V).ease(X).delay(j).attr("y", Ie).attr("height", Te);
|
|
2285
|
+
} else
|
|
2286
|
+
Ee.attr("y1", n.getPixelForValue(O)).attr("y2", n.getPixelForValue(D)), $e.attr("y", Ie).attr("height", Te).attr("fill", Ce);
|
|
2287
|
+
this.config.enableMouseTracking !== !1 && q.on("mouseover", (W) => {
|
|
2288
|
+
var st, nt, vt, bt;
|
|
2289
|
+
const j = ((nt = (st = this.config.states) == null ? void 0 : st.hover) == null ? void 0 : nt.lineWidthPlus) ?? 2;
|
|
2290
|
+
q.select("rect").transition("size").duration(T).ease(I).attr("x", gt - p * 0.7).attr("width", p * 1.4), q.select("line").transition("size").duration(T).ease(I).attr("stroke-width", x + j), q.style("filter", "drop-shadow(0 2px 4px rgba(0,0,0,0.25))"), k.forEach((ot) => ot.interrupt("highlight")), k.forEach((ot) => ot.attr("opacity", 1)), k.forEach((ot, Ft) => {
|
|
2291
|
+
Ft !== S && ot.transition("highlight").duration(T).ease(I).attr("opacity", _);
|
|
2292
|
+
}), this.context.events.emit("point:mouseover", {
|
|
2293
|
+
point: { ...A, open: L, high: O, low: D, close: wt },
|
|
2294
|
+
index: S,
|
|
2295
|
+
series: this,
|
|
2296
|
+
event: W,
|
|
2297
|
+
plotX: gt,
|
|
2298
|
+
plotY: n.getPixelForValue((O + D) / 2)
|
|
2299
|
+
}), (bt = (vt = A.events) == null ? void 0 : vt.mouseOver) == null || bt.call(A, W);
|
|
2300
|
+
}).on("mouseout", (W) => {
|
|
2301
|
+
var j, st;
|
|
2302
|
+
q.select("rect").transition("size").duration(T).ease(I).attr("x", gt - p / 2).attr("width", p), q.select("line").transition("size").duration(T).ease(I).attr("stroke-width", x), q.style("filter", ""), k.forEach((nt) => nt.interrupt("highlight")), k.forEach((nt) => nt.transition("highlight").duration(T).ease(I).attr("opacity", 1)), this.context.events.emit("point:mouseout", {
|
|
2303
|
+
point: A,
|
|
2304
|
+
index: S,
|
|
2305
|
+
series: this,
|
|
2306
|
+
event: W
|
|
2307
|
+
}), (st = (j = A.events) == null ? void 0 : j.mouseOut) == null || st.call(A, W);
|
|
2308
|
+
}).on("click", (W) => {
|
|
2309
|
+
var j, st, nt, vt, bt, ot, Ft, Ne;
|
|
2310
|
+
w && (this.selectedIndices.has(S) ? (this.selectedIndices.delete(S), q.select("rect").attr("stroke-width", x), (st = (j = A.events) == null ? void 0 : j.unselect) == null || st.call(A, W)) : (this.selectedIndices.add(S), q.select("rect").attr("stroke", b || "#000").attr("stroke-width", v ? 2 : x + 1), v && q.select("rect").attr("fill", v), (vt = (nt = A.events) == null ? void 0 : nt.select) == null || vt.call(A, W))), this.context.events.emit("point:click", { point: A, index: S, series: this, event: W }), (ot = (bt = A.events) == null ? void 0 : bt.click) == null || ot.call(A, W), (Ne = (Ft = this.config.events) == null ? void 0 : Ft.click) == null || Ne.call(this, W);
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
this.renderCandlestickLabels(o, t, n);
|
|
2314
|
+
}
|
|
2315
|
+
renderCandlestickLabels(t, n, i) {
|
|
2316
|
+
var a, c;
|
|
2317
|
+
const r = this.config.dataLabels;
|
|
2318
|
+
if (!(r != null && r.enabled)) return;
|
|
2319
|
+
const s = ((a = r.style) == null ? void 0 : a.fontSize) || zn, o = r.color || ((c = r.style) == null ? void 0 : c.color) || Hn;
|
|
2320
|
+
t.forEach((l, u) => {
|
|
2321
|
+
if (l.y === null && l.open === void 0) return;
|
|
2322
|
+
const h = l.high ?? l.open ?? l.y ?? 0, f = n.getPixelForValue(l.x ?? u), p = i.getPixelForValue(h);
|
|
2323
|
+
let d;
|
|
2324
|
+
r.formatter ? d = r.formatter.call({
|
|
2325
|
+
point: l,
|
|
2326
|
+
series: { name: this.config.name },
|
|
2327
|
+
x: l.x,
|
|
2328
|
+
y: l.y
|
|
2329
|
+
}) : r.format ? d = On(Rn(r.format, {
|
|
2330
|
+
point: l,
|
|
2331
|
+
series: { name: this.config.name },
|
|
2332
|
+
x: l.x,
|
|
2333
|
+
y: l.y
|
|
2334
|
+
})) : d = String(l.close ?? l.y ?? ""), this.group.append("text").attr("class", "katucharts-candlestick-label").attr("x", f + (r.x ?? 0)).attr("y", p - 6 + (r.y ?? 0)).attr("text-anchor", "middle").attr("font-size", s).attr("fill", o).style("pointer-events", "none").text(d);
|
|
2335
|
+
});
|
|
2336
|
+
}
|
|
2337
|
+
/**
|
|
2338
|
+
* Groups OHLC data when dataGrouping is enabled, aggregating open/high/low/close
|
|
2339
|
+
* within each group interval using the standard OHLC approximation.
|
|
2340
|
+
*/
|
|
2341
|
+
applyDataGrouping(t) {
|
|
2342
|
+
const n = this.config.dataGrouping;
|
|
2343
|
+
if (!(n != null && n.enabled) || !n.units || t.length === 0) return t;
|
|
2344
|
+
const i = n.groupPixelWidth ?? 10, { plotArea: r } = this.context, s = r.width / Math.max(1, t.length);
|
|
2345
|
+
if (s >= i) return t;
|
|
2346
|
+
const o = Math.ceil(i / s), a = [];
|
|
2347
|
+
for (let c = 0; c < t.length; c += o) {
|
|
2348
|
+
const l = t.slice(c, c + o);
|
|
2349
|
+
if (l.length === 0) continue;
|
|
2350
|
+
const u = l[0].open ?? l[0].y ?? 0, h = l[l.length - 1].close ?? l[l.length - 1].y ?? 0;
|
|
2351
|
+
let f = -1 / 0, p = 1 / 0;
|
|
2352
|
+
for (const d of l)
|
|
2353
|
+
f = Math.max(f, d.high ?? d.y ?? 0), p = Math.min(p, d.low ?? d.y ?? 0);
|
|
2354
|
+
a.push({
|
|
2355
|
+
...l[0],
|
|
2356
|
+
x: l[0].x,
|
|
2357
|
+
open: u,
|
|
2358
|
+
high: f,
|
|
2359
|
+
low: p,
|
|
2360
|
+
close: h,
|
|
2361
|
+
y: h
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
return a;
|
|
2365
|
+
}
|
|
2366
|
+
getDataExtents() {
|
|
2367
|
+
let t = 1 / 0, n = -1 / 0, i = 1 / 0, r = -1 / 0;
|
|
2368
|
+
for (const s of this.data) {
|
|
2369
|
+
const o = s.x ?? 0;
|
|
2370
|
+
t = Math.min(t, o), n = Math.max(n, o);
|
|
2371
|
+
const a = s.high ?? s.y ?? 0, c = s.low ?? s.y ?? 0;
|
|
2372
|
+
i = Math.min(i, c), r = Math.max(r, a);
|
|
2373
|
+
}
|
|
2374
|
+
return { xMin: t, xMax: n, yMin: i, yMax: r };
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
class Wa extends Z {
|
|
2378
|
+
constructor(t) {
|
|
2379
|
+
super(t);
|
|
2380
|
+
}
|
|
2381
|
+
render() {
|
|
2382
|
+
var h, f;
|
|
2383
|
+
const { xAxis: t, yAxis: n, plotArea: i } = this.context, r = this.context.animate, s = this.data, o = Math.max(2, Math.min(10, i.width / s.length * 0.3)), a = this.config.color || "#f45b5b", c = this.config.upColor || "#2f7ed8", l = ((f = (h = this.config.states) == null ? void 0 : h.inactive) == null ? void 0 : f.opacity) ?? 0.4, u = [];
|
|
2384
|
+
for (let p = 0; p < s.length; p++) {
|
|
2385
|
+
const d = s[p];
|
|
2386
|
+
if (d.y === null && d.open === void 0) continue;
|
|
2387
|
+
const y = d.open ?? d.y ?? 0, m = d.high ?? y, g = d.low ?? y, x = d.close ?? y, _ = t.getPixelForValue(d.x ?? p), w = x >= y ? c : a, v = this.group.append("g").attr("class", "katucharts-ohlc").style("cursor", this.config.cursor || "pointer");
|
|
2388
|
+
u.push(v), r && v.attr("opacity", 0).transition().duration(V).ease(X).delay(lt(p, 0, Y, s.length)).attr("opacity", 1), v.append("line").attr("x1", _).attr("x2", _).attr("y1", n.getPixelForValue(m)).attr("y2", n.getPixelForValue(g)).attr("stroke", w).attr("stroke-width", 1.5), v.append("line").attr("x1", _ - o).attr("x2", _).attr("y1", n.getPixelForValue(y)).attr("y2", n.getPixelForValue(y)).attr("stroke", w).attr("stroke-width", 1.5), v.append("line").attr("x1", _).attr("x2", _ + o).attr("y1", n.getPixelForValue(x)).attr("y2", n.getPixelForValue(x)).attr("stroke", w).attr("stroke-width", 1.5), this.config.enableMouseTracking !== !1 && v.on("mouseover", (b) => {
|
|
2389
|
+
var k, E;
|
|
2390
|
+
v.selectAll("line").interrupt("hover").transition("hover").duration(T).ease(I).attr("stroke-width", 3), v.style("filter", "drop-shadow(0 2px 4px rgba(0,0,0,0.25))"), u.forEach((C) => C.interrupt("highlight")), u.forEach((C) => C.attr("opacity", 1)), u.forEach((C, P) => {
|
|
2391
|
+
P !== p && C.transition("highlight").duration(T).ease(I).attr("opacity", l);
|
|
2392
|
+
}), this.context.events.emit("point:mouseover", {
|
|
2393
|
+
point: { ...d, open: y, high: m, low: g, close: x },
|
|
2394
|
+
index: p,
|
|
2395
|
+
series: this,
|
|
2396
|
+
event: b,
|
|
2397
|
+
plotX: _,
|
|
2398
|
+
plotY: n.getPixelForValue((m + g) / 2)
|
|
2399
|
+
}), (E = (k = d.events) == null ? void 0 : k.mouseOver) == null || E.call(d, b);
|
|
2400
|
+
}).on("mouseout", (b) => {
|
|
2401
|
+
var k, E;
|
|
2402
|
+
v.selectAll("line").interrupt("hover").transition("hover").duration(T).ease(I).attr("stroke-width", 1.5), v.style("filter", ""), u.forEach((C) => C.interrupt("highlight")), u.forEach((C) => C.transition("highlight").duration(T).ease(I).attr("opacity", 1)), this.context.events.emit("point:mouseout", { point: d, index: p, series: this, event: b }), (E = (k = d.events) == null ? void 0 : k.mouseOut) == null || E.call(d, b);
|
|
2403
|
+
}).on("click", (b) => {
|
|
2404
|
+
var k, E, C, P;
|
|
2405
|
+
this.context.events.emit("point:click", { point: d, index: p, series: this, event: b }), (E = (k = d.events) == null ? void 0 : k.click) == null || E.call(d, b), (P = (C = this.config.events) == null ? void 0 : C.click) == null || P.call(this, b);
|
|
2406
|
+
});
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
getDataExtents() {
|
|
2410
|
+
let t = 1 / 0, n = -1 / 0, i = 1 / 0, r = -1 / 0;
|
|
2411
|
+
for (const s of this.data) {
|
|
2412
|
+
const o = s.x ?? 0;
|
|
2413
|
+
t = Math.min(t, o), n = Math.max(n, o);
|
|
2414
|
+
const a = s.high ?? s.y ?? 0, c = s.low ?? s.y ?? 0;
|
|
2415
|
+
i = Math.min(i, c), r = Math.max(r, a);
|
|
2416
|
+
}
|
|
2417
|
+
return { xMin: t, xMax: n, yMin: i, yMax: r };
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
class Oo extends Xn {
|
|
2421
|
+
constructor(t) {
|
|
2422
|
+
super(t);
|
|
2423
|
+
}
|
|
2424
|
+
/**
|
|
2425
|
+
* Transforms raw OHLC data into Heikin-Ashi candles before rendering.
|
|
2426
|
+
* HA values smooth out price action by averaging open/close and
|
|
2427
|
+
* adjusting high/low to the HA range.
|
|
2428
|
+
*/
|
|
2429
|
+
processData() {
|
|
2430
|
+
if (super.processData(), this.data.length === 0) return;
|
|
2431
|
+
const t = [];
|
|
2432
|
+
for (let n = 0; n < this.data.length; n++) {
|
|
2433
|
+
const i = this.data[n], r = i.open ?? i.y ?? 0, s = i.high ?? r, o = i.low ?? r, a = i.close ?? r, c = (r + s + o + a) / 4;
|
|
2434
|
+
let l;
|
|
2435
|
+
if (n === 0)
|
|
2436
|
+
l = (r + a) / 2;
|
|
2437
|
+
else {
|
|
2438
|
+
const f = t[n - 1];
|
|
2439
|
+
l = (f.open + f.close) / 2;
|
|
2440
|
+
}
|
|
2441
|
+
const u = Math.max(s, l, c), h = Math.min(o, l, c);
|
|
2442
|
+
t.push({
|
|
2443
|
+
...i,
|
|
2444
|
+
open: l,
|
|
2445
|
+
high: u,
|
|
2446
|
+
low: h,
|
|
2447
|
+
close: c,
|
|
2448
|
+
y: c
|
|
2449
|
+
});
|
|
2450
|
+
}
|
|
2451
|
+
this.data = t;
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
class zo extends Xn {
|
|
2455
|
+
getCandleStyle(t) {
|
|
2456
|
+
const n = t.index > 0 ? t.data[t.index - 1].close ?? t.data[t.index - 1].y ?? 0 : t.open, i = t.close > n, r = i ? t.upColor : t.downColor;
|
|
2457
|
+
return {
|
|
2458
|
+
fill: i ? "none" : t.downColor,
|
|
2459
|
+
stroke: r,
|
|
2460
|
+
wick: r
|
|
2461
|
+
};
|
|
2462
|
+
}
|
|
2463
|
+
getCandleClass() {
|
|
2464
|
+
return "katucharts-candlestick katucharts-hollow-candlestick";
|
|
2465
|
+
}
|
|
2466
|
+
}
|
|
2467
|
+
class Ho extends Z {
|
|
2468
|
+
constructor(t) {
|
|
2469
|
+
super(t);
|
|
2470
|
+
}
|
|
2471
|
+
render() {
|
|
2472
|
+
var m, g, x, _;
|
|
2473
|
+
const { xAxis: t, yAxis: n, plotArea: i } = this.context, r = this.context.animate, s = this.data, o = this.config.groupPadding ?? 0.2, a = this.config.pointPadding ?? 0.1, c = o + a, l = this.config.maxPointWidth ?? 1 / 0, u = Math.max(
|
|
2474
|
+
1,
|
|
2475
|
+
Math.min(l, i.width / Math.max(1, s.length) * (1 - c))
|
|
2476
|
+
), h = this.config.pointWidth ?? u, f = this.config.upColor || "#2f7ed8", p = this.config.color || "#f45b5b", d = ((g = (m = this.config.states) == null ? void 0 : m.inactive) == null ? void 0 : g.opacity) ?? 0.4;
|
|
2477
|
+
(_ = (x = this.config.states) == null ? void 0 : x.hover) == null || _.brightness;
|
|
2478
|
+
const y = [];
|
|
2479
|
+
for (let w = 0; w < s.length; w++) {
|
|
2480
|
+
const v = s[w];
|
|
2481
|
+
if (v.y === null || v.y === void 0) continue;
|
|
2482
|
+
const b = v.y, k = v.open ?? 0, P = (v.close ?? 0) >= k ? f : p, R = t.getPixelForValue(v.x ?? w), M = n.getPixelForValue(b), N = n.getPixelForValue(0), $ = Math.max(0, N - M), F = this.group.append("rect").attr("class", "katucharts-volume-bar").attr("x", R - h / 2).attr("width", h).attr("fill", P).attr("rx", 1);
|
|
2483
|
+
r ? F.attr("y", N).attr("height", 0).transition().duration(V).ease(X).delay(lt(w, 0, Y, s.length)).attr("y", M).attr("height", $) : F.attr("y", M).attr("height", $), y.push(F), this.config.enableMouseTracking !== !1 && F.style("cursor", this.config.cursor || "pointer").on("mouseover", (S) => {
|
|
2484
|
+
var A, L;
|
|
2485
|
+
F.transition("hover").duration(T).ease(I).attr("opacity", 0.8), y.forEach((O, D) => {
|
|
2486
|
+
D !== w && O.interrupt("highlight");
|
|
2487
|
+
}), y.forEach((O, D) => {
|
|
2488
|
+
D !== w && O.transition("highlight").duration(T).ease(I).attr("opacity", d);
|
|
2489
|
+
}), this.context.events.emit("point:mouseover", {
|
|
2490
|
+
point: v,
|
|
2491
|
+
index: w,
|
|
2492
|
+
series: this,
|
|
2493
|
+
event: S,
|
|
2494
|
+
plotX: R,
|
|
2495
|
+
plotY: M
|
|
2496
|
+
}), (L = (A = v.events) == null ? void 0 : A.mouseOver) == null || L.call(v, S);
|
|
2497
|
+
}).on("mouseout", (S) => {
|
|
2498
|
+
var A, L;
|
|
2499
|
+
F.transition("hover").duration(T).ease(I).attr("opacity", 1), y.forEach((O) => {
|
|
2500
|
+
O.interrupt("highlight"), O.transition("highlight").duration(T).ease(I).attr("opacity", 1);
|
|
2501
|
+
}), this.context.events.emit("point:mouseout", {
|
|
2502
|
+
point: v,
|
|
2503
|
+
index: w,
|
|
2504
|
+
series: this,
|
|
2505
|
+
event: S
|
|
2506
|
+
}), (L = (A = v.events) == null ? void 0 : A.mouseOut) == null || L.call(v, S);
|
|
2507
|
+
}).on("click", (S) => {
|
|
2508
|
+
var A, L, O, D;
|
|
2509
|
+
this.context.events.emit("point:click", {
|
|
2510
|
+
point: v,
|
|
2511
|
+
index: w,
|
|
2512
|
+
series: this,
|
|
2513
|
+
event: S
|
|
2514
|
+
}), (L = (A = v.events) == null ? void 0 : A.click) == null || L.call(v, S), (D = (O = this.config.events) == null ? void 0 : O.click) == null || D.call(this, S);
|
|
2515
|
+
});
|
|
2516
|
+
}
|
|
2517
|
+
r && this.emitAfterAnimate(V + s.length * Y), this.renderDataLabels(
|
|
2518
|
+
s,
|
|
2519
|
+
(w, v) => t.getPixelForValue(w.x ?? v),
|
|
2520
|
+
(w, v) => n.getPixelForValue(w.y ?? 0)
|
|
2521
|
+
);
|
|
2522
|
+
}
|
|
2523
|
+
/**
|
|
2524
|
+
* Volume always starts from zero on the y-axis.
|
|
2525
|
+
*/
|
|
2526
|
+
getDataExtents() {
|
|
2527
|
+
let t = 1 / 0, n = -1 / 0, i = -1 / 0;
|
|
2528
|
+
for (const r of this.data) {
|
|
2529
|
+
const s = r.x ?? 0;
|
|
2530
|
+
s < t && (t = s), s > n && (n = s);
|
|
2531
|
+
const o = r.y ?? 0;
|
|
2532
|
+
o > i && (i = o);
|
|
2533
|
+
}
|
|
2534
|
+
return { xMin: t, xMax: n, yMin: 0, yMax: i };
|
|
2535
|
+
}
|
|
2536
|
+
}
|
|
2537
|
+
function B(e) {
|
|
2538
|
+
return function() {
|
|
2539
|
+
return e;
|
|
2540
|
+
};
|
|
2541
|
+
}
|
|
2542
|
+
const on = 1e-12, xe = Math.PI, ye = 2 * xe, ht = 1e-6, Bo = ye - ht;
|
|
2543
|
+
function Wn(e) {
|
|
2544
|
+
this._ += e[0];
|
|
2545
|
+
for (let t = 1, n = e.length; t < n; ++t)
|
|
2546
|
+
this._ += arguments[t] + e[t];
|
|
2547
|
+
}
|
|
2548
|
+
function Xo(e) {
|
|
2549
|
+
let t = Math.floor(e);
|
|
2550
|
+
if (!(t >= 0)) throw new Error(`invalid digits: ${e}`);
|
|
2551
|
+
if (t > 15) return Wn;
|
|
2552
|
+
const n = 10 ** t;
|
|
2553
|
+
return function(i) {
|
|
2554
|
+
this._ += i[0];
|
|
2555
|
+
for (let r = 1, s = i.length; r < s; ++r)
|
|
2556
|
+
this._ += Math.round(arguments[r] * n) / n + i[r];
|
|
2557
|
+
};
|
|
2558
|
+
}
|
|
2559
|
+
class Wo {
|
|
2560
|
+
constructor(t) {
|
|
2561
|
+
this._x0 = this._y0 = // start of current subpath
|
|
2562
|
+
this._x1 = this._y1 = null, this._ = "", this._append = t == null ? Wn : Xo(t);
|
|
2563
|
+
}
|
|
2564
|
+
moveTo(t, n) {
|
|
2565
|
+
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +n}`;
|
|
2566
|
+
}
|
|
2567
|
+
closePath() {
|
|
2568
|
+
this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
|
|
2569
|
+
}
|
|
2570
|
+
lineTo(t, n) {
|
|
2571
|
+
this._append`L${this._x1 = +t},${this._y1 = +n}`;
|
|
2572
|
+
}
|
|
2573
|
+
quadraticCurveTo(t, n, i, r) {
|
|
2574
|
+
this._append`Q${+t},${+n},${this._x1 = +i},${this._y1 = +r}`;
|
|
2575
|
+
}
|
|
2576
|
+
bezierCurveTo(t, n, i, r, s, o) {
|
|
2577
|
+
this._append`C${+t},${+n},${+i},${+r},${this._x1 = +s},${this._y1 = +o}`;
|
|
2578
|
+
}
|
|
2579
|
+
arcTo(t, n, i, r, s) {
|
|
2580
|
+
if (t = +t, n = +n, i = +i, r = +r, s = +s, s < 0) throw new Error(`negative radius: ${s}`);
|
|
2581
|
+
let o = this._x1, a = this._y1, c = i - t, l = r - n, u = o - t, h = a - n, f = u * u + h * h;
|
|
2582
|
+
if (this._x1 === null)
|
|
2583
|
+
this._append`M${this._x1 = t},${this._y1 = n}`;
|
|
2584
|
+
else if (f > ht) if (!(Math.abs(h * c - l * u) > ht) || !s)
|
|
2585
|
+
this._append`L${this._x1 = t},${this._y1 = n}`;
|
|
2586
|
+
else {
|
|
2587
|
+
let p = i - o, d = r - a, y = c * c + l * l, m = p * p + d * d, g = Math.sqrt(y), x = Math.sqrt(f), _ = s * Math.tan((xe - Math.acos((y + f - m) / (2 * g * x))) / 2), w = _ / x, v = _ / g;
|
|
2588
|
+
Math.abs(w - 1) > ht && this._append`L${t + w * u},${n + w * h}`, this._append`A${s},${s},0,0,${+(h * p > u * d)},${this._x1 = t + v * c},${this._y1 = n + v * l}`;
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
arc(t, n, i, r, s, o) {
|
|
2592
|
+
if (t = +t, n = +n, i = +i, o = !!o, i < 0) throw new Error(`negative radius: ${i}`);
|
|
2593
|
+
let a = i * Math.cos(r), c = i * Math.sin(r), l = t + a, u = n + c, h = 1 ^ o, f = o ? r - s : s - r;
|
|
2594
|
+
this._x1 === null ? this._append`M${l},${u}` : (Math.abs(this._x1 - l) > ht || Math.abs(this._y1 - u) > ht) && this._append`L${l},${u}`, i && (f < 0 && (f = f % ye + ye), f > Bo ? this._append`A${i},${i},0,1,${h},${t - a},${n - c}A${i},${i},0,1,${h},${this._x1 = l},${this._y1 = u}` : f > ht && this._append`A${i},${i},0,${+(f >= xe)},${h},${this._x1 = t + i * Math.cos(s)},${this._y1 = n + i * Math.sin(s)}`);
|
|
2595
|
+
}
|
|
2596
|
+
rect(t, n, i, r) {
|
|
2597
|
+
this._append`M${this._x0 = this._x1 = +t},${this._y0 = this._y1 = +n}h${i = +i}v${+r}h${-i}Z`;
|
|
2598
|
+
}
|
|
2599
|
+
toString() {
|
|
2600
|
+
return this._;
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
function Un(e) {
|
|
2604
|
+
let t = 3;
|
|
2605
|
+
return e.digits = function(n) {
|
|
2606
|
+
if (!arguments.length) return t;
|
|
2607
|
+
if (n == null)
|
|
2608
|
+
t = null;
|
|
2609
|
+
else {
|
|
2610
|
+
const i = Math.floor(n);
|
|
2611
|
+
if (!(i >= 0)) throw new RangeError(`invalid digits: ${n}`);
|
|
2612
|
+
t = i;
|
|
2613
|
+
}
|
|
2614
|
+
return e;
|
|
2615
|
+
}, () => new Wo(t);
|
|
2616
|
+
}
|
|
2617
|
+
function Yn(e) {
|
|
2618
|
+
return typeof e == "object" && "length" in e ? e : Array.from(e);
|
|
2619
|
+
}
|
|
2620
|
+
function qn(e) {
|
|
2621
|
+
this._context = e;
|
|
2622
|
+
}
|
|
2623
|
+
qn.prototype = {
|
|
2624
|
+
areaStart: function() {
|
|
2625
|
+
this._line = 0;
|
|
2626
|
+
},
|
|
2627
|
+
areaEnd: function() {
|
|
2628
|
+
this._line = NaN;
|
|
2629
|
+
},
|
|
2630
|
+
lineStart: function() {
|
|
2631
|
+
this._point = 0;
|
|
2632
|
+
},
|
|
2633
|
+
lineEnd: function() {
|
|
2634
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
2635
|
+
},
|
|
2636
|
+
point: function(e, t) {
|
|
2637
|
+
switch (e = +e, t = +t, this._point) {
|
|
2638
|
+
case 0:
|
|
2639
|
+
this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
|
|
2640
|
+
break;
|
|
2641
|
+
case 1:
|
|
2642
|
+
this._point = 2;
|
|
2643
|
+
default:
|
|
2644
|
+
this._context.lineTo(e, t);
|
|
2645
|
+
break;
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
};
|
|
2649
|
+
function Tt(e) {
|
|
2650
|
+
return new qn(e);
|
|
2651
|
+
}
|
|
2652
|
+
function Gn(e) {
|
|
2653
|
+
return e[0];
|
|
2654
|
+
}
|
|
2655
|
+
function Kn(e) {
|
|
2656
|
+
return e[1];
|
|
2657
|
+
}
|
|
2658
|
+
function ut(e, t) {
|
|
2659
|
+
var n = B(!0), i = null, r = Tt, s = null, o = Un(a);
|
|
2660
|
+
e = typeof e == "function" ? e : e === void 0 ? Gn : B(e), t = typeof t == "function" ? t : t === void 0 ? Kn : B(t);
|
|
2661
|
+
function a(c) {
|
|
2662
|
+
var l, u = (c = Yn(c)).length, h, f = !1, p;
|
|
2663
|
+
for (i == null && (s = r(p = o())), l = 0; l <= u; ++l)
|
|
2664
|
+
!(l < u && n(h = c[l], l, c)) === f && ((f = !f) ? s.lineStart() : s.lineEnd()), f && s.point(+e(h, l, c), +t(h, l, c));
|
|
2665
|
+
if (p) return s = null, p + "" || null;
|
|
2666
|
+
}
|
|
2667
|
+
return a.x = function(c) {
|
|
2668
|
+
return arguments.length ? (e = typeof c == "function" ? c : B(+c), a) : e;
|
|
2669
|
+
}, a.y = function(c) {
|
|
2670
|
+
return arguments.length ? (t = typeof c == "function" ? c : B(+c), a) : t;
|
|
2671
|
+
}, a.defined = function(c) {
|
|
2672
|
+
return arguments.length ? (n = typeof c == "function" ? c : B(!!c), a) : n;
|
|
2673
|
+
}, a.curve = function(c) {
|
|
2674
|
+
return arguments.length ? (r = c, i != null && (s = r(i)), a) : r;
|
|
2675
|
+
}, a.context = function(c) {
|
|
2676
|
+
return arguments.length ? (c == null ? i = s = null : s = r(i = c), a) : i;
|
|
2677
|
+
}, a;
|
|
2678
|
+
}
|
|
2679
|
+
function me(e, t, n) {
|
|
2680
|
+
var i = null, r = B(!0), s = null, o = Tt, a = null, c = Un(l);
|
|
2681
|
+
e = typeof e == "function" ? e : e === void 0 ? Gn : B(+e), t = typeof t == "function" ? t : B(t === void 0 ? 0 : +t), n = typeof n == "function" ? n : n === void 0 ? Kn : B(+n);
|
|
2682
|
+
function l(h) {
|
|
2683
|
+
var f, p, d, y = (h = Yn(h)).length, m, g = !1, x, _ = new Array(y), w = new Array(y);
|
|
2684
|
+
for (s == null && (a = o(x = c())), f = 0; f <= y; ++f) {
|
|
2685
|
+
if (!(f < y && r(m = h[f], f, h)) === g)
|
|
2686
|
+
if (g = !g)
|
|
2687
|
+
p = f, a.areaStart(), a.lineStart();
|
|
2688
|
+
else {
|
|
2689
|
+
for (a.lineEnd(), a.lineStart(), d = f - 1; d >= p; --d)
|
|
2690
|
+
a.point(_[d], w[d]);
|
|
2691
|
+
a.lineEnd(), a.areaEnd();
|
|
2692
|
+
}
|
|
2693
|
+
g && (_[f] = +e(m, f, h), w[f] = +t(m, f, h), a.point(i ? +i(m, f, h) : _[f], n ? +n(m, f, h) : w[f]));
|
|
2694
|
+
}
|
|
2695
|
+
if (x) return a = null, x + "" || null;
|
|
2696
|
+
}
|
|
2697
|
+
function u() {
|
|
2698
|
+
return ut().defined(r).curve(o).context(s);
|
|
2699
|
+
}
|
|
2700
|
+
return l.x = function(h) {
|
|
2701
|
+
return arguments.length ? (e = typeof h == "function" ? h : B(+h), i = null, l) : e;
|
|
2702
|
+
}, l.x0 = function(h) {
|
|
2703
|
+
return arguments.length ? (e = typeof h == "function" ? h : B(+h), l) : e;
|
|
2704
|
+
}, l.x1 = function(h) {
|
|
2705
|
+
return arguments.length ? (i = h == null ? null : typeof h == "function" ? h : B(+h), l) : i;
|
|
2706
|
+
}, l.y = function(h) {
|
|
2707
|
+
return arguments.length ? (t = typeof h == "function" ? h : B(+h), n = null, l) : t;
|
|
2708
|
+
}, l.y0 = function(h) {
|
|
2709
|
+
return arguments.length ? (t = typeof h == "function" ? h : B(+h), l) : t;
|
|
2710
|
+
}, l.y1 = function(h) {
|
|
2711
|
+
return arguments.length ? (n = h == null ? null : typeof h == "function" ? h : B(+h), l) : n;
|
|
2712
|
+
}, l.lineX0 = l.lineY0 = function() {
|
|
2713
|
+
return u().x(e).y(t);
|
|
2714
|
+
}, l.lineY1 = function() {
|
|
2715
|
+
return u().x(e).y(n);
|
|
2716
|
+
}, l.lineX1 = function() {
|
|
2717
|
+
return u().x(i).y(t);
|
|
2718
|
+
}, l.defined = function(h) {
|
|
2719
|
+
return arguments.length ? (r = typeof h == "function" ? h : B(!!h), l) : r;
|
|
2720
|
+
}, l.curve = function(h) {
|
|
2721
|
+
return arguments.length ? (o = h, s != null && (a = o(s)), l) : o;
|
|
2722
|
+
}, l.context = function(h) {
|
|
2723
|
+
return arguments.length ? (h == null ? s = a = null : a = o(s = h), l) : s;
|
|
2724
|
+
}, l;
|
|
2725
|
+
}
|
|
2726
|
+
function an(e, t, n) {
|
|
2727
|
+
e._context.bezierCurveTo(
|
|
2728
|
+
e._x1 + e._k * (e._x2 - e._x0),
|
|
2729
|
+
e._y1 + e._k * (e._y2 - e._y0),
|
|
2730
|
+
e._x2 + e._k * (e._x1 - t),
|
|
2731
|
+
e._y2 + e._k * (e._y1 - n),
|
|
2732
|
+
e._x2,
|
|
2733
|
+
e._y2
|
|
2734
|
+
);
|
|
2735
|
+
}
|
|
2736
|
+
function Pe(e, t) {
|
|
2737
|
+
this._context = e, this._k = (1 - t) / 6;
|
|
2738
|
+
}
|
|
2739
|
+
Pe.prototype = {
|
|
2740
|
+
areaStart: function() {
|
|
2741
|
+
this._line = 0;
|
|
2742
|
+
},
|
|
2743
|
+
areaEnd: function() {
|
|
2744
|
+
this._line = NaN;
|
|
2745
|
+
},
|
|
2746
|
+
lineStart: function() {
|
|
2747
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
|
|
2748
|
+
},
|
|
2749
|
+
lineEnd: function() {
|
|
2750
|
+
switch (this._point) {
|
|
2751
|
+
case 2:
|
|
2752
|
+
this._context.lineTo(this._x2, this._y2);
|
|
2753
|
+
break;
|
|
2754
|
+
case 3:
|
|
2755
|
+
an(this, this._x1, this._y1);
|
|
2756
|
+
break;
|
|
2757
|
+
}
|
|
2758
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
2759
|
+
},
|
|
2760
|
+
point: function(e, t) {
|
|
2761
|
+
switch (e = +e, t = +t, this._point) {
|
|
2762
|
+
case 0:
|
|
2763
|
+
this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
|
|
2764
|
+
break;
|
|
2765
|
+
case 1:
|
|
2766
|
+
this._point = 2, this._x1 = e, this._y1 = t;
|
|
2767
|
+
break;
|
|
2768
|
+
case 2:
|
|
2769
|
+
this._point = 3;
|
|
2770
|
+
default:
|
|
2771
|
+
an(this, e, t);
|
|
2772
|
+
break;
|
|
2773
|
+
}
|
|
2774
|
+
this._x0 = this._x1, this._x1 = this._x2, this._x2 = e, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
|
|
2775
|
+
}
|
|
2776
|
+
};
|
|
2777
|
+
(function e(t) {
|
|
2778
|
+
function n(i) {
|
|
2779
|
+
return new Pe(i, t);
|
|
2780
|
+
}
|
|
2781
|
+
return n.tension = function(i) {
|
|
2782
|
+
return e(+i);
|
|
2783
|
+
}, n;
|
|
2784
|
+
})(0);
|
|
2785
|
+
function Uo(e, t, n) {
|
|
2786
|
+
var i = e._x1, r = e._y1, s = e._x2, o = e._y2;
|
|
2787
|
+
if (e._l01_a > on) {
|
|
2788
|
+
var a = 2 * e._l01_2a + 3 * e._l01_a * e._l12_a + e._l12_2a, c = 3 * e._l01_a * (e._l01_a + e._l12_a);
|
|
2789
|
+
i = (i * a - e._x0 * e._l12_2a + e._x2 * e._l01_2a) / c, r = (r * a - e._y0 * e._l12_2a + e._y2 * e._l01_2a) / c;
|
|
2790
|
+
}
|
|
2791
|
+
if (e._l23_a > on) {
|
|
2792
|
+
var l = 2 * e._l23_2a + 3 * e._l23_a * e._l12_a + e._l12_2a, u = 3 * e._l23_a * (e._l23_a + e._l12_a);
|
|
2793
|
+
s = (s * l + e._x1 * e._l23_2a - t * e._l12_2a) / u, o = (o * l + e._y1 * e._l23_2a - n * e._l12_2a) / u;
|
|
2794
|
+
}
|
|
2795
|
+
e._context.bezierCurveTo(i, r, s, o, e._x2, e._y2);
|
|
2796
|
+
}
|
|
2797
|
+
function Zn(e, t) {
|
|
2798
|
+
this._context = e, this._alpha = t;
|
|
2799
|
+
}
|
|
2800
|
+
Zn.prototype = {
|
|
2801
|
+
areaStart: function() {
|
|
2802
|
+
this._line = 0;
|
|
2803
|
+
},
|
|
2804
|
+
areaEnd: function() {
|
|
2805
|
+
this._line = NaN;
|
|
2806
|
+
},
|
|
2807
|
+
lineStart: function() {
|
|
2808
|
+
this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
|
|
2809
|
+
},
|
|
2810
|
+
lineEnd: function() {
|
|
2811
|
+
switch (this._point) {
|
|
2812
|
+
case 2:
|
|
2813
|
+
this._context.lineTo(this._x2, this._y2);
|
|
2814
|
+
break;
|
|
2815
|
+
case 3:
|
|
2816
|
+
this.point(this._x2, this._y2);
|
|
2817
|
+
break;
|
|
2818
|
+
}
|
|
2819
|
+
(this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
|
|
2820
|
+
},
|
|
2821
|
+
point: function(e, t) {
|
|
2822
|
+
if (e = +e, t = +t, this._point) {
|
|
2823
|
+
var n = this._x2 - e, i = this._y2 - t;
|
|
2824
|
+
this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + i * i, this._alpha));
|
|
2825
|
+
}
|
|
2826
|
+
switch (this._point) {
|
|
2827
|
+
case 0:
|
|
2828
|
+
this._point = 1, this._line ? this._context.lineTo(e, t) : this._context.moveTo(e, t);
|
|
2829
|
+
break;
|
|
2830
|
+
case 1:
|
|
2831
|
+
this._point = 2;
|
|
2832
|
+
break;
|
|
2833
|
+
case 2:
|
|
2834
|
+
this._point = 3;
|
|
2835
|
+
default:
|
|
2836
|
+
Uo(this, e, t);
|
|
2837
|
+
break;
|
|
2838
|
+
}
|
|
2839
|
+
this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = e, this._y0 = this._y1, this._y1 = this._y2, this._y2 = t;
|
|
2840
|
+
}
|
|
2841
|
+
};
|
|
2842
|
+
const Yo = function e(t) {
|
|
2843
|
+
function n(i) {
|
|
2844
|
+
return t ? new Zn(i, t) : new Pe(i, 0);
|
|
2845
|
+
}
|
|
2846
|
+
return n.alpha = function(i) {
|
|
2847
|
+
return e(+i);
|
|
2848
|
+
}, n;
|
|
2849
|
+
}(0.5);
|
|
2850
|
+
class Jn extends Z {
|
|
2851
|
+
constructor(t) {
|
|
2852
|
+
super(t);
|
|
2853
|
+
}
|
|
2854
|
+
/** Curve used for the band edges. Overridden by areasplinerange for smoothing. */
|
|
2855
|
+
getCurve() {
|
|
2856
|
+
return Tt;
|
|
2857
|
+
}
|
|
2858
|
+
render() {
|
|
2859
|
+
const { xAxis: t, yAxis: n, plotArea: i } = this.context, r = this.context.animate, s = this.data, o = this.getColor(), a = this.config.fillOpacity ?? 0.3, c = this.config.fillColor || o, l = this.config.lineColor || o, u = this.config.lineWidth ?? 1, h = s.filter((g) => {
|
|
2860
|
+
const x = g.low, _ = g.high ?? g.y;
|
|
2861
|
+
return x != null && _ !== void 0 && _ !== null;
|
|
2862
|
+
});
|
|
2863
|
+
if (h.length === 0) return;
|
|
2864
|
+
const f = (g, x) => t.getPixelForValue(g.x ?? x), p = (g) => n.getPixelForValue(g.low), d = (g) => n.getPixelForValue(g.high ?? g.y), y = me().x((g, x) => f(g, x)).y0((g) => p(g)).y1((g) => d(g)).curve(this.getCurve()), m = this.group.append("path").datum(h).attr("class", "katucharts-arearange-fill").attr("d", y).attr("fill", c).attr("fill-opacity", a).attr("stroke", "none");
|
|
2865
|
+
if (u > 0) {
|
|
2866
|
+
const g = ut().x((_, w) => f(_, w)).y((_) => d(_)).curve(this.getCurve()), x = ut().x((_, w) => f(_, w)).y((_) => p(_)).curve(this.getCurve());
|
|
2867
|
+
this.group.append("path").datum(h).attr("class", "katucharts-arearange-line-top").attr("d", g).attr("fill", "none").attr("stroke", l).attr("stroke-width", u), this.group.append("path").datum(h).attr("class", "katucharts-arearange-line-bottom").attr("d", x).attr("fill", "none").attr("stroke", l).attr("stroke-width", u);
|
|
2868
|
+
}
|
|
2869
|
+
if (r) {
|
|
2870
|
+
const g = i.height / 2, x = me().x((_, w) => f(_, w)).y0(() => g).y1(() => g).curve(this.getCurve());
|
|
2871
|
+
if (m.attr("d", x).transition().duration(V).ease(X).attr("d", y), u > 0) {
|
|
2872
|
+
const w = ut().x((k, E) => f(k, E)).y(() => g).curve(this.getCurve())(h) || "", v = ut().x((k, E) => f(k, E)).y((k) => d(k)).curve(this.getCurve())(h) || "", b = ut().x((k, E) => f(k, E)).y((k) => p(k)).curve(this.getCurve())(h) || "";
|
|
2873
|
+
this.group.select(".katucharts-arearange-line-top").attr("d", w).transition().duration(V).ease(X).attr("d", v), this.group.select(".katucharts-arearange-line-bottom").attr("d", w).transition().duration(V).ease(X).attr("d", b);
|
|
2874
|
+
}
|
|
2875
|
+
this.emitAfterAnimate(V);
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
/**
|
|
2879
|
+
* Computes extents using low/high values for the y-axis range.
|
|
2880
|
+
*/
|
|
2881
|
+
getDataExtents() {
|
|
2882
|
+
let t = 1 / 0, n = -1 / 0, i = 1 / 0, r = -1 / 0;
|
|
2883
|
+
for (const s of this.data) {
|
|
2884
|
+
const o = s.x ?? 0;
|
|
2885
|
+
o < t && (t = o), o > n && (n = o);
|
|
2886
|
+
const a = s.low, c = s.high ?? s.y;
|
|
2887
|
+
a != null && (a < i && (i = a), a > r && (r = a)), c != null && (c < i && (i = c), c > r && (r = c));
|
|
2888
|
+
}
|
|
2889
|
+
return { xMin: t, xMax: n, yMin: i, yMax: r };
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
class qo extends Jn {
|
|
2893
|
+
getCurve() {
|
|
2894
|
+
return Yo.alpha(0.5);
|
|
2895
|
+
}
|
|
2896
|
+
}
|
|
2897
|
+
class Go extends Z {
|
|
2898
|
+
constructor(t) {
|
|
2899
|
+
super(t);
|
|
2900
|
+
}
|
|
2901
|
+
render() {
|
|
2902
|
+
var m, g;
|
|
2903
|
+
const { xAxis: t, yAxis: n, plotArea: i } = this.context, r = this.context.animate, s = this.data, o = this.config.groupPadding ?? 0.2, a = this.config.pointPadding ?? 0.1, c = o + a, l = this.config.maxPointWidth ?? 1 / 0, u = Math.max(
|
|
2904
|
+
1,
|
|
2905
|
+
Math.min(l, i.width / Math.max(1, s.length) * (1 - c))
|
|
2906
|
+
), h = this.config.pointWidth ?? u, f = this.getColor(), p = this.config.borderRadius ?? 0, d = ((g = (m = this.config.states) == null ? void 0 : m.inactive) == null ? void 0 : g.opacity) ?? 0.4, y = [];
|
|
2907
|
+
for (let x = 0; x < s.length; x++) {
|
|
2908
|
+
const _ = s[x], w = _.low, v = _.high ?? _.y;
|
|
2909
|
+
if (w == null || v === void 0 || v === null) continue;
|
|
2910
|
+
const b = t.getPixelForValue(_.x ?? x), k = n.getPixelForValue(v), E = n.getPixelForValue(w), C = Math.min(k, E), P = Math.max(1, Math.abs(E - k)), R = _.color || f, M = this.group.append("rect").attr("class", "katucharts-columnrange-bar").attr("x", b - h / 2).attr("width", h).attr("fill", R).attr("rx", p).style("cursor", this.config.cursor || "pointer");
|
|
2911
|
+
if (r) {
|
|
2912
|
+
const N = C + P / 2;
|
|
2913
|
+
M.attr("y", N).attr("height", 0).transition().duration(V).ease(X).delay(lt(x, 0, Y, s.length)).attr("y", C).attr("height", P);
|
|
2914
|
+
} else
|
|
2915
|
+
M.attr("y", C).attr("height", P);
|
|
2916
|
+
y.push(M), this.config.enableMouseTracking !== !1 && M.on("mouseover", (N) => {
|
|
2917
|
+
var $, F;
|
|
2918
|
+
M.transition("hover").duration(T).ease(I).attr("opacity", 0.85), y.forEach((S, A) => {
|
|
2919
|
+
A !== x && S.interrupt("highlight"), A !== x && S.transition("highlight").duration(T).ease(I).attr("opacity", d);
|
|
2920
|
+
}), this.context.events.emit("point:mouseover", {
|
|
2921
|
+
point: _,
|
|
2922
|
+
index: x,
|
|
2923
|
+
series: this,
|
|
2924
|
+
event: N,
|
|
2925
|
+
plotX: b,
|
|
2926
|
+
plotY: k
|
|
2927
|
+
}), (F = ($ = _.events) == null ? void 0 : $.mouseOver) == null || F.call(_, N);
|
|
2928
|
+
}).on("mouseout", (N) => {
|
|
2929
|
+
var $, F;
|
|
2930
|
+
M.transition("hover").duration(T).ease(I).attr("opacity", 1), y.forEach((S) => {
|
|
2931
|
+
S.interrupt("highlight"), S.transition("highlight").duration(T).ease(I).attr("opacity", 1);
|
|
2932
|
+
}), this.context.events.emit("point:mouseout", { point: _, index: x, series: this, event: N }), (F = ($ = _.events) == null ? void 0 : $.mouseOut) == null || F.call(_, N);
|
|
2933
|
+
}).on("click", (N) => {
|
|
2934
|
+
var $, F, S, A;
|
|
2935
|
+
this.context.events.emit("point:click", { point: _, index: x, series: this, event: N }), (F = ($ = _.events) == null ? void 0 : $.click) == null || F.call(_, N), (A = (S = this.config.events) == null ? void 0 : S.click) == null || A.call(this, N);
|
|
2936
|
+
});
|
|
2937
|
+
}
|
|
2938
|
+
r && this.emitAfterAnimate(V + s.length * Y);
|
|
2939
|
+
}
|
|
2940
|
+
getDataExtents() {
|
|
2941
|
+
let t = 1 / 0, n = -1 / 0, i = 1 / 0, r = -1 / 0;
|
|
2942
|
+
for (const s of this.data) {
|
|
2943
|
+
const o = s.x ?? 0;
|
|
2944
|
+
o < t && (t = o), o > n && (n = o);
|
|
2945
|
+
const a = s.low, c = s.high ?? s.y;
|
|
2946
|
+
a != null && (a < i && (i = a), a > r && (r = a)), c != null && (c < i && (i = c), c > r && (r = c));
|
|
2947
|
+
}
|
|
2948
|
+
return { xMin: t, xMax: n, yMin: i, yMax: r };
|
|
2949
|
+
}
|
|
2950
|
+
}
|
|
2951
|
+
class Ko extends Z {
|
|
2952
|
+
constructor(t) {
|
|
2953
|
+
super(t);
|
|
2954
|
+
}
|
|
2955
|
+
render() {
|
|
2956
|
+
const { yAxis: t, plotArea: n } = this.context, i = this.context.animate, r = this.data;
|
|
2957
|
+
if (r.length === 0) return;
|
|
2958
|
+
const s = Math.max(...r.map((h) => h.volume ?? 0)) || 1, o = this.config.zoneWidth ?? 0.3, a = n.width * o, c = this.config.color || "rgba(120,150,200,0.45)", l = this.config.upColor, u = this.config.fillOpacity ?? 0.5;
|
|
2959
|
+
for (const h of r) {
|
|
2960
|
+
const f = h.low, p = h.high, d = h.volume ?? 0;
|
|
2961
|
+
if (f === void 0 || p === void 0) continue;
|
|
2962
|
+
const y = t.getPixelForValue(p), m = t.getPixelForValue(f), g = Math.min(y, m), x = Math.max(1, Math.abs(m - y) - 1), _ = d / s * a, w = this.group.append("rect").attr("class", "katucharts-vbp-bar").attr("x", 0).attr("y", g).attr("height", x).attr("fill", l || c).attr("opacity", u);
|
|
2963
|
+
i ? w.attr("width", 0).transition().duration(V).ease(X).attr("width", _) : w.attr("width", _), this.config.enableMouseTracking !== !1 && w.on("mouseover", (v) => {
|
|
2964
|
+
this.context.events.emit("point:mouseover", {
|
|
2965
|
+
point: { x: h.x, y: h.y, low: f, high: p, volume: d },
|
|
2966
|
+
index: 0,
|
|
2967
|
+
series: this,
|
|
2968
|
+
event: v,
|
|
2969
|
+
plotX: _,
|
|
2970
|
+
plotY: g
|
|
2971
|
+
});
|
|
2972
|
+
}).on("mouseout", (v) => {
|
|
2973
|
+
this.context.events.emit("point:mouseout", { point: h, index: 0, series: this, event: v });
|
|
2974
|
+
});
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
getDataExtents() {
|
|
2978
|
+
return { xMin: 1 / 0, xMax: -1 / 0, yMin: 1 / 0, yMax: -1 / 0 };
|
|
2979
|
+
}
|
|
2980
|
+
}
|
|
2981
|
+
class Zo extends Z {
|
|
2982
|
+
constructor(t) {
|
|
2983
|
+
super(t);
|
|
2984
|
+
}
|
|
2985
|
+
render() {
|
|
2986
|
+
var w, v, b, k, E, C;
|
|
2987
|
+
const { xAxis: t, yAxis: n, plotArea: i } = this.context, r = this.context.animate, s = this.data, o = this.config.threshold ?? 0, a = n.getPixelForValue(o), c = {
|
|
2988
|
+
color: ((w = this.config.topLine) == null ? void 0 : w.color) ?? "#2f7ed8",
|
|
2989
|
+
fillColor: ((v = this.config.topLine) == null ? void 0 : v.fillColor) ?? "rgba(47,126,216,0.2)",
|
|
2990
|
+
fillOpacity: ((b = this.config.topLine) == null ? void 0 : b.fillOpacity) ?? 1
|
|
2991
|
+
}, l = {
|
|
2992
|
+
color: ((k = this.config.bottomLine) == null ? void 0 : k.color) ?? "#f45b5b",
|
|
2993
|
+
fillColor: ((E = this.config.bottomLine) == null ? void 0 : E.fillColor) ?? "rgba(244,91,91,0.2)",
|
|
2994
|
+
fillOpacity: ((C = this.config.bottomLine) == null ? void 0 : C.fillOpacity) ?? 1
|
|
2995
|
+
}, u = this.config.lineWidth ?? 2, h = s.filter((P) => P.y !== null && P.y !== void 0);
|
|
2996
|
+
if (h.length === 0) return;
|
|
2997
|
+
const f = (P, R) => t.getPixelForValue(P.x ?? R), p = (P) => n.getPixelForValue(P.y ?? 0), d = `katucharts-baseline-top-${this.config.index}-${Date.now()}`, y = `katucharts-baseline-bottom-${this.config.index}-${Date.now()}`, m = this.group.select(function() {
|
|
2998
|
+
return this.ownerSVGElement;
|
|
2999
|
+
});
|
|
3000
|
+
if (m.empty()) return;
|
|
3001
|
+
let g = m.select("defs");
|
|
3002
|
+
g.empty() && (g = m.append("defs")), g.append("clipPath").attr("id", d).append("rect").attr("x", 0).attr("y", 0).attr("width", i.width).attr("height", Math.max(0, a)), g.append("clipPath").attr("id", y).append("rect").attr("x", 0).attr("y", a).attr("width", i.width).attr("height", Math.max(0, i.height - a));
|
|
3003
|
+
const x = me().x((P, R) => f(P, R)).y0(() => a).y1((P) => p(P)).curve(Tt), _ = ut().x((P, R) => f(P, R)).y((P) => p(P)).curve(Tt);
|
|
3004
|
+
this.renderZone(h, x, _, d, c, u, "top"), this.renderZone(h, x, _, y, l, u, "bottom"), this.config.lineWidth !== 0 && this.group.append("line").attr("class", "katucharts-baseline-threshold").attr("x1", 0).attr("x2", i.width).attr("y1", a).attr("y2", a).attr("stroke", "#999").attr("stroke-width", 1).attr("stroke-dasharray", "4,3").attr("opacity", 0.6), r && this.animateDrawIn(u);
|
|
3005
|
+
}
|
|
3006
|
+
/**
|
|
3007
|
+
* Renders an area + line pair clipped to one side of the threshold.
|
|
3008
|
+
*/
|
|
3009
|
+
renderZone(t, n, i, r, s, o, a) {
|
|
3010
|
+
const c = this.group.append("g").attr("class", `katucharts-baseline-zone-${a}`).attr("clip-path", `url(#${r})`);
|
|
3011
|
+
c.append("path").datum(t).attr("class", `katucharts-baseline-area-${a}`).attr("d", n).attr("fill", s.fillColor).attr("fill-opacity", s.fillOpacity).attr("stroke", "none"), c.append("path").datum(t).attr("class", `katucharts-baseline-line-${a}`).attr("d", i).attr("fill", "none").attr("stroke", s.color).attr("stroke-width", o);
|
|
3012
|
+
}
|
|
3013
|
+
/**
|
|
3014
|
+
* Stroke-dasharray draw-in animation from left to right.
|
|
3015
|
+
*/
|
|
3016
|
+
animateDrawIn(t) {
|
|
3017
|
+
this.group.selectAll('[class*="katucharts-baseline-line-"]').each(function() {
|
|
3018
|
+
var s;
|
|
3019
|
+
const n = this, i = ((s = n.getTotalLength) == null ? void 0 : s.call(n)) ?? 0;
|
|
3020
|
+
if (i === 0) return;
|
|
3021
|
+
const r = Nr(n);
|
|
3022
|
+
r.attr("stroke-dasharray", `${i} ${i}`).attr("stroke-dashoffset", i).transition().duration(V).ease(X).attr("stroke-dashoffset", 0).on("end", () => {
|
|
3023
|
+
r.attr("stroke-dasharray", null);
|
|
3024
|
+
});
|
|
3025
|
+
}), this.group.selectAll('[class*="katucharts-baseline-area-"]').attr("opacity", 0).transition().duration(V).ease(X).attr("opacity", 1), this.emitAfterAnimate(V);
|
|
3026
|
+
}
|
|
3027
|
+
getDataExtents() {
|
|
3028
|
+
let t = 1 / 0, n = -1 / 0, i = 1 / 0, r = -1 / 0;
|
|
3029
|
+
const s = this.config.threshold ?? 0;
|
|
3030
|
+
for (const o of this.data) {
|
|
3031
|
+
const a = o.x ?? 0;
|
|
3032
|
+
a < t && (t = a), a > n && (n = a);
|
|
3033
|
+
const c = o.y ?? 0;
|
|
3034
|
+
c < i && (i = c), c > r && (r = c);
|
|
3035
|
+
}
|
|
3036
|
+
return s < i && (i = s), s > r && (r = s), { xMin: t, xMax: n, yMin: i, yMax: r };
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
const ln = 30, Mt = 20, re = 25, se = 8, ct = 12, oe = "9px";
|
|
3040
|
+
class Jo extends Z {
|
|
3041
|
+
constructor(t) {
|
|
3042
|
+
super(t);
|
|
3043
|
+
}
|
|
3044
|
+
render() {
|
|
3045
|
+
const { xAxis: t, yAxis: n, plotArea: i } = this.context, r = this.context.animate, s = this.data, o = this.config.shape || "flag", a = this.getColor(), c = this.resolveOnSeries();
|
|
3046
|
+
for (let l = 0; l < s.length; l++) {
|
|
3047
|
+
const u = s[l];
|
|
3048
|
+
if (u.x === void 0 || u.x === null) continue;
|
|
3049
|
+
const h = t.getPixelForValue(u.x ?? l), f = this.resolveAnchorY(u, l, c, n, i), p = u.shape || o, d = u.color || this.config.color || a, y = u.title ?? "", m = this.group.append("g").attr("class", "katucharts-flag").style("cursor", this.config.cursor || "pointer"), g = f - re;
|
|
3050
|
+
if (m.append("line").attr("x1", h).attr("x2", h).attr("y1", f).attr("y2", g).attr("stroke", d).attr("stroke-width", 1), this.renderShape(m, p, h, g, d, y), r) {
|
|
3051
|
+
const x = lt(l, 0, Y, s.length);
|
|
3052
|
+
m.attr("opacity", 0).transition().duration(V).ease(X).delay(x).attr("opacity", 1);
|
|
3053
|
+
}
|
|
3054
|
+
this.attachFlagEvents(m, u, l, h, g);
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
/**
|
|
3058
|
+
* Flags are decorative markers and should not influence the y-axis range.
|
|
3059
|
+
* Only x extents are contributed.
|
|
3060
|
+
*/
|
|
3061
|
+
getDataExtents() {
|
|
3062
|
+
let t = 1 / 0, n = -1 / 0;
|
|
3063
|
+
for (const i of this.data)
|
|
3064
|
+
i.x !== void 0 && i.x !== null && (i.x < t && (t = i.x), i.x > n && (n = i.x));
|
|
3065
|
+
return { xMin: t, xMax: n, yMin: 1 / 0, yMax: -1 / 0 };
|
|
3066
|
+
}
|
|
3067
|
+
/**
|
|
3068
|
+
* Find the series referenced by the onSeries config option.
|
|
3069
|
+
* When found, flags will attach at the y-value of that series at each flag's x position.
|
|
3070
|
+
*/
|
|
3071
|
+
resolveOnSeries() {
|
|
3072
|
+
const t = this.config.onSeries;
|
|
3073
|
+
return this.context.allSeries ? t ? this.context.allSeries.find((n) => n.config.id === t) ?? null : this.context.allSeries.find(
|
|
3074
|
+
(n) => n !== this && n.config._internalType !== "flags"
|
|
3075
|
+
) ?? null : null;
|
|
3076
|
+
}
|
|
3077
|
+
/**
|
|
3078
|
+
* Determine the vertical anchor point for a flag. If onSeries is set,
|
|
3079
|
+
* interpolate the target series y-value at the flag's x position.
|
|
3080
|
+
* Otherwise anchor at the top of the plot area.
|
|
3081
|
+
*/
|
|
3082
|
+
resolveAnchorY(t, n, i, r, s) {
|
|
3083
|
+
if (!i) return re + Mt;
|
|
3084
|
+
const o = t.x ?? n, a = i.data;
|
|
3085
|
+
let c = null, l = 1 / 0;
|
|
3086
|
+
for (const u of a) {
|
|
3087
|
+
const h = u.x ?? 0, f = Math.abs(h - o);
|
|
3088
|
+
f < l && (l = f, c = u);
|
|
3089
|
+
}
|
|
3090
|
+
if (c) {
|
|
3091
|
+
const u = c.high ?? c.y;
|
|
3092
|
+
if (u != null)
|
|
3093
|
+
return r.getPixelForValue(u);
|
|
3094
|
+
}
|
|
3095
|
+
return re + Mt;
|
|
3096
|
+
}
|
|
3097
|
+
renderShape(t, n, i, r, s, o) {
|
|
3098
|
+
switch (n) {
|
|
3099
|
+
case "circlepin":
|
|
3100
|
+
t.append("circle").attr("cx", i).attr("cy", r - se).attr("r", se).attr("fill", s).attr("stroke", s).attr("stroke-width", 1), o && t.append("text").attr("x", i).attr("y", r - se).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("fill", "#ffffff").attr("font-size", oe).style("pointer-events", "none").text(o);
|
|
3101
|
+
break;
|
|
3102
|
+
case "squarepin":
|
|
3103
|
+
t.append("rect").attr("x", i - ct / 2).attr("y", r - ct - ct / 2).attr("width", ct).attr("height", ct).attr("fill", s).attr("stroke", s).attr("stroke-width", 1).attr("transform", `rotate(45,${i},${r - ct})`), o && t.append("text").attr("x", i).attr("y", r - ct).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("fill", "#ffffff").attr("font-size", oe).style("pointer-events", "none").text(o);
|
|
3104
|
+
break;
|
|
3105
|
+
case "flag":
|
|
3106
|
+
default:
|
|
3107
|
+
t.append("rect").attr("x", i).attr("y", r - Mt).attr("width", ln).attr("height", Mt).attr("fill", s).attr("stroke", s).attr("stroke-width", 1).attr("rx", 2), o && t.append("text").attr("x", i + ln / 2).attr("y", r - Mt / 2).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("fill", "#ffffff").attr("font-size", oe).style("pointer-events", "none").text(o);
|
|
3108
|
+
break;
|
|
3109
|
+
}
|
|
3110
|
+
}
|
|
3111
|
+
attachFlagEvents(t, n, i, r, s) {
|
|
3112
|
+
var c;
|
|
3113
|
+
if (this.config.enableMouseTracking === !1) return;
|
|
3114
|
+
const o = n.events || {}, a = ((c = this.config.point) == null ? void 0 : c.events) || {};
|
|
3115
|
+
t.on("mouseover", (l) => {
|
|
3116
|
+
var u, h;
|
|
3117
|
+
t.style("filter", "drop-shadow(0 2px 4px rgba(0,0,0,0.3))"), this.context.events.emit("point:mouseover", {
|
|
3118
|
+
point: n,
|
|
3119
|
+
index: i,
|
|
3120
|
+
series: this,
|
|
3121
|
+
event: l,
|
|
3122
|
+
plotX: r,
|
|
3123
|
+
plotY: s
|
|
3124
|
+
}), (u = o.mouseOver) == null || u.call(n, l), (h = a.mouseOver) == null || h.call(n, l);
|
|
3125
|
+
}).on("mouseout", (l) => {
|
|
3126
|
+
var u, h;
|
|
3127
|
+
t.style("filter", ""), this.context.events.emit("point:mouseout", {
|
|
3128
|
+
point: n,
|
|
3129
|
+
index: i,
|
|
3130
|
+
series: this,
|
|
3131
|
+
event: l
|
|
3132
|
+
}), (u = o.mouseOut) == null || u.call(n, l), (h = a.mouseOut) == null || h.call(n, l);
|
|
3133
|
+
}).on("click", (l) => {
|
|
3134
|
+
var u, h, f, p;
|
|
3135
|
+
this.context.events.emit("point:click", {
|
|
3136
|
+
point: n,
|
|
3137
|
+
index: i,
|
|
3138
|
+
series: this,
|
|
3139
|
+
event: l
|
|
3140
|
+
}), (u = o.click) == null || u.call(n, l), (h = a.click) == null || h.call(n, l), (p = (f = this.config.events) == null ? void 0 : f.click) == null || p.call(this, l);
|
|
3141
|
+
});
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
class Qo extends Z {
|
|
3145
|
+
constructor(t) {
|
|
3146
|
+
super(t), this.bricks = [];
|
|
3147
|
+
}
|
|
3148
|
+
/**
|
|
3149
|
+
* Convert raw close prices into Renko bricks. A new brick is created
|
|
3150
|
+
* each time the close price moves brickSize away from the last brick's edge.
|
|
3151
|
+
*/
|
|
3152
|
+
processData() {
|
|
3153
|
+
super.processData();
|
|
3154
|
+
const t = this.config.brickSize ?? 1, n = this.data.map((s) => s.close ?? s.y).filter((s) => s != null);
|
|
3155
|
+
if (this.bricks = [], n.length < 2) return;
|
|
3156
|
+
let i = Math.floor(n[0] / t) * t, r = 0;
|
|
3157
|
+
for (let s = 1; s < n.length; s++) {
|
|
3158
|
+
const a = n[s] - i, c = Math.floor(Math.abs(a) / t);
|
|
3159
|
+
if (c >= 1) {
|
|
3160
|
+
const l = a > 0 ? "up" : "down";
|
|
3161
|
+
for (let u = 0; u < c; u++) {
|
|
3162
|
+
const h = l === "up" ? i + u * t : i - (u + 1) * t;
|
|
3163
|
+
this.bricks.push({
|
|
3164
|
+
index: r++,
|
|
3165
|
+
direction: l,
|
|
3166
|
+
bottom: h,
|
|
3167
|
+
top: h + t
|
|
3168
|
+
});
|
|
3169
|
+
}
|
|
3170
|
+
i += (l === "up" ? 1 : -1) * c * t;
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
}
|
|
3174
|
+
render() {
|
|
3175
|
+
var h, f;
|
|
3176
|
+
const { xAxis: t, yAxis: n, plotArea: i } = this.context, r = this.context.animate, s = this.bricks;
|
|
3177
|
+
if (s.length === 0) return;
|
|
3178
|
+
const o = this.config.upColor || "#2f7ed8", a = this.config.downColor || this.config.color || "#f45b5b", c = ((f = (h = this.config.states) == null ? void 0 : h.inactive) == null ? void 0 : f.opacity) ?? 0.4, l = Math.max(1, i.width / Math.max(1, s.length) * 0.8), u = [];
|
|
3179
|
+
for (let p = 0; p < s.length; p++) {
|
|
3180
|
+
const d = s[p], y = t.getPixelForValue(d.index), m = n.getPixelForValue(d.top), g = n.getPixelForValue(d.bottom), x = Math.max(1, Math.abs(g - m)), _ = d.direction === "up" ? o : a, w = this.group.append("rect").attr("class", "katucharts-renko-brick").attr("x", y - l / 2).attr("y", Math.min(m, g)).attr("width", l).attr("height", x).attr("fill", _).attr("stroke", _).attr("stroke-width", 0.5).style("cursor", this.config.cursor || "pointer");
|
|
3181
|
+
u.push(w), r && w.attr("opacity", 0).transition().duration(V).ease(X).delay(lt(p, 0, Y, s.length)).attr("opacity", 1), this.config.enableMouseTracking !== !1 && w.on("mouseover", (v) => {
|
|
3182
|
+
w.style("filter", "drop-shadow(0 2px 4px rgba(0,0,0,0.25))"), u.forEach((b, k) => {
|
|
3183
|
+
k !== p && b.transition("highlight").duration(T).ease(I).attr("opacity", c);
|
|
3184
|
+
}), this.context.events.emit("point:mouseover", {
|
|
3185
|
+
point: { x: d.index, y: d.top, low: d.bottom, high: d.top, direction: d.direction },
|
|
3186
|
+
index: p,
|
|
3187
|
+
series: this,
|
|
3188
|
+
event: v,
|
|
3189
|
+
plotX: y,
|
|
3190
|
+
plotY: m
|
|
3191
|
+
});
|
|
3192
|
+
}).on("mouseout", (v) => {
|
|
3193
|
+
w.style("filter", ""), u.forEach((b) => b.interrupt("highlight")), u.forEach((b) => b.transition("highlight").duration(T).ease(I).attr("opacity", 1)), this.context.events.emit("point:mouseout", {
|
|
3194
|
+
point: { x: d.index, y: d.top },
|
|
3195
|
+
index: p,
|
|
3196
|
+
series: this,
|
|
3197
|
+
event: v
|
|
3198
|
+
});
|
|
3199
|
+
}).on("click", (v) => {
|
|
3200
|
+
var b, k;
|
|
3201
|
+
this.context.events.emit("point:click", {
|
|
3202
|
+
point: { x: d.index, y: d.top, direction: d.direction },
|
|
3203
|
+
index: p,
|
|
3204
|
+
series: this,
|
|
3205
|
+
event: v
|
|
3206
|
+
}), (k = (b = this.config.events) == null ? void 0 : b.click) == null || k.call(this, v);
|
|
3207
|
+
});
|
|
3208
|
+
}
|
|
3209
|
+
r && this.emitAfterAnimate(V + s.length * Y);
|
|
3210
|
+
}
|
|
3211
|
+
getDataExtents() {
|
|
3212
|
+
if (this.bricks.length === 0 && this.processData(), this.bricks.length === 0)
|
|
3213
|
+
return { xMin: 0, xMax: 0, yMin: 0, yMax: 0 };
|
|
3214
|
+
let t = 1 / 0, n = -1 / 0;
|
|
3215
|
+
for (const i of this.bricks)
|
|
3216
|
+
i.bottom < t && (t = i.bottom), i.top > n && (n = i.top);
|
|
3217
|
+
return {
|
|
3218
|
+
xMin: 0,
|
|
3219
|
+
xMax: this.bricks.length - 1,
|
|
3220
|
+
yMin: t,
|
|
3221
|
+
yMax: n
|
|
3222
|
+
};
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
class jo extends Z {
|
|
3226
|
+
constructor(t) {
|
|
3227
|
+
super(t), this.segments = [];
|
|
3228
|
+
}
|
|
3229
|
+
/**
|
|
3230
|
+
* Convert close prices into Kagi segments. Direction reverses when price
|
|
3231
|
+
* moves against current trend by reversalAmount. Lines thicken (yang) when
|
|
3232
|
+
* price exceeds a previous shoulder, thin (yin) when breaking a waist.
|
|
3233
|
+
*/
|
|
3234
|
+
processData() {
|
|
3235
|
+
super.processData();
|
|
3236
|
+
const t = this.data.map((f) => f.close ?? f.y).filter((f) => f != null);
|
|
3237
|
+
if (this.segments = [], t.length < 2) return;
|
|
3238
|
+
const n = Math.max(...t) - Math.min(...t), i = this.config.reversalAmount ?? n * 0.04;
|
|
3239
|
+
let r = t[1] >= t[0] ? "up" : "down", s = t[0], o = t[1], a = 0;
|
|
3240
|
+
const c = [], l = [];
|
|
3241
|
+
let u = "yin";
|
|
3242
|
+
const h = (f, p) => {
|
|
3243
|
+
if (r === "up") {
|
|
3244
|
+
const d = c.length > 0 ? c[c.length - 1] : -1 / 0;
|
|
3245
|
+
p > d && (u = "yang"), c.push(p);
|
|
3246
|
+
} else {
|
|
3247
|
+
const d = l.length > 0 ? l[l.length - 1] : 1 / 0;
|
|
3248
|
+
p < d && (u = "yin"), l.push(p);
|
|
3249
|
+
}
|
|
3250
|
+
this.segments.push({
|
|
3251
|
+
x: a++,
|
|
3252
|
+
startPrice: f,
|
|
3253
|
+
endPrice: p,
|
|
3254
|
+
type: u
|
|
3255
|
+
});
|
|
3256
|
+
};
|
|
3257
|
+
for (let f = 2; f < t.length; f++) {
|
|
3258
|
+
const p = t[f];
|
|
3259
|
+
r === "up" ? p > o ? o = p : o - p >= i && (h(s, o), s = o, o = p, r = "down") : p < o ? o = p : p - o >= i && (h(s, o), s = o, o = p, r = "up");
|
|
3260
|
+
}
|
|
3261
|
+
h(s, o);
|
|
3262
|
+
}
|
|
3263
|
+
render() {
|
|
3264
|
+
var f, p;
|
|
3265
|
+
const { xAxis: t, yAxis: n } = this.context, i = this.context.animate, r = this.segments;
|
|
3266
|
+
if (r.length === 0) return;
|
|
3267
|
+
const s = this.config.upColor || "#2f7ed8", o = this.config.downColor || this.config.color || "#f45b5b";
|
|
3268
|
+
for (let d = 0; d < r.length; d++) {
|
|
3269
|
+
const y = r[d];
|
|
3270
|
+
t.getPixelForValue(y.x), n.getPixelForValue(y.startPrice), n.getPixelForValue(y.endPrice);
|
|
3271
|
+
}
|
|
3272
|
+
const a = [];
|
|
3273
|
+
let c = "", l = r[0].type, u = null, h = null;
|
|
3274
|
+
for (let d = 0; d < r.length; d++) {
|
|
3275
|
+
const y = r[d], m = t.getPixelForValue(y.x), g = n.getPixelForValue(y.startPrice), x = n.getPixelForValue(y.endPrice);
|
|
3276
|
+
y.type !== l && c && (a.push({ d: c, type: l }), c = `M${u},${h}L${m},${h}`, l = y.type), c ? u !== null && (c += `L${m},${h}`) : c = `M${m},${g}`, c += `L${m},${x}`, u = m, h = x;
|
|
3277
|
+
}
|
|
3278
|
+
c && a.push({ d: c, type: l });
|
|
3279
|
+
for (const d of a) {
|
|
3280
|
+
const y = d.type === "yang" ? s : o, m = d.type === "yang" ? 3 : 1, g = this.group.append("path").attr("class", `katucharts-kagi-${d.type}`).attr("d", d.d).attr("fill", "none").attr("stroke", y).attr("stroke-width", m).attr("stroke-linejoin", "miter");
|
|
3281
|
+
if (i) {
|
|
3282
|
+
const x = ((p = (f = g.node()).getTotalLength) == null ? void 0 : p.call(f)) || 0;
|
|
3283
|
+
x > 0 && g.attr("stroke-dasharray", `${x} ${x}`).attr("stroke-dashoffset", x).transition().duration(V).ease(X).attr("stroke-dashoffset", 0).on("end", () => {
|
|
3284
|
+
g.attr("stroke-dasharray", null);
|
|
3285
|
+
});
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
if (this.config.enableMouseTracking !== !1)
|
|
3289
|
+
for (let d = 0; d < r.length; d++) {
|
|
3290
|
+
const y = r[d], m = t.getPixelForValue(y.x), g = n.getPixelForValue(y.startPrice), x = n.getPixelForValue(y.endPrice), _ = Math.abs(x - g);
|
|
3291
|
+
this.group.append("rect").attr("class", "katucharts-kagi-hitarea").attr("x", m - 8).attr("y", Math.min(g, x)).attr("width", 16).attr("height", Math.max(_, 4)).attr("fill", "transparent").style("cursor", this.config.cursor || "pointer").on("mouseover", (w) => {
|
|
3292
|
+
const v = `katucharts-kagi-${y.type}`, b = y.type === "yang" ? 3 : 1;
|
|
3293
|
+
this.group.selectAll(`path.${v}`).interrupt("hover").transition("hover").duration(T).ease(I).attr("stroke-width", b + 1.5);
|
|
3294
|
+
const k = y.type === "yang" ? "katucharts-kagi-yin" : "katucharts-kagi-yang";
|
|
3295
|
+
this.group.selectAll(`path.${k}`).interrupt("hover").transition("hover").duration(ge).ease(I).attr("opacity", 0.3), this.context.events.emit("point:mouseover", {
|
|
3296
|
+
point: { x: y.x, y: y.endPrice, open: y.startPrice, close: y.endPrice, type: y.type },
|
|
3297
|
+
index: d,
|
|
3298
|
+
series: this,
|
|
3299
|
+
event: w,
|
|
3300
|
+
plotX: m,
|
|
3301
|
+
plotY: x
|
|
3302
|
+
});
|
|
3303
|
+
}).on("mouseout", (w) => {
|
|
3304
|
+
this.group.selectAll("path.katucharts-kagi-yang").interrupt("hover").transition("hover").duration(T).ease(I).attr("stroke-width", 3).attr("opacity", 1), this.group.selectAll("path.katucharts-kagi-yin").interrupt("hover").transition("hover").duration(T).ease(I).attr("stroke-width", 1).attr("opacity", 1), this.context.events.emit("point:mouseout", {
|
|
3305
|
+
point: { x: y.x, y: y.endPrice },
|
|
3306
|
+
index: d,
|
|
3307
|
+
series: this,
|
|
3308
|
+
event: w
|
|
3309
|
+
});
|
|
3310
|
+
}).on("click", (w) => {
|
|
3311
|
+
var v, b;
|
|
3312
|
+
this.context.events.emit("point:click", {
|
|
3313
|
+
point: { x: y.x, y: y.endPrice, type: y.type },
|
|
3314
|
+
index: d,
|
|
3315
|
+
series: this,
|
|
3316
|
+
event: w
|
|
3317
|
+
}), (b = (v = this.config.events) == null ? void 0 : v.click) == null || b.call(this, w);
|
|
3318
|
+
});
|
|
3319
|
+
}
|
|
3320
|
+
i && this.emitAfterAnimate(V);
|
|
3321
|
+
}
|
|
3322
|
+
getDataExtents() {
|
|
3323
|
+
if (this.segments.length === 0 && this.processData(), this.segments.length === 0)
|
|
3324
|
+
return { xMin: 0, xMax: 0, yMin: 0, yMax: 0 };
|
|
3325
|
+
let t = 1 / 0, n = -1 / 0;
|
|
3326
|
+
for (const i of this.segments) {
|
|
3327
|
+
const r = Math.min(i.startPrice, i.endPrice), s = Math.max(i.startPrice, i.endPrice);
|
|
3328
|
+
r < t && (t = r), s > n && (n = s);
|
|
3329
|
+
}
|
|
3330
|
+
return {
|
|
3331
|
+
xMin: 0,
|
|
3332
|
+
xMax: this.segments.length - 1,
|
|
3333
|
+
yMin: t,
|
|
3334
|
+
yMax: n
|
|
3335
|
+
};
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
class ta extends Z {
|
|
3339
|
+
constructor(t) {
|
|
3340
|
+
super(t), this.columns = [];
|
|
3341
|
+
}
|
|
3342
|
+
/**
|
|
3343
|
+
* Convert close prices into Point & Figure columns. Each column contains
|
|
3344
|
+
* boxes quantized to boxSize. A new column starts when price reverses
|
|
3345
|
+
* by at least reversalAmount boxes.
|
|
3346
|
+
*/
|
|
3347
|
+
processData() {
|
|
3348
|
+
super.processData();
|
|
3349
|
+
const t = this.config.boxSize ?? 1, i = (this.config.reversalAmount ?? 3) * t, r = this.data.map((f) => f.close ?? f.y).filter((f) => f != null);
|
|
3350
|
+
if (this.columns = [], r.length < 2) return;
|
|
3351
|
+
const s = (f) => Math.floor(f / t) * t;
|
|
3352
|
+
let o = r[1] >= r[0] ? "X" : "O", a = s(r[0]) + t, c = s(r[0]), l = 0;
|
|
3353
|
+
const u = (f, p) => {
|
|
3354
|
+
const d = [];
|
|
3355
|
+
for (let y = f; y < p; y += t)
|
|
3356
|
+
d.push(y);
|
|
3357
|
+
return d;
|
|
3358
|
+
}, h = () => {
|
|
3359
|
+
this.columns.push({
|
|
3360
|
+
index: l++,
|
|
3361
|
+
direction: o,
|
|
3362
|
+
startPrice: o === "X" ? c : a,
|
|
3363
|
+
endPrice: o === "X" ? a : c,
|
|
3364
|
+
boxes: u(c, a)
|
|
3365
|
+
});
|
|
3366
|
+
};
|
|
3367
|
+
for (let f = 1; f < r.length; f++) {
|
|
3368
|
+
const p = r[f], d = s(p);
|
|
3369
|
+
o === "X" ? d + t > a ? a = d + t : a - d >= i && (h(), o = "O", a = a - t, c = d) : d < c ? c = d : d - c >= i && (h(), o = "X", c = c + t, a = d + t);
|
|
3370
|
+
}
|
|
3371
|
+
h();
|
|
3372
|
+
}
|
|
3373
|
+
render() {
|
|
3374
|
+
var p, d;
|
|
3375
|
+
const { xAxis: t, yAxis: n, plotArea: i } = this.context, r = this.context.animate, s = this.columns;
|
|
3376
|
+
if (s.length === 0) return;
|
|
3377
|
+
const o = this.config.boxSize ?? 1, a = this.config.upColor || "#2f7ed8", c = this.config.downColor || this.config.color || "#f45b5b", l = ((d = (p = this.config.states) == null ? void 0 : p.inactive) == null ? void 0 : d.opacity) ?? 0.4, u = Math.max(8, Math.min(16, i.width / Math.max(1, s.length) * 0.6)), h = [];
|
|
3378
|
+
let f = 0;
|
|
3379
|
+
for (let y = 0; y < s.length; y++) {
|
|
3380
|
+
const m = s[y], g = m.direction === "X" ? a : c, x = m.direction === "X" ? "X" : "O", _ = this.group.append("g").attr("class", `katucharts-pnf-column katucharts-pnf-${m.direction}`).style("cursor", this.config.cursor || "pointer");
|
|
3381
|
+
h.push(_);
|
|
3382
|
+
for (const w of m.boxes) {
|
|
3383
|
+
const v = t.getPixelForValue(m.index), b = n.getPixelForValue(w + o / 2), k = _.append("text").attr("x", v).attr("y", b).attr("text-anchor", "middle").attr("dominant-baseline", "central").attr("font-size", `${u}px`).attr("font-weight", "bold").attr("fill", g).style("pointer-events", "none").text(x);
|
|
3384
|
+
r && (k.attr("opacity", 0).transition().duration(V).ease(X).delay(lt(f, 0, Y, this.getTotalBoxCount())).attr("opacity", 1), f++);
|
|
3385
|
+
}
|
|
3386
|
+
if (this.config.enableMouseTracking !== !1) {
|
|
3387
|
+
const w = t.getPixelForValue(m.index), v = n.getPixelForValue(Math.max(m.startPrice, m.endPrice)), b = n.getPixelForValue(Math.min(m.startPrice, m.endPrice)), k = Math.max(u * 1.5, 20), E = Math.max(Math.abs(b - v), 4);
|
|
3388
|
+
_.append("rect").attr("x", w - k / 2).attr("y", Math.min(v, b)).attr("width", k).attr("height", E).attr("fill", "transparent").style("cursor", this.config.cursor || "pointer").on("mouseover", (C) => {
|
|
3389
|
+
_.selectAll("text").interrupt("hover").transition("hover").duration(T).ease(I).attr("font-size", `${u * 1.2}px`), h.forEach((P, R) => {
|
|
3390
|
+
R !== y && P.transition("highlight").duration(T).ease(I).attr("opacity", l);
|
|
3391
|
+
}), this.context.events.emit("point:mouseover", {
|
|
3392
|
+
point: {
|
|
3393
|
+
x: m.index,
|
|
3394
|
+
y: m.endPrice,
|
|
3395
|
+
direction: m.direction,
|
|
3396
|
+
startPrice: m.startPrice,
|
|
3397
|
+
endPrice: m.endPrice,
|
|
3398
|
+
boxCount: m.boxes.length
|
|
3399
|
+
},
|
|
3400
|
+
index: y,
|
|
3401
|
+
series: this,
|
|
3402
|
+
event: C,
|
|
3403
|
+
plotX: w,
|
|
3404
|
+
plotY: v
|
|
3405
|
+
});
|
|
3406
|
+
}).on("mouseout", (C) => {
|
|
3407
|
+
_.selectAll("text").interrupt("hover").transition("hover").duration(T).ease(I).attr("font-size", `${u}px`), h.forEach((P) => P.interrupt("highlight")), h.forEach((P) => P.transition("highlight").duration(T).ease(I).attr("opacity", 1)), this.context.events.emit("point:mouseout", {
|
|
3408
|
+
point: { x: m.index, y: m.endPrice },
|
|
3409
|
+
index: y,
|
|
3410
|
+
series: this,
|
|
3411
|
+
event: C
|
|
3412
|
+
});
|
|
3413
|
+
}).on("click", (C) => {
|
|
3414
|
+
var P, R;
|
|
3415
|
+
this.context.events.emit("point:click", {
|
|
3416
|
+
point: { x: m.index, y: m.endPrice, direction: m.direction },
|
|
3417
|
+
index: y,
|
|
3418
|
+
series: this,
|
|
3419
|
+
event: C
|
|
3420
|
+
}), (R = (P = this.config.events) == null ? void 0 : P.click) == null || R.call(this, C);
|
|
3421
|
+
});
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
if (r) {
|
|
3425
|
+
const y = this.getTotalBoxCount();
|
|
3426
|
+
this.emitAfterAnimate(V + y * Y);
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
getTotalBoxCount() {
|
|
3430
|
+
return this.columns.reduce((t, n) => t + n.boxes.length, 0);
|
|
3431
|
+
}
|
|
3432
|
+
getDataExtents() {
|
|
3433
|
+
if (this.columns.length === 0 && this.processData(), this.columns.length === 0)
|
|
3434
|
+
return { xMin: 0, xMax: 0, yMin: 0, yMax: 0 };
|
|
3435
|
+
const t = this.config.boxSize ?? 1;
|
|
3436
|
+
let n = 1 / 0, i = -1 / 0;
|
|
3437
|
+
for (const r of this.columns)
|
|
3438
|
+
for (const s of r.boxes)
|
|
3439
|
+
s < n && (n = s), s + t > i && (i = s + t);
|
|
3440
|
+
return {
|
|
3441
|
+
xMin: 0,
|
|
3442
|
+
xMax: this.columns.length - 1,
|
|
3443
|
+
yMin: n,
|
|
3444
|
+
yMax: i
|
|
3445
|
+
};
|
|
3446
|
+
}
|
|
3447
|
+
}
|
|
3448
|
+
class ea extends Z {
|
|
3449
|
+
constructor(t) {
|
|
3450
|
+
super(t), this.blocks = [];
|
|
3451
|
+
}
|
|
3452
|
+
/**
|
|
3453
|
+
* Implement N-line break logic: a new block is drawn only when the close
|
|
3454
|
+
* exceeds the high of the last N up-blocks or breaks the low of the last
|
|
3455
|
+
* N down-blocks. Otherwise the price point is ignored.
|
|
3456
|
+
*/
|
|
3457
|
+
processData() {
|
|
3458
|
+
super.processData();
|
|
3459
|
+
const t = this.config.lineBreakCount ?? 3, n = this.data.map((r) => r.close ?? r.y).filter((r) => r != null);
|
|
3460
|
+
if (this.blocks = [], n.length < 2) return;
|
|
3461
|
+
const i = {
|
|
3462
|
+
index: 0,
|
|
3463
|
+
open: n[0],
|
|
3464
|
+
close: n[1],
|
|
3465
|
+
direction: n[1] >= n[0] ? "up" : "down"
|
|
3466
|
+
};
|
|
3467
|
+
this.blocks.push(i);
|
|
3468
|
+
for (let r = 2; r < n.length; r++) {
|
|
3469
|
+
const s = n[r], o = this.blocks.slice(-t), a = this.blocks[this.blocks.length - 1];
|
|
3470
|
+
let c = -1 / 0, l = 1 / 0;
|
|
3471
|
+
for (const u of o) {
|
|
3472
|
+
const h = Math.max(u.open, u.close), f = Math.min(u.open, u.close);
|
|
3473
|
+
h > c && (c = h), f < l && (l = f);
|
|
3474
|
+
}
|
|
3475
|
+
s > c ? this.blocks.push({
|
|
3476
|
+
index: this.blocks.length,
|
|
3477
|
+
open: a.close,
|
|
3478
|
+
close: s,
|
|
3479
|
+
direction: "up"
|
|
3480
|
+
}) : s < l && this.blocks.push({
|
|
3481
|
+
index: this.blocks.length,
|
|
3482
|
+
open: a.close,
|
|
3483
|
+
close: s,
|
|
3484
|
+
direction: "down"
|
|
3485
|
+
});
|
|
3486
|
+
}
|
|
3487
|
+
}
|
|
3488
|
+
render() {
|
|
3489
|
+
var h, f;
|
|
3490
|
+
const { xAxis: t, yAxis: n, plotArea: i } = this.context, r = this.context.animate, s = this.blocks;
|
|
3491
|
+
if (s.length === 0) return;
|
|
3492
|
+
const o = this.config.upColor || "#2f7ed8", a = this.config.downColor || this.config.color || "#f45b5b", c = ((f = (h = this.config.states) == null ? void 0 : h.inactive) == null ? void 0 : f.opacity) ?? 0.4, l = Math.max(1, i.width / Math.max(1, s.length) * 0.8), u = [];
|
|
3493
|
+
for (let p = 0; p < s.length; p++) {
|
|
3494
|
+
const d = s[p], y = t.getPixelForValue(d.index), m = n.getPixelForValue(d.open), g = n.getPixelForValue(d.close), x = Math.min(m, g), _ = Math.max(1, Math.abs(m - g)), w = d.direction === "up" ? o : a, v = x + _ / 2, b = this.group.append("rect").attr("class", "katucharts-linebreak-block").attr("x", y - l / 2).attr("width", l).attr("fill", w).attr("stroke", w).attr("stroke-width", 0.5).style("cursor", this.config.cursor || "pointer");
|
|
3495
|
+
u.push(b), r ? b.attr("y", v).attr("height", 0).transition().duration(V).ease(X).delay(lt(p, 0, Y, s.length)).attr("y", x).attr("height", _) : b.attr("y", x).attr("height", _), this.config.enableMouseTracking !== !1 && b.on("mouseover", (k) => {
|
|
3496
|
+
b.style("filter", "drop-shadow(0 2px 4px rgba(0,0,0,0.25))"), u.forEach((E, C) => {
|
|
3497
|
+
C !== p && E.transition("highlight").duration(T).ease(I).attr("opacity", c);
|
|
3498
|
+
}), this.context.events.emit("point:mouseover", {
|
|
3499
|
+
point: { x: d.index, y: d.close, open: d.open, close: d.close, direction: d.direction },
|
|
3500
|
+
index: p,
|
|
3501
|
+
series: this,
|
|
3502
|
+
event: k,
|
|
3503
|
+
plotX: y,
|
|
3504
|
+
plotY: g
|
|
3505
|
+
});
|
|
3506
|
+
}).on("mouseout", (k) => {
|
|
3507
|
+
b.style("filter", ""), u.forEach((E) => E.interrupt("highlight")), u.forEach((E) => E.transition("highlight").duration(T).ease(I).attr("opacity", 1)), this.context.events.emit("point:mouseout", {
|
|
3508
|
+
point: { x: d.index, y: d.close },
|
|
3509
|
+
index: p,
|
|
3510
|
+
series: this,
|
|
3511
|
+
event: k
|
|
3512
|
+
});
|
|
3513
|
+
}).on("click", (k) => {
|
|
3514
|
+
var E, C;
|
|
3515
|
+
this.context.events.emit("point:click", {
|
|
3516
|
+
point: { x: d.index, y: d.close, direction: d.direction },
|
|
3517
|
+
index: p,
|
|
3518
|
+
series: this,
|
|
3519
|
+
event: k
|
|
3520
|
+
}), (C = (E = this.config.events) == null ? void 0 : E.click) == null || C.call(this, k);
|
|
3521
|
+
});
|
|
3522
|
+
}
|
|
3523
|
+
r && this.emitAfterAnimate(V + s.length * Y);
|
|
3524
|
+
}
|
|
3525
|
+
getDataExtents() {
|
|
3526
|
+
if (this.blocks.length === 0 && this.processData(), this.blocks.length === 0)
|
|
3527
|
+
return { xMin: 0, xMax: 0, yMin: 0, yMax: 0 };
|
|
3528
|
+
let t = 1 / 0, n = -1 / 0;
|
|
3529
|
+
for (const i of this.blocks) {
|
|
3530
|
+
const r = Math.min(i.open, i.close), s = Math.max(i.open, i.close);
|
|
3531
|
+
r < t && (t = r), s > n && (n = s);
|
|
3532
|
+
}
|
|
3533
|
+
return {
|
|
3534
|
+
xMin: 0,
|
|
3535
|
+
xMax: this.blocks.length - 1,
|
|
3536
|
+
yMin: t,
|
|
3537
|
+
yMax: n
|
|
3538
|
+
};
|
|
3539
|
+
}
|
|
3540
|
+
}
|
|
3541
|
+
function na() {
|
|
3542
|
+
G.registerType("heikinashi", Oo), G.registerType("hollowcandlestick", zo), G.registerType("volume", Ho), G.registerType("arearange", Jn), G.registerType("areasplinerange", qo), G.registerType("columnrange", Go), G.registerType("vbp", Ko), G.registerType("baseline", Zo), G.registerType("flags", Jo), G.registerType("renko", Qo), G.registerType("kagi", jo), G.registerType("pointandfigure", ta), G.registerType("linebreak", ea);
|
|
3543
|
+
}
|
|
3544
|
+
class z {
|
|
3545
|
+
}
|
|
3546
|
+
class ia {
|
|
3547
|
+
constructor() {
|
|
3548
|
+
this.indicators = /* @__PURE__ */ new Map();
|
|
3549
|
+
}
|
|
3550
|
+
register(t) {
|
|
3551
|
+
this.indicators.set(t.name.toLowerCase(), t);
|
|
3552
|
+
}
|
|
3553
|
+
get(t) {
|
|
3554
|
+
return this.indicators.get(t.toLowerCase());
|
|
3555
|
+
}
|
|
3556
|
+
getAll() {
|
|
3557
|
+
return new Map(this.indicators);
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
const cn = globalThis, H = cn.__katuIndicatorRegistry || (cn.__katuIndicatorRegistry = new ia());
|
|
3561
|
+
class ra extends z {
|
|
3562
|
+
constructor() {
|
|
3563
|
+
super(...arguments), this.name = "sma";
|
|
3564
|
+
}
|
|
3565
|
+
/**
|
|
3566
|
+
* Calculates the Simple Moving Average over closing prices.
|
|
3567
|
+
* SMA = sum of last `period` closes / period.
|
|
3568
|
+
* Points with insufficient history produce y: null.
|
|
3569
|
+
*/
|
|
3570
|
+
calculate(t, n) {
|
|
3571
|
+
const i = n.period ?? 14, r = new Array(t.length);
|
|
3572
|
+
let s = 0;
|
|
3573
|
+
for (let o = 0; o < t.length; o++)
|
|
3574
|
+
s += t[o].close, o >= i && (s -= t[o - i].close), o < i - 1 ? r[o] = { x: t[o].x, y: null } : r[o] = { x: t[o].x, y: s / i };
|
|
3575
|
+
return { values: r };
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
const sa = new ra();
|
|
3579
|
+
H.register(sa);
|
|
3580
|
+
class oa extends z {
|
|
3581
|
+
constructor() {
|
|
3582
|
+
super(...arguments), this.name = "ema";
|
|
3583
|
+
}
|
|
3584
|
+
/**
|
|
3585
|
+
* Calculates the Exponential Moving Average over closing prices.
|
|
3586
|
+
* Uses multiplier k = 2 / (period + 1). The first EMA value is
|
|
3587
|
+
* seeded with the SMA of the first `period` points.
|
|
3588
|
+
* Points with insufficient history produce y: null.
|
|
3589
|
+
*/
|
|
3590
|
+
calculate(t, n) {
|
|
3591
|
+
const i = n.period ?? 14, r = 2 / (i + 1), s = new Array(t.length);
|
|
3592
|
+
let o = 0, a = 0;
|
|
3593
|
+
for (let c = 0; c < t.length; c++)
|
|
3594
|
+
c < i - 1 ? (a += t[c].close, s[c] = { x: t[c].x, y: null }) : c === i - 1 ? (a += t[c].close, o = a / i, s[c] = { x: t[c].x, y: o }) : (o = t[c].close * r + o * (1 - r), s[c] = { x: t[c].x, y: o });
|
|
3595
|
+
return { values: s };
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3598
|
+
const aa = new oa();
|
|
3599
|
+
H.register(aa);
|
|
3600
|
+
class la extends z {
|
|
3601
|
+
constructor() {
|
|
3602
|
+
super(...arguments), this.name = "wma";
|
|
3603
|
+
}
|
|
3604
|
+
/**
|
|
3605
|
+
* Calculates the Weighted Moving Average over closing prices.
|
|
3606
|
+
* Uses linear weighting where the most recent price in the window
|
|
3607
|
+
* receives the highest weight: weight_i = i + 1.
|
|
3608
|
+
* Points with insufficient history produce y: null.
|
|
3609
|
+
*/
|
|
3610
|
+
calculate(t, n) {
|
|
3611
|
+
const i = n.period ?? 14, r = i * (i + 1) / 2, s = new Array(t.length);
|
|
3612
|
+
for (let o = 0; o < t.length; o++) {
|
|
3613
|
+
if (o < i - 1) {
|
|
3614
|
+
s[o] = { x: t[o].x, y: null };
|
|
3615
|
+
continue;
|
|
3616
|
+
}
|
|
3617
|
+
let a = 0;
|
|
3618
|
+
for (let c = 0; c < i; c++)
|
|
3619
|
+
a += t[o - i + 1 + c].close * (c + 1);
|
|
3620
|
+
s[o] = { x: t[o].x, y: a / r };
|
|
3621
|
+
}
|
|
3622
|
+
return { values: s };
|
|
3623
|
+
}
|
|
3624
|
+
}
|
|
3625
|
+
const ca = new la();
|
|
3626
|
+
H.register(ca);
|
|
3627
|
+
function Ct(e, t) {
|
|
3628
|
+
const n = 2 / (t + 1), i = new Array(e.length).fill(null);
|
|
3629
|
+
let r = null, s = 0, o = 0;
|
|
3630
|
+
for (let a = 0; a < e.length; a++) {
|
|
3631
|
+
const c = e[a];
|
|
3632
|
+
c != null && (r === null ? (s += c, o++, o === t && (r = s / t, i[a] = r)) : (r = c * n + r * (1 - n), i[a] = r));
|
|
3633
|
+
}
|
|
3634
|
+
return i;
|
|
3635
|
+
}
|
|
3636
|
+
class ha extends z {
|
|
3637
|
+
constructor() {
|
|
3638
|
+
super(...arguments), this.name = "dema";
|
|
3639
|
+
}
|
|
3640
|
+
/**
|
|
3641
|
+
* Double Exponential Moving Average: 2*EMA - EMA(EMA). Reduces the lag of a
|
|
3642
|
+
* single EMA while keeping smoothing.
|
|
3643
|
+
*/
|
|
3644
|
+
calculate(t, n) {
|
|
3645
|
+
const i = n.period ?? 14, r = t.map((c) => c.close), s = Ct(r, i), o = Ct(s, i);
|
|
3646
|
+
return { values: t.map((c, l) => {
|
|
3647
|
+
const u = s[l], h = o[l];
|
|
3648
|
+
return { x: c.x, y: u !== null && h !== null ? 2 * u - h : null };
|
|
3649
|
+
}) };
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
const ua = new ha();
|
|
3653
|
+
H.register(ua);
|
|
3654
|
+
class fa extends z {
|
|
3655
|
+
constructor() {
|
|
3656
|
+
super(...arguments), this.name = "tema";
|
|
3657
|
+
}
|
|
3658
|
+
/**
|
|
3659
|
+
* Triple Exponential Moving Average: 3*EMA - 3*EMA(EMA) + EMA(EMA(EMA)).
|
|
3660
|
+
* Lower lag than DEMA for the same period.
|
|
3661
|
+
*/
|
|
3662
|
+
calculate(t, n) {
|
|
3663
|
+
const i = n.period ?? 14, r = t.map((l) => l.close), s = Ct(r, i), o = Ct(s, i), a = Ct(o, i);
|
|
3664
|
+
return { values: t.map((l, u) => {
|
|
3665
|
+
const h = s[u], f = o[u], p = a[u];
|
|
3666
|
+
return { x: l.x, y: h !== null && f !== null && p !== null ? 3 * h - 3 * f + p : null };
|
|
3667
|
+
}) };
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
const da = new fa();
|
|
3671
|
+
H.register(da);
|
|
3672
|
+
class pa extends z {
|
|
3673
|
+
constructor() {
|
|
3674
|
+
super(...arguments), this.name = "rsi";
|
|
3675
|
+
}
|
|
3676
|
+
/**
|
|
3677
|
+
* Calculates the Relative Strength Index using Wilder's smoothing method.
|
|
3678
|
+
* RSI oscillates between 0 and 100; values above 70 suggest overbought,
|
|
3679
|
+
* below 30 suggest oversold conditions.
|
|
3680
|
+
*/
|
|
3681
|
+
calculate(t, n) {
|
|
3682
|
+
const i = n.period ?? 14, r = new Array(t.length);
|
|
3683
|
+
for (let c = 0; c < i; c++)
|
|
3684
|
+
r[c] = { x: t[c].x, y: null };
|
|
3685
|
+
let s = 0, o = 0;
|
|
3686
|
+
for (let c = 1; c <= i; c++) {
|
|
3687
|
+
const l = t[c].close - t[c - 1].close;
|
|
3688
|
+
s += Math.max(0, l), o += Math.max(0, -l);
|
|
3689
|
+
}
|
|
3690
|
+
s /= i, o /= i;
|
|
3691
|
+
const a = o === 0 ? 1 / 0 : s / o;
|
|
3692
|
+
r[i] = {
|
|
3693
|
+
x: t[i].x,
|
|
3694
|
+
y: o === 0 ? 100 : 100 - 100 / (1 + a)
|
|
3695
|
+
};
|
|
3696
|
+
for (let c = i + 1; c < t.length; c++) {
|
|
3697
|
+
const l = t[c].close - t[c - 1].close, u = Math.max(0, l), h = Math.max(0, -l);
|
|
3698
|
+
s = (s * (i - 1) + u) / i, o = (o * (i - 1) + h) / i;
|
|
3699
|
+
const f = o === 0 ? 100 : 100 - 100 / (1 + s / o);
|
|
3700
|
+
r[c] = { x: t[c].x, y: f };
|
|
3701
|
+
}
|
|
3702
|
+
return { values: r };
|
|
3703
|
+
}
|
|
3704
|
+
}
|
|
3705
|
+
const ga = new pa();
|
|
3706
|
+
H.register(ga);
|
|
3707
|
+
class xa extends z {
|
|
3708
|
+
constructor() {
|
|
3709
|
+
super(...arguments), this.name = "stochastic";
|
|
3710
|
+
}
|
|
3711
|
+
/**
|
|
3712
|
+
* Calculates the Stochastic Oscillator (%K and %D lines).
|
|
3713
|
+
* %K measures momentum by comparing the close to the high-low range
|
|
3714
|
+
* over kPeriod, smoothed by smoothK. %D is the SMA signal of %K.
|
|
3715
|
+
*/
|
|
3716
|
+
calculate(t, n) {
|
|
3717
|
+
const i = n.kPeriod ?? 14, r = n.dPeriod ?? 3, s = n.smoothK ?? 3, o = this.computeRawK(t, i), a = this.sma(o, s), c = this.sma(a, r), l = new Array(t.length), u = new Array(t.length);
|
|
3718
|
+
for (let h = 0; h < t.length; h++)
|
|
3719
|
+
l[h] = { x: t[h].x, y: a[h] }, u[h] = { x: t[h].x, y: c[h] };
|
|
3720
|
+
return { values: l, signal: u };
|
|
3721
|
+
}
|
|
3722
|
+
/**
|
|
3723
|
+
* Computes raw %K values: 100 * (close - lowestLow) / (highestHigh - lowestLow).
|
|
3724
|
+
*/
|
|
3725
|
+
computeRawK(t, n) {
|
|
3726
|
+
const i = new Array(t.length);
|
|
3727
|
+
for (let r = 0; r < t.length; r++) {
|
|
3728
|
+
if (r < n - 1) {
|
|
3729
|
+
i[r] = null;
|
|
3730
|
+
continue;
|
|
3731
|
+
}
|
|
3732
|
+
let s = 1 / 0, o = -1 / 0;
|
|
3733
|
+
for (let c = r - n + 1; c <= r; c++)
|
|
3734
|
+
t[c].low < s && (s = t[c].low), t[c].high > o && (o = t[c].high);
|
|
3735
|
+
const a = o - s;
|
|
3736
|
+
i[r] = a === 0 ? 50 : 100 * (t[r].close - s) / a;
|
|
3737
|
+
}
|
|
3738
|
+
return i;
|
|
3739
|
+
}
|
|
3740
|
+
/**
|
|
3741
|
+
* Computes a Simple Moving Average over a nullable numeric array,
|
|
3742
|
+
* returning null for positions with insufficient non-null predecessors.
|
|
3743
|
+
*/
|
|
3744
|
+
sma(t, n) {
|
|
3745
|
+
const i = new Array(t.length).fill(null), r = [];
|
|
3746
|
+
for (let s = 0; s < t.length; s++)
|
|
3747
|
+
if (t[s] !== null && r.push(s), r.length >= n) {
|
|
3748
|
+
let o = 0;
|
|
3749
|
+
for (let a = r.length - n; a < r.length; a++)
|
|
3750
|
+
o += t[r[a]];
|
|
3751
|
+
i[s] = o / n;
|
|
3752
|
+
}
|
|
3753
|
+
return i;
|
|
3754
|
+
}
|
|
3755
|
+
}
|
|
3756
|
+
const ya = new xa();
|
|
3757
|
+
H.register(ya);
|
|
3758
|
+
class ma extends z {
|
|
3759
|
+
constructor() {
|
|
3760
|
+
super(...arguments), this.name = "macd";
|
|
3761
|
+
}
|
|
3762
|
+
/**
|
|
3763
|
+
* Calculates MACD (Moving Average Convergence Divergence).
|
|
3764
|
+
* Returns the MACD line (fast EMA - slow EMA), a signal line
|
|
3765
|
+
* (EMA of MACD), and a histogram (MACD - signal).
|
|
3766
|
+
*/
|
|
3767
|
+
calculate(t, n) {
|
|
3768
|
+
const i = n.fastPeriod ?? 12, r = n.slowPeriod ?? 26, s = n.signalPeriod ?? 9, o = t.map((m) => m.close), a = this.ema(o, i), c = this.ema(o, r), l = new Array(t.length);
|
|
3769
|
+
for (let m = 0; m < t.length; m++)
|
|
3770
|
+
a[m] === null || c[m] === null ? l[m] = null : l[m] = a[m] - c[m];
|
|
3771
|
+
const u = this.extractNonNull(l), h = this.ema(u.values, s), f = new Array(t.length), p = new Array(t.length), d = new Array(t.length);
|
|
3772
|
+
let y = 0;
|
|
3773
|
+
for (let m = 0; m < t.length; m++) {
|
|
3774
|
+
const g = t[m].x;
|
|
3775
|
+
if (l[m] === null)
|
|
3776
|
+
f[m] = { x: g, y: null }, p[m] = { x: g, y: null }, d[m] = { x: g, y: null };
|
|
3777
|
+
else {
|
|
3778
|
+
const x = l[m], _ = h[y];
|
|
3779
|
+
f[m] = { x: g, y: x }, p[m] = { x: g, y: _ }, d[m] = { x: g, y: _ === null ? null : x - _ }, y++;
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
return { values: f, signal: p, histogram: d };
|
|
3783
|
+
}
|
|
3784
|
+
/**
|
|
3785
|
+
* Calculates Exponential Moving Average.
|
|
3786
|
+
* Uses SMA for the seed value, then applies the recursive EMA formula.
|
|
3787
|
+
*/
|
|
3788
|
+
ema(t, n) {
|
|
3789
|
+
const i = new Array(t.length).fill(null);
|
|
3790
|
+
if (t.length < n) return i;
|
|
3791
|
+
let r = 0;
|
|
3792
|
+
for (let o = 0; o < n; o++)
|
|
3793
|
+
r += t[o];
|
|
3794
|
+
const s = 2 / (n + 1);
|
|
3795
|
+
i[n - 1] = r / n;
|
|
3796
|
+
for (let o = n; o < t.length; o++)
|
|
3797
|
+
i[o] = t[o] * s + i[o - 1] * (1 - s);
|
|
3798
|
+
return i;
|
|
3799
|
+
}
|
|
3800
|
+
/**
|
|
3801
|
+
* Extracts non-null values and their original indices from a sparse array.
|
|
3802
|
+
*/
|
|
3803
|
+
extractNonNull(t) {
|
|
3804
|
+
const n = [], i = [];
|
|
3805
|
+
for (let r = 0; r < t.length; r++)
|
|
3806
|
+
t[r] !== null && (n.push(t[r]), i.push(r));
|
|
3807
|
+
return { values: n, indices: i };
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3810
|
+
const _a = new ma();
|
|
3811
|
+
H.register(_a);
|
|
3812
|
+
class wa extends z {
|
|
3813
|
+
constructor() {
|
|
3814
|
+
super(...arguments), this.name = "cci";
|
|
3815
|
+
}
|
|
3816
|
+
/**
|
|
3817
|
+
* Commodity Channel Index. Measures deviation of the typical price
|
|
3818
|
+
* ((high+low+close)/3) from its SMA, scaled by mean absolute deviation:
|
|
3819
|
+
* CCI = (TP - SMA(TP)) / (0.015 * meanDeviation).
|
|
3820
|
+
*/
|
|
3821
|
+
calculate(t, n) {
|
|
3822
|
+
const i = n.period ?? 20, r = t.map((o) => (o.high + o.low + o.close) / 3), s = new Array(t.length);
|
|
3823
|
+
for (let o = 0; o < t.length; o++) {
|
|
3824
|
+
if (o < i - 1) {
|
|
3825
|
+
s[o] = { x: t[o].x, y: null };
|
|
3826
|
+
continue;
|
|
3827
|
+
}
|
|
3828
|
+
let a = 0;
|
|
3829
|
+
for (let h = o - i + 1; h <= o; h++) a += r[h];
|
|
3830
|
+
const c = a / i;
|
|
3831
|
+
let l = 0;
|
|
3832
|
+
for (let h = o - i + 1; h <= o; h++) l += Math.abs(r[h] - c);
|
|
3833
|
+
const u = l / i;
|
|
3834
|
+
s[o] = { x: t[o].x, y: u === 0 ? 0 : (r[o] - c) / (0.015 * u) };
|
|
3835
|
+
}
|
|
3836
|
+
return { values: s };
|
|
3837
|
+
}
|
|
3838
|
+
}
|
|
3839
|
+
const va = new wa();
|
|
3840
|
+
H.register(va);
|
|
3841
|
+
class ba extends z {
|
|
3842
|
+
constructor() {
|
|
3843
|
+
super(...arguments), this.name = "roc";
|
|
3844
|
+
}
|
|
3845
|
+
/**
|
|
3846
|
+
* Rate of Change: percentage change of close versus the close `period` bars
|
|
3847
|
+
* ago. ROC = 100 * (close - close[i-period]) / close[i-period].
|
|
3848
|
+
*/
|
|
3849
|
+
calculate(t, n) {
|
|
3850
|
+
const i = n.period ?? 9;
|
|
3851
|
+
return { values: t.map((s, o) => {
|
|
3852
|
+
if (o < i) return { x: s.x, y: null };
|
|
3853
|
+
const a = t[o - i].close;
|
|
3854
|
+
return { x: s.x, y: a === 0 ? 0 : (s.close - a) / a * 100 };
|
|
3855
|
+
}) };
|
|
3856
|
+
}
|
|
3857
|
+
}
|
|
3858
|
+
const ka = new ba();
|
|
3859
|
+
H.register(ka);
|
|
3860
|
+
class Ma extends z {
|
|
3861
|
+
constructor() {
|
|
3862
|
+
super(...arguments), this.name = "momentum";
|
|
3863
|
+
}
|
|
3864
|
+
/**
|
|
3865
|
+
* Momentum: the absolute price change over `period` bars
|
|
3866
|
+
* (close - close[i-period]).
|
|
3867
|
+
*/
|
|
3868
|
+
calculate(t, n) {
|
|
3869
|
+
const i = n.period ?? 14;
|
|
3870
|
+
return { values: t.map((s, o) => o < i ? { x: s.x, y: null } : { x: s.x, y: s.close - t[o - i].close }) };
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3873
|
+
const Aa = new Ma();
|
|
3874
|
+
H.register(Aa);
|
|
3875
|
+
class Pa extends z {
|
|
3876
|
+
constructor() {
|
|
3877
|
+
super(...arguments), this.name = "bollingerbands";
|
|
3878
|
+
}
|
|
3879
|
+
/**
|
|
3880
|
+
* Calculates Bollinger Bands: a middle SMA band with upper and lower bands
|
|
3881
|
+
* offset by a configurable number of standard deviations. Useful for
|
|
3882
|
+
* identifying volatility and potential price breakouts.
|
|
3883
|
+
*/
|
|
3884
|
+
calculate(t, n) {
|
|
3885
|
+
const i = n.period ?? 20, r = n.stdDev ?? 2, s = new Array(t.length), o = new Array(t.length), a = new Array(t.length), c = new Array(t.length);
|
|
3886
|
+
for (let l = 0; l < t.length; l++) {
|
|
3887
|
+
const u = t[l].x;
|
|
3888
|
+
if (l < i - 1) {
|
|
3889
|
+
s[l] = { x: u, y: null }, o[l] = { x: u, y: null }, a[l] = { x: u, y: null }, c[l] = { x: u, y: null };
|
|
3890
|
+
continue;
|
|
3891
|
+
}
|
|
3892
|
+
let h = 0;
|
|
3893
|
+
for (let g = l - i + 1; g <= l; g++)
|
|
3894
|
+
h += t[g].close;
|
|
3895
|
+
const f = h / i;
|
|
3896
|
+
let p = 0;
|
|
3897
|
+
for (let g = l - i + 1; g <= l; g++) {
|
|
3898
|
+
const x = t[g].close - f;
|
|
3899
|
+
p += x * x;
|
|
3900
|
+
}
|
|
3901
|
+
const d = Math.sqrt(p / i), y = f + r * d, m = f - r * d;
|
|
3902
|
+
s[l] = { x: u, y: f }, o[l] = { x: u, y }, a[l] = { x: u, y: f }, c[l] = { x: u, y: m };
|
|
3903
|
+
}
|
|
3904
|
+
return {
|
|
3905
|
+
values: s,
|
|
3906
|
+
bands: { upper: o, middle: a, lower: c }
|
|
3907
|
+
};
|
|
3908
|
+
}
|
|
3909
|
+
}
|
|
3910
|
+
const Ca = new Pa();
|
|
3911
|
+
H.register(Ca);
|
|
3912
|
+
class Ea extends z {
|
|
3913
|
+
constructor() {
|
|
3914
|
+
super(...arguments), this.name = "atr";
|
|
3915
|
+
}
|
|
3916
|
+
/**
|
|
3917
|
+
* Calculates Average True Range using Wilder's smoothing.
|
|
3918
|
+
* ATR measures market volatility by decomposing the full range
|
|
3919
|
+
* of a bar including gap openings.
|
|
3920
|
+
*/
|
|
3921
|
+
calculate(t, n) {
|
|
3922
|
+
const i = n.period ?? 14, r = new Array(t.length);
|
|
3923
|
+
r[0] = { x: t[0].x, y: null };
|
|
3924
|
+
const s = new Array(t.length);
|
|
3925
|
+
s[0] = t[0].high - t[0].low;
|
|
3926
|
+
for (let a = 1; a < t.length; a++) {
|
|
3927
|
+
const c = t[a].high, l = t[a].low, u = t[a - 1].close;
|
|
3928
|
+
s[a] = Math.max(
|
|
3929
|
+
c - l,
|
|
3930
|
+
Math.abs(c - u),
|
|
3931
|
+
Math.abs(l - u)
|
|
3932
|
+
);
|
|
3933
|
+
}
|
|
3934
|
+
for (let a = 1; a < i; a++)
|
|
3935
|
+
r[a] = { x: t[a].x, y: null };
|
|
3936
|
+
let o = 0;
|
|
3937
|
+
for (let a = 0; a < i; a++)
|
|
3938
|
+
o += s[a];
|
|
3939
|
+
o /= i, r[i - 1] = { x: t[i - 1].x, y: o };
|
|
3940
|
+
for (let a = i; a < t.length; a++)
|
|
3941
|
+
o = (o * (i - 1) + s[a]) / i, r[a] = { x: t[a].x, y: o };
|
|
3942
|
+
return { values: r };
|
|
3943
|
+
}
|
|
3944
|
+
}
|
|
3945
|
+
const Sa = new Ea();
|
|
3946
|
+
H.register(Sa);
|
|
3947
|
+
class Ia extends z {
|
|
3948
|
+
constructor() {
|
|
3949
|
+
super(...arguments), this.name = "vwap";
|
|
3950
|
+
}
|
|
3951
|
+
/**
|
|
3952
|
+
* Calculates Volume Weighted Average Price.
|
|
3953
|
+
* Accumulates (Typical Price * Volume) / cumulative Volume
|
|
3954
|
+
* from the first data point. Points with zero or missing volume
|
|
3955
|
+
* carry forward the previous VWAP value.
|
|
3956
|
+
*/
|
|
3957
|
+
calculate(t, n) {
|
|
3958
|
+
const i = new Array(t.length);
|
|
3959
|
+
let r = 0, s = 0, o = null;
|
|
3960
|
+
for (let a = 0; a < t.length; a++) {
|
|
3961
|
+
const c = t[a], l = c.volume ?? 0;
|
|
3962
|
+
if (l > 0) {
|
|
3963
|
+
const u = (c.high + c.low + c.close) / 3;
|
|
3964
|
+
r += u * l, s += l, o = r / s;
|
|
3965
|
+
}
|
|
3966
|
+
i[a] = { x: c.x, y: o };
|
|
3967
|
+
}
|
|
3968
|
+
return { values: i };
|
|
3969
|
+
}
|
|
3970
|
+
}
|
|
3971
|
+
const Ta = new Ia();
|
|
3972
|
+
H.register(Ta);
|
|
3973
|
+
class $a extends z {
|
|
3974
|
+
constructor() {
|
|
3975
|
+
super(...arguments), this.name = "obv";
|
|
3976
|
+
}
|
|
3977
|
+
/**
|
|
3978
|
+
* Calculates On Balance Volume.
|
|
3979
|
+
* Accumulates volume on up-closes and subtracts on down-closes.
|
|
3980
|
+
* Unchanged closes carry the previous OBV forward.
|
|
3981
|
+
*/
|
|
3982
|
+
calculate(t, n) {
|
|
3983
|
+
const i = new Array(t.length);
|
|
3984
|
+
if (t.length === 0) return { values: [] };
|
|
3985
|
+
let r = 0;
|
|
3986
|
+
i[0] = { x: t[0].x, y: r };
|
|
3987
|
+
for (let s = 1; s < t.length; s++) {
|
|
3988
|
+
const o = t[s].volume ?? 0;
|
|
3989
|
+
t[s].close > t[s - 1].close ? r += o : t[s].close < t[s - 1].close && (r -= o), i[s] = { x: t[s].x, y: r };
|
|
3990
|
+
}
|
|
3991
|
+
return { values: i };
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
const Na = new $a();
|
|
3995
|
+
H.register(Na);
|
|
3996
|
+
class Fa extends z {
|
|
3997
|
+
constructor() {
|
|
3998
|
+
super(...arguments), this.name = "vbp";
|
|
3999
|
+
}
|
|
4000
|
+
/**
|
|
4001
|
+
* Volume by Price: splits the price range into `ranges` horizontal bins and
|
|
4002
|
+
* sums the volume traded while the close fell in each bin. Each result point
|
|
4003
|
+
* carries the bin's price band (low/high) and its total/up volume, consumed
|
|
4004
|
+
* by the VBP renderer as horizontal bars.
|
|
4005
|
+
*/
|
|
4006
|
+
calculate(t, n) {
|
|
4007
|
+
const i = Math.max(1, n.ranges ?? 12);
|
|
4008
|
+
if (t.length === 0) return { values: [] };
|
|
4009
|
+
let r = 1 / 0, s = -1 / 0;
|
|
4010
|
+
for (const u of t)
|
|
4011
|
+
r = Math.min(r, u.low ?? u.close), s = Math.max(s, u.high ?? u.close);
|
|
4012
|
+
const o = (s - r) / i || 1, a = new Array(i).fill(0), c = new Array(i).fill(0);
|
|
4013
|
+
for (const u of t) {
|
|
4014
|
+
let h = Math.floor((u.close - r) / o);
|
|
4015
|
+
h < 0 && (h = 0), h >= i && (h = i - 1);
|
|
4016
|
+
const f = u.volume ?? 0;
|
|
4017
|
+
a[h] += f, u.close >= u.open && (c[h] += f);
|
|
4018
|
+
}
|
|
4019
|
+
return { values: a.map((u, h) => ({
|
|
4020
|
+
x: h,
|
|
4021
|
+
y: r + (h + 0.5) * o,
|
|
4022
|
+
low: r + h * o,
|
|
4023
|
+
high: r + (h + 1) * o,
|
|
4024
|
+
volume: u,
|
|
4025
|
+
volumeUp: c[h]
|
|
4026
|
+
})) };
|
|
4027
|
+
}
|
|
4028
|
+
}
|
|
4029
|
+
const Va = new Fa();
|
|
4030
|
+
H.register(Va);
|
|
4031
|
+
class Da extends z {
|
|
4032
|
+
constructor() {
|
|
4033
|
+
super(...arguments), this.name = "ichimoku";
|
|
4034
|
+
}
|
|
4035
|
+
/**
|
|
4036
|
+
* Calculates the full Ichimoku Cloud system: Tenkan-sen, Kijun-sen,
|
|
4037
|
+
* Senkou Span A/B (displaced forward), and Chikou Span (displaced backward).
|
|
4038
|
+
*/
|
|
4039
|
+
calculate(t, n) {
|
|
4040
|
+
const i = n.tenkanPeriod ?? 9, r = n.kijunPeriod ?? 26, s = n.senkouBPeriod ?? 52, o = n.displacement ?? 26, a = t.length;
|
|
4041
|
+
if (a === 0)
|
|
4042
|
+
return { values: [], signal: [], bands: { upper: [], lower: [], middle: [] } };
|
|
4043
|
+
const c = new Array(a), l = new Array(a), u = new Array(a);
|
|
4044
|
+
for (let x = 0; x < a; x++)
|
|
4045
|
+
c[x] = x >= i - 1 ? this.midpoint(t, x - i + 1, i) : null, l[x] = x >= r - 1 ? this.midpoint(t, x - r + 1, r) : null, u[x] = x >= s - 1 ? this.midpoint(t, x - s + 1, s) : null;
|
|
4046
|
+
const h = a > 1 ? (t[a - 1].x - t[0].x) / (a - 1) : 0, f = new Array(a), p = new Array(a);
|
|
4047
|
+
for (let x = 0; x < a; x++)
|
|
4048
|
+
f[x] = { x: t[x].x, y: c[x] }, p[x] = { x: t[x].x, y: l[x] };
|
|
4049
|
+
const d = a + o, y = new Array(d), m = new Array(d);
|
|
4050
|
+
for (let x = 0; x < d; x++) {
|
|
4051
|
+
const _ = x - o, w = _ >= 0 && _ < a ? t[_].x + o * h : t[0].x + x * h;
|
|
4052
|
+
let v = null;
|
|
4053
|
+
_ >= 0 && _ < a && c[_] !== null && l[_] !== null && (v = (c[_] + l[_]) / 2);
|
|
4054
|
+
let b = null;
|
|
4055
|
+
_ >= 0 && _ < a && (b = u[_]), y[x] = { x: w, y: v }, m[x] = { x: w, y: b };
|
|
4056
|
+
}
|
|
4057
|
+
const g = new Array(a);
|
|
4058
|
+
for (let x = 0; x < a; x++) {
|
|
4059
|
+
const _ = t[x].x - o * h;
|
|
4060
|
+
g[x] = { x: _, y: t[x].close };
|
|
4061
|
+
}
|
|
4062
|
+
return {
|
|
4063
|
+
values: f,
|
|
4064
|
+
signal: p,
|
|
4065
|
+
bands: { upper: y, lower: m, middle: g }
|
|
4066
|
+
};
|
|
4067
|
+
}
|
|
4068
|
+
/**
|
|
4069
|
+
* Returns (highest high + lowest low) / 2 over a contiguous range of data.
|
|
4070
|
+
*/
|
|
4071
|
+
midpoint(t, n, i) {
|
|
4072
|
+
let r = -1 / 0, s = 1 / 0;
|
|
4073
|
+
const o = n + i;
|
|
4074
|
+
for (let a = n; a < o; a++)
|
|
4075
|
+
t[a].high > r && (r = t[a].high), t[a].low < s && (s = t[a].low);
|
|
4076
|
+
return (r + s) / 2;
|
|
4077
|
+
}
|
|
4078
|
+
}
|
|
4079
|
+
const La = new Da();
|
|
4080
|
+
H.register(La);
|
|
4081
|
+
class Ra extends z {
|
|
4082
|
+
constructor() {
|
|
4083
|
+
super(...arguments), this.name = "adx";
|
|
4084
|
+
}
|
|
4085
|
+
/**
|
|
4086
|
+
* Average Directional Index (Wilder). Quantifies trend strength from the
|
|
4087
|
+
* smoothed directional movement (+DM/-DM) relative to true range. Returns the
|
|
4088
|
+
* ADX line; values below the first valid window are null.
|
|
4089
|
+
*/
|
|
4090
|
+
calculate(t, n) {
|
|
4091
|
+
const i = n.period ?? 14, r = t.length, s = t.map((g) => ({ x: g.x, y: null }));
|
|
4092
|
+
if (r < i * 2) return { values: s };
|
|
4093
|
+
const o = new Array(r).fill(0), a = new Array(r).fill(0), c = new Array(r).fill(0);
|
|
4094
|
+
for (let g = 1; g < r; g++) {
|
|
4095
|
+
const x = t[g].high - t[g - 1].high, _ = t[g - 1].low - t[g].low;
|
|
4096
|
+
o[g] = x > _ && x > 0 ? x : 0, a[g] = _ > x && _ > 0 ? _ : 0, c[g] = Math.max(
|
|
4097
|
+
t[g].high - t[g].low,
|
|
4098
|
+
Math.abs(t[g].high - t[g - 1].close),
|
|
4099
|
+
Math.abs(t[g].low - t[g - 1].close)
|
|
4100
|
+
);
|
|
4101
|
+
}
|
|
4102
|
+
let l = 0, u = 0, h = 0;
|
|
4103
|
+
for (let g = 1; g <= i; g++)
|
|
4104
|
+
l += o[g], u += a[g], h += c[g];
|
|
4105
|
+
const f = new Array(r).fill(NaN), p = (g) => {
|
|
4106
|
+
const x = h === 0 ? 0 : 100 * l / h, _ = h === 0 ? 0 : 100 * u / h, w = x + _;
|
|
4107
|
+
f[g] = w === 0 ? 0 : 100 * Math.abs(x - _) / w;
|
|
4108
|
+
};
|
|
4109
|
+
p(i);
|
|
4110
|
+
for (let g = i + 1; g < r; g++)
|
|
4111
|
+
l = l - l / i + o[g], u = u - u / i + a[g], h = h - h / i + c[g], p(g);
|
|
4112
|
+
let d = 0;
|
|
4113
|
+
const y = i * 2 - 1;
|
|
4114
|
+
let m = 0;
|
|
4115
|
+
for (let g = i; g <= y; g++) m += f[g];
|
|
4116
|
+
d = m / i, s[y] = { x: t[y].x, y: d };
|
|
4117
|
+
for (let g = y + 1; g < r; g++)
|
|
4118
|
+
d = (d * (i - 1) + f[g]) / i, s[g] = { x: t[g].x, y: d };
|
|
4119
|
+
return { values: s };
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
const Oa = new Ra();
|
|
4123
|
+
H.register(Oa);
|
|
4124
|
+
class za extends z {
|
|
4125
|
+
constructor() {
|
|
4126
|
+
super(...arguments), this.name = "psar";
|
|
4127
|
+
}
|
|
4128
|
+
/**
|
|
4129
|
+
* Parabolic SAR (stop-and-reverse). Tracks a trailing stop that accelerates
|
|
4130
|
+
* toward price as a trend extends. `increment` steps the acceleration factor
|
|
4131
|
+
* up to `maximum` each time a new extreme point is made.
|
|
4132
|
+
*/
|
|
4133
|
+
calculate(t, n) {
|
|
4134
|
+
const i = n.increment ?? 0.02, r = n.maximum ?? 0.2, s = t.length, o = t.map((h) => ({ x: h.x, y: null }));
|
|
4135
|
+
if (s < 2) return { values: o };
|
|
4136
|
+
let a = t[1].close >= t[0].close, c = a ? t[0].low : t[0].high, l = a ? t[0].high : t[0].low, u = i;
|
|
4137
|
+
o[0] = { x: t[0].x, y: c };
|
|
4138
|
+
for (let h = 1; h < s; h++) {
|
|
4139
|
+
let f = c + u * (l - c);
|
|
4140
|
+
a ? (f = Math.min(f, t[h - 1].low, h >= 2 ? t[h - 2].low : t[h - 1].low), t[h].low < f ? (a = !1, f = l, l = t[h].low, u = i) : t[h].high > l && (l = t[h].high, u = Math.min(u + i, r))) : (f = Math.max(f, t[h - 1].high, h >= 2 ? t[h - 2].high : t[h - 1].high), t[h].high > f ? (a = !0, f = l, l = t[h].high, u = i) : t[h].low < l && (l = t[h].low, u = Math.min(u + i, r))), c = f, o[h] = { x: t[h].x, y: c };
|
|
4141
|
+
}
|
|
4142
|
+
return { values: o };
|
|
4143
|
+
}
|
|
4144
|
+
}
|
|
4145
|
+
const Ha = new za();
|
|
4146
|
+
H.register(Ha);
|
|
4147
|
+
class Ua {
|
|
4148
|
+
/**
|
|
4149
|
+
* Connect a WebSocket to a series, parsing each message into points.
|
|
4150
|
+
*/
|
|
4151
|
+
static fromWebSocket(t, n, i, r) {
|
|
4152
|
+
const s = (r == null ? void 0 : r.shift) ?? !1, o = (a) => {
|
|
4153
|
+
let c;
|
|
4154
|
+
try {
|
|
4155
|
+
c = JSON.parse(a.data);
|
|
4156
|
+
} catch {
|
|
4157
|
+
return;
|
|
4158
|
+
}
|
|
4159
|
+
const l = i(c);
|
|
4160
|
+
if (Array.isArray(l))
|
|
4161
|
+
if (n.addPoints)
|
|
4162
|
+
n.addPoints(l, !0, s);
|
|
4163
|
+
else {
|
|
4164
|
+
for (const u of l) n.addPoint(u, !1, s);
|
|
4165
|
+
n.addPoint(l[l.length - 1], !0, s);
|
|
4166
|
+
}
|
|
4167
|
+
else
|
|
4168
|
+
n.addPoint(l, !0, s);
|
|
4169
|
+
};
|
|
4170
|
+
return t.addEventListener("message", o), { unsubscribe: () => t.removeEventListener("message", o) };
|
|
4171
|
+
}
|
|
4172
|
+
/**
|
|
4173
|
+
* Connect an EventSource (SSE) to a series.
|
|
4174
|
+
*/
|
|
4175
|
+
static fromEventSource(t, n, i, r, s) {
|
|
4176
|
+
const o = (s == null ? void 0 : s.shift) ?? !1, a = (c) => {
|
|
4177
|
+
const l = r(c.data);
|
|
4178
|
+
n.addPoint(l, !0, o);
|
|
4179
|
+
};
|
|
4180
|
+
return t.addEventListener(i, a), { unsubscribe: () => t.removeEventListener(i, a) };
|
|
4181
|
+
}
|
|
4182
|
+
/**
|
|
4183
|
+
* Create a polling adapter that fetches new data at a regular interval.
|
|
4184
|
+
*/
|
|
4185
|
+
static fromPolling(t, n, i, r) {
|
|
4186
|
+
const s = (r == null ? void 0 : r.shift) ?? !1;
|
|
4187
|
+
let o = !0;
|
|
4188
|
+
const a = async () => {
|
|
4189
|
+
if (o) {
|
|
4190
|
+
try {
|
|
4191
|
+
const c = await t();
|
|
4192
|
+
if (!o) return;
|
|
4193
|
+
if (Array.isArray(c))
|
|
4194
|
+
if (n.addPoints)
|
|
4195
|
+
n.addPoints(c, !0, s);
|
|
4196
|
+
else
|
|
4197
|
+
for (const l of c) n.addPoint(l, !0, s);
|
|
4198
|
+
else
|
|
4199
|
+
n.addPoint(c, !0, s);
|
|
4200
|
+
} catch {
|
|
4201
|
+
}
|
|
4202
|
+
o && setTimeout(a, i);
|
|
4203
|
+
}
|
|
4204
|
+
};
|
|
4205
|
+
return setTimeout(a, i), { unsubscribe: () => {
|
|
4206
|
+
o = !1;
|
|
4207
|
+
} };
|
|
4208
|
+
}
|
|
4209
|
+
}
|
|
4210
|
+
class Ya {
|
|
4211
|
+
constructor(t) {
|
|
4212
|
+
this.head = 0, this._size = 0, this.capacity = t, this.buffer = new Array(t);
|
|
4213
|
+
}
|
|
4214
|
+
/**
|
|
4215
|
+
* Push an item, returning the evicted item if at capacity.
|
|
4216
|
+
*/
|
|
4217
|
+
push(t) {
|
|
4218
|
+
const n = this._size === this.capacity ? this.buffer[this.head] : void 0, i = (this.head + this._size) % this.capacity;
|
|
4219
|
+
return this.buffer[i] = t, this._size < this.capacity ? this._size++ : this.head = (this.head + 1) % this.capacity, n;
|
|
4220
|
+
}
|
|
4221
|
+
/**
|
|
4222
|
+
* Push multiple items, returning all evicted items.
|
|
4223
|
+
*/
|
|
4224
|
+
pushMany(t) {
|
|
4225
|
+
const n = [];
|
|
4226
|
+
for (const i of t) {
|
|
4227
|
+
const r = this.push(i);
|
|
4228
|
+
r !== void 0 && n.push(r);
|
|
4229
|
+
}
|
|
4230
|
+
return n;
|
|
4231
|
+
}
|
|
4232
|
+
get size() {
|
|
4233
|
+
return this._size;
|
|
4234
|
+
}
|
|
4235
|
+
get isFull() {
|
|
4236
|
+
return this._size === this.capacity;
|
|
4237
|
+
}
|
|
4238
|
+
get(t) {
|
|
4239
|
+
if (!(t < 0 || t >= this._size))
|
|
4240
|
+
return this.buffer[(this.head + t) % this.capacity];
|
|
4241
|
+
}
|
|
4242
|
+
toArray() {
|
|
4243
|
+
const t = new Array(this._size);
|
|
4244
|
+
for (let n = 0; n < this._size; n++)
|
|
4245
|
+
t[n] = this.buffer[(this.head + n) % this.capacity];
|
|
4246
|
+
return t;
|
|
4247
|
+
}
|
|
4248
|
+
clear() {
|
|
4249
|
+
this.head = 0, this._size = 0;
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
class Ba {
|
|
4253
|
+
constructor() {
|
|
4254
|
+
this.entries = [];
|
|
4255
|
+
}
|
|
4256
|
+
add(t, n) {
|
|
4257
|
+
if (t === "setData") {
|
|
4258
|
+
this.entries = [{ type: t, payload: n }];
|
|
4259
|
+
return;
|
|
4260
|
+
}
|
|
4261
|
+
this.entries.push({ type: t, payload: n });
|
|
4262
|
+
}
|
|
4263
|
+
get isEmpty() {
|
|
4264
|
+
return this.entries.length === 0;
|
|
4265
|
+
}
|
|
4266
|
+
}
|
|
4267
|
+
class qa {
|
|
4268
|
+
constructor(t, n) {
|
|
4269
|
+
this.pendingUpdates = /* @__PURE__ */ new Map(), this.rafId = null, this.lastFrameTime = 0, this.maxFps = t.maxFps ?? 30, this.flushCallback = n;
|
|
4270
|
+
}
|
|
4271
|
+
schedule(t, n, i) {
|
|
4272
|
+
let r = this.pendingUpdates.get(t);
|
|
4273
|
+
r || (r = new Ba(), this.pendingUpdates.set(t, r)), r.add(n, i), this.requestFrame();
|
|
4274
|
+
}
|
|
4275
|
+
requestFrame() {
|
|
4276
|
+
this.rafId === null && (this.rafId = requestAnimationFrame(() => {
|
|
4277
|
+
this.rafId = null;
|
|
4278
|
+
const t = performance.now(), n = 1e3 / this.maxFps;
|
|
4279
|
+
if (t - this.lastFrameTime < n) {
|
|
4280
|
+
this.rafId = requestAnimationFrame(() => {
|
|
4281
|
+
this.rafId = null, this.lastFrameTime = performance.now(), this.flush();
|
|
4282
|
+
});
|
|
4283
|
+
return;
|
|
4284
|
+
}
|
|
4285
|
+
this.lastFrameTime = t, this.flush();
|
|
4286
|
+
}));
|
|
4287
|
+
}
|
|
4288
|
+
flush() {
|
|
4289
|
+
if (this.pendingUpdates.size !== 0) {
|
|
4290
|
+
for (const [t, n] of this.pendingUpdates)
|
|
4291
|
+
n.isEmpty || t.applyBatch(n);
|
|
4292
|
+
this.pendingUpdates.clear(), this.flushCallback();
|
|
4293
|
+
}
|
|
4294
|
+
}
|
|
4295
|
+
destroy() {
|
|
4296
|
+
this.rafId !== null && (cancelAnimationFrame(this.rafId), this.rafId = null), this.pendingUpdates.clear();
|
|
4297
|
+
}
|
|
4298
|
+
get hasPending() {
|
|
4299
|
+
return this.pendingUpdates.size > 0;
|
|
4300
|
+
}
|
|
4301
|
+
}
|
|
4302
|
+
na();
|
|
4303
|
+
export {
|
|
4304
|
+
Oa as ADX,
|
|
4305
|
+
Ra as ADXIndicator,
|
|
4306
|
+
Sa as ATR,
|
|
4307
|
+
Ea as ATRIndicator,
|
|
4308
|
+
Jn as AreaRangeChart,
|
|
4309
|
+
qo as AreaSplineRangeChart,
|
|
4310
|
+
Zo as BaselineChart,
|
|
4311
|
+
Ca as BollingerBands,
|
|
4312
|
+
Pa as BollingerBandsIndicator,
|
|
4313
|
+
va as CCI,
|
|
4314
|
+
wa as CCIIndicator,
|
|
4315
|
+
Xn as CandlestickChart,
|
|
4316
|
+
Ya as CircularBuffer,
|
|
4317
|
+
Go as ColumnRangeChart,
|
|
4318
|
+
ua as DEMA,
|
|
4319
|
+
ha as DEMAIndicator,
|
|
4320
|
+
aa as EMA,
|
|
4321
|
+
oa as EMAIndicator,
|
|
4322
|
+
Jo as FlagsChart,
|
|
4323
|
+
Oo as HeikinAshiChart,
|
|
4324
|
+
zo as HollowCandlestickChart,
|
|
4325
|
+
La as IchimokuCloud,
|
|
4326
|
+
Da as IchimokuCloudIndicator,
|
|
4327
|
+
z as Indicator,
|
|
4328
|
+
H as IndicatorRegistry,
|
|
4329
|
+
jo as KagiChart,
|
|
4330
|
+
ea as LineBreakChart,
|
|
4331
|
+
_a as MACD,
|
|
4332
|
+
ma as MACDIndicator,
|
|
4333
|
+
Aa as Momentum,
|
|
4334
|
+
Ma as MomentumIndicator,
|
|
4335
|
+
Na as OBV,
|
|
4336
|
+
$a as OBVIndicator,
|
|
4337
|
+
Wa as OHLCChart,
|
|
4338
|
+
Ha as PSAR,
|
|
4339
|
+
za as PSARIndicator,
|
|
4340
|
+
ta as PointAndFigureChart,
|
|
4341
|
+
ka as ROC,
|
|
4342
|
+
ba as ROCIndicator,
|
|
4343
|
+
ga as RSI,
|
|
4344
|
+
pa as RSIIndicator,
|
|
4345
|
+
Qo as RenkoChart,
|
|
4346
|
+
sa as SMA,
|
|
4347
|
+
ra as SMAIndicator,
|
|
4348
|
+
ya as Stochastic,
|
|
4349
|
+
xa as StochasticIndicator,
|
|
4350
|
+
Ua as StreamAdapter,
|
|
4351
|
+
da as TEMA,
|
|
4352
|
+
fa as TEMAIndicator,
|
|
4353
|
+
Ba as UpdateBatch,
|
|
4354
|
+
qa as UpdateScheduler,
|
|
4355
|
+
Va as VBP,
|
|
4356
|
+
Ko as VBPChart,
|
|
4357
|
+
Fa as VBPIndicator,
|
|
4358
|
+
Ta as VWAP,
|
|
4359
|
+
Ia as VWAPIndicator,
|
|
4360
|
+
Ho as VolumeChart,
|
|
4361
|
+
ca as WMA,
|
|
4362
|
+
la as WMAIndicator,
|
|
4363
|
+
na as registerFinanceSeriesTypes
|
|
4364
|
+
};
|