@schmitech/chatbot-widget 0.5.3 → 0.5.4
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/dist/Tableau10-D7jGxypv-BNlEL2G_.js +9 -0
- package/dist/arc-D-ZI5fuh-CvDHBzlN.js +84 -0
- package/dist/blockDiagram-c4efeb88-DUnNxfIR-Bhh-x1q6.js +1221 -0
- package/dist/c4Diagram-c83219d4-cC4OxfBG-DRTO_jy5.js +1580 -0
- package/dist/channel-hcYozyrT-BSOc2Hp-.js +6 -0
- package/dist/chatbot-widget.bundle.js +3881 -1586
- package/dist/chatbot-widget.css +1 -1
- package/dist/chatbot-widget.es.js +12 -63659
- package/dist/chatbot-widget.umd.js +3880 -1585
- package/dist/classDiagram-beda092f-BLYhf5Mr-vk4Ko58U.js +218 -0
- package/dist/classDiagram-v2-2358418a-VBkbF8mr-Ca0l1fEs.js +201 -0
- package/dist/clone-BZIkCMuw-B9owNq6E.js +9 -0
- package/dist/config/index.d.ts +2 -2
- package/dist/createText-1719965b-UejsQ47k-B1DYw0WW.js +2955 -0
- package/dist/edges-96097737-1M5QvjOd-BpQVVoQN.js +1088 -0
- package/dist/erDiagram-0228fc6a-CjBNxHoC-DXDVlH55.js +929 -0
- package/dist/flowDb-c6c81e3f-Q2aoOxdz-DfrfI3H1.js +1127 -0
- package/dist/flowDiagram-50d868cf-zizL6ppE-BAH-_juu.js +788 -0
- package/dist/flowDiagram-v2-4f6560a1-DVx_vlO5-bkcRE0UW.js +18 -0
- package/dist/flowchart-elk-definition-6af322e1-Eyez36go-B_lk3oHt.js +48132 -0
- package/dist/ganttDiagram-a2739b55-C82Jv-TO-DoS-s1Yu.js +1743 -0
- package/dist/gitGraphDiagram-82fe8481-D9o_9-U8-DJF-ZeR8.js +1265 -0
- package/dist/graph-BjmGDpTe-DgbYS1Ie.js +848 -0
- package/dist/index-5325376f-CJL5w-Sw-BXp44Ej5.js +374 -0
- package/dist/index-s6Yb6o1D.js +116386 -0
- package/dist/infoDiagram-8eee0895-FpS-TLK_-BnvO_wUe.js +320 -0
- package/dist/journeyDiagram-c64418c1-CMj1efQ9-CshcRDhm.js +802 -0
- package/dist/layout-D_6hdlf3-B7guhEBN.js +1470 -0
- package/dist/mindmap-definition-8da855dc-D4SxHjUd-jFZFomnk.js +21924 -0
- package/dist/pieDiagram-a8764435-BF5ZqOjB-Mqzg2J4Q.js +498 -0
- package/dist/quadrantDiagram-1e28029f-GtQb80VU-DCy1QjzW.js +903 -0
- package/dist/requirementDiagram-08caed73-CHtPj3FO-AHEP0cIt.js +767 -0
- package/dist/sankeyDiagram-a04cb91d-CBlXzOgd-CWJTc5AX.js +802 -0
- package/dist/sequenceDiagram-c5b8d532-Cs1iyw97-oayOJE8v.js +2235 -0
- package/dist/shared/styles.d.ts +1 -1
- package/dist/stateDiagram-1ecb1508-CpRKICMQ-C5OFJeRZ.js +266 -0
- package/dist/stateDiagram-v2-c2b004d7-BtkhFyQ5-DxzE8Je5.js +185 -0
- package/dist/styles-b4e223ce-D0oeHeKH-BmNvk4NR.js +1090 -0
- package/dist/styles-ca3715f6-BouNgl-L-_qXsPDP3.js +961 -0
- package/dist/styles-d45a18b0-Cvhb8Ltu-43I3Cd_I.js +437 -0
- package/dist/svgDrawCommon-b86b1483-mg-1NjZY-DrmnILcc.js +65 -0
- package/dist/timeline-definition-faaaa080-3olbep_P-BqKpgsPZ.js +793 -0
- package/dist/ui/Message.d.ts +1 -5
- package/dist/ui/MessagesList.d.ts +1 -5
- package/dist/xychartDiagram-f5964ef8-BN6HXpmW-C-g_F1w2.js +1238 -0
- package/package.json +3 -3
- package/dist/ui/TypingEffect.d.ts +0 -18
|
@@ -0,0 +1,1238 @@
|
|
|
1
|
+
import { y as Ft, v as Nt, w as At, x as Ot, b as Bt, a as Xt, O as wt, aa as Vt, W as Ut, m as Yt, aj as nt, ab as kt, ae as Ht, ai as Gt, q as Qt, ak as xt, p as dt, c as pt } from "./index-s6Yb6o1D.js";
|
|
2
|
+
import { U as jt } from "./createText-1719965b-UejsQ47k-B1DYw0WW.js";
|
|
3
|
+
typeof window < "u" && (window.global = window);
|
|
4
|
+
var et = function() {
|
|
5
|
+
var e = function($, h, r, l) {
|
|
6
|
+
for (r = r || {}, l = $.length; l--; r[$[l]] = h)
|
|
7
|
+
;
|
|
8
|
+
return r;
|
|
9
|
+
}, t = [1, 10, 12, 14, 16, 18, 19, 21, 23], i = [2, 6], s = [1, 3], n = [1, 5], c = [1, 6], g = [1, 7], p = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], y = [1, 25], D = [1, 26], C = [1, 28], _ = [1, 29], P = [1, 30], v = [1, 31], S = [1, 32], E = [1, 33], d = [1, 34], A = [1, 35], o = [1, 36], T = [1, 37], N = [1, 43], ot = [1, 42], rt = [1, 47], U = [1, 50], m = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], j = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], R = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], lt = [1, 64], K = {
|
|
10
|
+
trace: function() {
|
|
11
|
+
},
|
|
12
|
+
yy: {},
|
|
13
|
+
symbols_: { error: 2, start: 3, eol: 4, XYCHART: 5, chartConfig: 6, document: 7, CHART_ORIENTATION: 8, statement: 9, title: 10, text: 11, X_AXIS: 12, parseXAxis: 13, Y_AXIS: 14, parseYAxis: 15, LINE: 16, plotData: 17, BAR: 18, acc_title: 19, acc_title_value: 20, acc_descr: 21, acc_descr_value: 22, acc_descr_multiline_value: 23, SQUARE_BRACES_START: 24, commaSeparatedNumbers: 25, SQUARE_BRACES_END: 26, NUMBER_WITH_DECIMAL: 27, COMMA: 28, xAxisData: 29, bandData: 30, ARROW_DELIMITER: 31, commaSeparatedTexts: 32, yAxisData: 33, NEWLINE: 34, SEMI: 35, EOF: 36, alphaNum: 37, STR: 38, MD_STR: 39, alphaNumToken: 40, AMP: 41, NUM: 42, ALPHA: 43, PLUS: 44, EQUALS: 45, MULT: 46, DOT: 47, BRKT: 48, MINUS: 49, UNDERSCORE: 50, $accept: 0, $end: 1 },
|
|
14
|
+
terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" },
|
|
15
|
+
productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]],
|
|
16
|
+
performAction: function($, h, r, l, f, a, w) {
|
|
17
|
+
var u = a.length - 1;
|
|
18
|
+
switch (f) {
|
|
19
|
+
case 5:
|
|
20
|
+
l.setOrientation(a[u]);
|
|
21
|
+
break;
|
|
22
|
+
case 9:
|
|
23
|
+
l.setDiagramTitle(a[u].text.trim());
|
|
24
|
+
break;
|
|
25
|
+
case 12:
|
|
26
|
+
l.setLineData({ text: "", type: "text" }, a[u]);
|
|
27
|
+
break;
|
|
28
|
+
case 13:
|
|
29
|
+
l.setLineData(a[u - 1], a[u]);
|
|
30
|
+
break;
|
|
31
|
+
case 14:
|
|
32
|
+
l.setBarData({ text: "", type: "text" }, a[u]);
|
|
33
|
+
break;
|
|
34
|
+
case 15:
|
|
35
|
+
l.setBarData(a[u - 1], a[u]);
|
|
36
|
+
break;
|
|
37
|
+
case 16:
|
|
38
|
+
this.$ = a[u].trim(), l.setAccTitle(this.$);
|
|
39
|
+
break;
|
|
40
|
+
case 17:
|
|
41
|
+
case 18:
|
|
42
|
+
this.$ = a[u].trim(), l.setAccDescription(this.$);
|
|
43
|
+
break;
|
|
44
|
+
case 19:
|
|
45
|
+
this.$ = a[u - 1];
|
|
46
|
+
break;
|
|
47
|
+
case 20:
|
|
48
|
+
this.$ = [Number(a[u - 2]), ...a[u]];
|
|
49
|
+
break;
|
|
50
|
+
case 21:
|
|
51
|
+
this.$ = [Number(a[u])];
|
|
52
|
+
break;
|
|
53
|
+
case 22:
|
|
54
|
+
l.setXAxisTitle(a[u]);
|
|
55
|
+
break;
|
|
56
|
+
case 23:
|
|
57
|
+
l.setXAxisTitle(a[u - 1]);
|
|
58
|
+
break;
|
|
59
|
+
case 24:
|
|
60
|
+
l.setXAxisTitle({ type: "text", text: "" });
|
|
61
|
+
break;
|
|
62
|
+
case 25:
|
|
63
|
+
l.setXAxisBand(a[u]);
|
|
64
|
+
break;
|
|
65
|
+
case 26:
|
|
66
|
+
l.setXAxisRangeData(Number(a[u - 2]), Number(a[u]));
|
|
67
|
+
break;
|
|
68
|
+
case 27:
|
|
69
|
+
this.$ = a[u - 1];
|
|
70
|
+
break;
|
|
71
|
+
case 28:
|
|
72
|
+
this.$ = [a[u - 2], ...a[u]];
|
|
73
|
+
break;
|
|
74
|
+
case 29:
|
|
75
|
+
this.$ = [a[u]];
|
|
76
|
+
break;
|
|
77
|
+
case 30:
|
|
78
|
+
l.setYAxisTitle(a[u]);
|
|
79
|
+
break;
|
|
80
|
+
case 31:
|
|
81
|
+
l.setYAxisTitle(a[u - 1]);
|
|
82
|
+
break;
|
|
83
|
+
case 32:
|
|
84
|
+
l.setYAxisTitle({ type: "text", text: "" });
|
|
85
|
+
break;
|
|
86
|
+
case 33:
|
|
87
|
+
l.setYAxisRangeData(Number(a[u - 2]), Number(a[u]));
|
|
88
|
+
break;
|
|
89
|
+
case 37:
|
|
90
|
+
this.$ = { text: a[u], type: "text" };
|
|
91
|
+
break;
|
|
92
|
+
case 38:
|
|
93
|
+
this.$ = { text: a[u], type: "text" };
|
|
94
|
+
break;
|
|
95
|
+
case 39:
|
|
96
|
+
this.$ = { text: a[u], type: "markdown" };
|
|
97
|
+
break;
|
|
98
|
+
case 40:
|
|
99
|
+
this.$ = a[u];
|
|
100
|
+
break;
|
|
101
|
+
case 41:
|
|
102
|
+
this.$ = a[u - 1] + "" + a[u];
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
table: [e(t, i, { 3: 1, 4: 2, 7: 4, 5: s, 34: n, 35: c, 36: g }), { 1: [3] }, e(t, i, { 4: 2, 7: 4, 3: 8, 5: s, 34: n, 35: c, 36: g }), e(t, i, { 4: 2, 7: 4, 6: 9, 3: 10, 5: s, 8: [1, 11], 34: n, 35: c, 36: g }), { 1: [2, 4], 9: 12, 10: [1, 13], 12: [1, 14], 14: [1, 15], 16: [1, 16], 18: [1, 17], 19: [1, 18], 21: [1, 19], 23: [1, 20] }, e(p, [2, 34]), e(p, [2, 35]), e(p, [2, 36]), { 1: [2, 1] }, e(t, i, { 4: 2, 7: 4, 3: 21, 5: s, 34: n, 35: c, 36: g }), { 1: [2, 3] }, e(p, [2, 5]), e(t, [2, 7], { 4: 22, 34: n, 35: c, 36: g }), { 11: 23, 37: 24, 38: y, 39: D, 40: 27, 41: C, 42: _, 43: P, 44: v, 45: S, 46: E, 47: d, 48: A, 49: o, 50: T }, { 11: 39, 13: 38, 24: N, 27: ot, 29: 40, 30: 41, 37: 24, 38: y, 39: D, 40: 27, 41: C, 42: _, 43: P, 44: v, 45: S, 46: E, 47: d, 48: A, 49: o, 50: T }, { 11: 45, 15: 44, 27: rt, 33: 46, 37: 24, 38: y, 39: D, 40: 27, 41: C, 42: _, 43: P, 44: v, 45: S, 46: E, 47: d, 48: A, 49: o, 50: T }, { 11: 49, 17: 48, 24: U, 37: 24, 38: y, 39: D, 40: 27, 41: C, 42: _, 43: P, 44: v, 45: S, 46: E, 47: d, 48: A, 49: o, 50: T }, { 11: 52, 17: 51, 24: U, 37: 24, 38: y, 39: D, 40: 27, 41: C, 42: _, 43: P, 44: v, 45: S, 46: E, 47: d, 48: A, 49: o, 50: T }, { 20: [1, 53] }, { 22: [1, 54] }, e(m, [2, 18]), { 1: [2, 2] }, e(m, [2, 8]), e(m, [2, 9]), e(j, [2, 37], { 40: 55, 41: C, 42: _, 43: P, 44: v, 45: S, 46: E, 47: d, 48: A, 49: o, 50: T }), e(j, [2, 38]), e(j, [2, 39]), e(R, [2, 40]), e(R, [2, 42]), e(R, [2, 43]), e(R, [2, 44]), e(R, [2, 45]), e(R, [2, 46]), e(R, [2, 47]), e(R, [2, 48]), e(R, [2, 49]), e(R, [2, 50]), e(R, [2, 51]), e(m, [2, 10]), e(m, [2, 22], { 30: 41, 29: 56, 24: N, 27: ot }), e(m, [2, 24]), e(m, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: y, 39: D, 40: 27, 41: C, 42: _, 43: P, 44: v, 45: S, 46: E, 47: d, 48: A, 49: o, 50: T }, e(m, [2, 11]), e(m, [2, 30], { 33: 60, 27: rt }), e(m, [2, 32]), { 31: [1, 61] }, e(m, [2, 12]), { 17: 62, 24: U }, { 25: 63, 27: lt }, e(m, [2, 14]), { 17: 65, 24: U }, e(m, [2, 16]), e(m, [2, 17]), e(R, [2, 41]), e(m, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, e(m, [2, 31]), { 27: [1, 69] }, e(m, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, e(m, [2, 15]), e(m, [2, 26]), e(m, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: y, 39: D, 40: 27, 41: C, 42: _, 43: P, 44: v, 45: S, 46: E, 47: d, 48: A, 49: o, 50: T }, e(m, [2, 33]), e(m, [2, 19]), { 25: 73, 27: lt }, { 26: [2, 28] }, { 26: [2, 20] }],
|
|
107
|
+
defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] },
|
|
108
|
+
parseError: function($, h) {
|
|
109
|
+
if (h.recoverable)
|
|
110
|
+
this.trace($);
|
|
111
|
+
else {
|
|
112
|
+
var r = new Error($);
|
|
113
|
+
throw r.hash = h, r;
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
parse: function($) {
|
|
117
|
+
var h = this, r = [0], l = [], f = [null], a = [], w = this.table, u = "", Y = 0, ct = 0, It = 2, gt = 1, Mt = a.slice.call(arguments, 1), b = Object.create(this.lexer), z = { yy: {} };
|
|
118
|
+
for (var q in this.yy)
|
|
119
|
+
Object.prototype.hasOwnProperty.call(this.yy, q) && (z.yy[q] = this.yy[q]);
|
|
120
|
+
b.setInput($, z.yy), z.yy.lexer = b, z.yy.parser = this, typeof b.yylloc > "u" && (b.yylloc = {});
|
|
121
|
+
var J = b.yylloc;
|
|
122
|
+
a.push(J);
|
|
123
|
+
var zt = b.options && b.options.ranges;
|
|
124
|
+
typeof z.yy.parseError == "function" ? this.parseError = z.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
|
|
125
|
+
function Wt() {
|
|
126
|
+
var M;
|
|
127
|
+
return M = l.pop() || b.lex() || gt, typeof M != "number" && (M instanceof Array && (l = M, M = l.pop()), M = h.symbols_[M] || M), M;
|
|
128
|
+
}
|
|
129
|
+
for (var k, W, L, tt, F = {}, H, I, ut, G; ; ) {
|
|
130
|
+
if (W = r[r.length - 1], this.defaultActions[W] ? L = this.defaultActions[W] : ((k === null || typeof k > "u") && (k = Wt()), L = w[W] && w[W][k]), typeof L > "u" || !L.length || !L[0]) {
|
|
131
|
+
var it = "";
|
|
132
|
+
G = [];
|
|
133
|
+
for (H in w[W])
|
|
134
|
+
this.terminals_[H] && H > It && G.push("'" + this.terminals_[H] + "'");
|
|
135
|
+
b.showPosition ? it = "Parse error on line " + (Y + 1) + `:
|
|
136
|
+
` + b.showPosition() + `
|
|
137
|
+
Expecting ` + G.join(", ") + ", got '" + (this.terminals_[k] || k) + "'" : it = "Parse error on line " + (Y + 1) + ": Unexpected " + (k == gt ? "end of input" : "'" + (this.terminals_[k] || k) + "'"), this.parseError(it, {
|
|
138
|
+
text: b.match,
|
|
139
|
+
token: this.terminals_[k] || k,
|
|
140
|
+
line: b.yylineno,
|
|
141
|
+
loc: J,
|
|
142
|
+
expected: G
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (L[0] instanceof Array && L.length > 1)
|
|
146
|
+
throw new Error("Parse Error: multiple actions possible at state: " + W + ", token: " + k);
|
|
147
|
+
switch (L[0]) {
|
|
148
|
+
case 1:
|
|
149
|
+
r.push(k), f.push(b.yytext), a.push(b.yylloc), r.push(L[1]), k = null, ct = b.yyleng, u = b.yytext, Y = b.yylineno, J = b.yylloc;
|
|
150
|
+
break;
|
|
151
|
+
case 2:
|
|
152
|
+
if (I = this.productions_[L[1]][1], F.$ = f[f.length - I], F._$ = {
|
|
153
|
+
first_line: a[a.length - (I || 1)].first_line,
|
|
154
|
+
last_line: a[a.length - 1].last_line,
|
|
155
|
+
first_column: a[a.length - (I || 1)].first_column,
|
|
156
|
+
last_column: a[a.length - 1].last_column
|
|
157
|
+
}, zt && (F._$.range = [
|
|
158
|
+
a[a.length - (I || 1)].range[0],
|
|
159
|
+
a[a.length - 1].range[1]
|
|
160
|
+
]), tt = this.performAction.apply(F, [
|
|
161
|
+
u,
|
|
162
|
+
ct,
|
|
163
|
+
Y,
|
|
164
|
+
z.yy,
|
|
165
|
+
L[1],
|
|
166
|
+
f,
|
|
167
|
+
a
|
|
168
|
+
].concat(Mt)), typeof tt < "u")
|
|
169
|
+
return tt;
|
|
170
|
+
I && (r = r.slice(0, -1 * I * 2), f = f.slice(0, -1 * I), a = a.slice(0, -1 * I)), r.push(this.productions_[L[1]][0]), f.push(F.$), a.push(F._$), ut = w[r[r.length - 2]][r[r.length - 1]], r.push(ut);
|
|
171
|
+
break;
|
|
172
|
+
case 3:
|
|
173
|
+
return !0;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return !0;
|
|
177
|
+
}
|
|
178
|
+
}, $t = /* @__PURE__ */ function() {
|
|
179
|
+
var $ = {
|
|
180
|
+
EOF: 1,
|
|
181
|
+
parseError: function(h, r) {
|
|
182
|
+
if (this.yy.parser)
|
|
183
|
+
this.yy.parser.parseError(h, r);
|
|
184
|
+
else
|
|
185
|
+
throw new Error(h);
|
|
186
|
+
},
|
|
187
|
+
// resets the lexer, sets new input
|
|
188
|
+
setInput: function(h, r) {
|
|
189
|
+
return this.yy = r || this.yy || {}, this._input = h, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
|
|
190
|
+
first_line: 1,
|
|
191
|
+
first_column: 0,
|
|
192
|
+
last_line: 1,
|
|
193
|
+
last_column: 0
|
|
194
|
+
}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
|
|
195
|
+
},
|
|
196
|
+
// consumes and returns one char from the input
|
|
197
|
+
input: function() {
|
|
198
|
+
var h = this._input[0];
|
|
199
|
+
this.yytext += h, this.yyleng++, this.offset++, this.match += h, this.matched += h;
|
|
200
|
+
var r = h.match(/(?:\r\n?|\n).*/g);
|
|
201
|
+
return r ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), h;
|
|
202
|
+
},
|
|
203
|
+
// unshifts one char (or a string) into the input
|
|
204
|
+
unput: function(h) {
|
|
205
|
+
var r = h.length, l = h.split(/(?:\r\n?|\n)/g);
|
|
206
|
+
this._input = h + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - r), this.offset -= r;
|
|
207
|
+
var f = this.match.split(/(?:\r\n?|\n)/g);
|
|
208
|
+
this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), l.length - 1 && (this.yylineno -= l.length - 1);
|
|
209
|
+
var a = this.yylloc.range;
|
|
210
|
+
return this.yylloc = {
|
|
211
|
+
first_line: this.yylloc.first_line,
|
|
212
|
+
last_line: this.yylineno + 1,
|
|
213
|
+
first_column: this.yylloc.first_column,
|
|
214
|
+
last_column: l ? (l.length === f.length ? this.yylloc.first_column : 0) + f[f.length - l.length].length - l[0].length : this.yylloc.first_column - r
|
|
215
|
+
}, this.options.ranges && (this.yylloc.range = [a[0], a[0] + this.yyleng - r]), this.yyleng = this.yytext.length, this;
|
|
216
|
+
},
|
|
217
|
+
// When called from action, caches matched text and appends it on next action
|
|
218
|
+
more: function() {
|
|
219
|
+
return this._more = !0, this;
|
|
220
|
+
},
|
|
221
|
+
// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
|
|
222
|
+
reject: function() {
|
|
223
|
+
if (this.options.backtrack_lexer)
|
|
224
|
+
this._backtrack = !0;
|
|
225
|
+
else
|
|
226
|
+
return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
227
|
+
` + this.showPosition(), {
|
|
228
|
+
text: "",
|
|
229
|
+
token: null,
|
|
230
|
+
line: this.yylineno
|
|
231
|
+
});
|
|
232
|
+
return this;
|
|
233
|
+
},
|
|
234
|
+
// retain first n characters of the match
|
|
235
|
+
less: function(h) {
|
|
236
|
+
this.unput(this.match.slice(h));
|
|
237
|
+
},
|
|
238
|
+
// displays already matched input, i.e. for error messages
|
|
239
|
+
pastInput: function() {
|
|
240
|
+
var h = this.matched.substr(0, this.matched.length - this.match.length);
|
|
241
|
+
return (h.length > 20 ? "..." : "") + h.substr(-20).replace(/\n/g, "");
|
|
242
|
+
},
|
|
243
|
+
// displays upcoming input, i.e. for error messages
|
|
244
|
+
upcomingInput: function() {
|
|
245
|
+
var h = this.match;
|
|
246
|
+
return h.length < 20 && (h += this._input.substr(0, 20 - h.length)), (h.substr(0, 20) + (h.length > 20 ? "..." : "")).replace(/\n/g, "");
|
|
247
|
+
},
|
|
248
|
+
// displays the character position where the lexing error occurred, i.e. for error messages
|
|
249
|
+
showPosition: function() {
|
|
250
|
+
var h = this.pastInput(), r = new Array(h.length + 1).join("-");
|
|
251
|
+
return h + this.upcomingInput() + `
|
|
252
|
+
` + r + "^";
|
|
253
|
+
},
|
|
254
|
+
// test the lexed token: return FALSE when not a match, otherwise return token
|
|
255
|
+
test_match: function(h, r) {
|
|
256
|
+
var l, f, a;
|
|
257
|
+
if (this.options.backtrack_lexer && (a = {
|
|
258
|
+
yylineno: this.yylineno,
|
|
259
|
+
yylloc: {
|
|
260
|
+
first_line: this.yylloc.first_line,
|
|
261
|
+
last_line: this.last_line,
|
|
262
|
+
first_column: this.yylloc.first_column,
|
|
263
|
+
last_column: this.yylloc.last_column
|
|
264
|
+
},
|
|
265
|
+
yytext: this.yytext,
|
|
266
|
+
match: this.match,
|
|
267
|
+
matches: this.matches,
|
|
268
|
+
matched: this.matched,
|
|
269
|
+
yyleng: this.yyleng,
|
|
270
|
+
offset: this.offset,
|
|
271
|
+
_more: this._more,
|
|
272
|
+
_input: this._input,
|
|
273
|
+
yy: this.yy,
|
|
274
|
+
conditionStack: this.conditionStack.slice(0),
|
|
275
|
+
done: this.done
|
|
276
|
+
}, this.options.ranges && (a.yylloc.range = this.yylloc.range.slice(0))), f = h[0].match(/(?:\r\n?|\n).*/g), f && (this.yylineno += f.length), this.yylloc = {
|
|
277
|
+
first_line: this.yylloc.last_line,
|
|
278
|
+
last_line: this.yylineno + 1,
|
|
279
|
+
first_column: this.yylloc.last_column,
|
|
280
|
+
last_column: f ? f[f.length - 1].length - f[f.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + h[0].length
|
|
281
|
+
}, this.yytext += h[0], this.match += h[0], this.matches = h, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(h[0].length), this.matched += h[0], l = this.performAction.call(this, this.yy, this, r, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), l)
|
|
282
|
+
return l;
|
|
283
|
+
if (this._backtrack) {
|
|
284
|
+
for (var w in a)
|
|
285
|
+
this[w] = a[w];
|
|
286
|
+
return !1;
|
|
287
|
+
}
|
|
288
|
+
return !1;
|
|
289
|
+
},
|
|
290
|
+
// return next match in input
|
|
291
|
+
next: function() {
|
|
292
|
+
if (this.done)
|
|
293
|
+
return this.EOF;
|
|
294
|
+
this._input || (this.done = !0);
|
|
295
|
+
var h, r, l, f;
|
|
296
|
+
this._more || (this.yytext = "", this.match = "");
|
|
297
|
+
for (var a = this._currentRules(), w = 0; w < a.length; w++)
|
|
298
|
+
if (l = this._input.match(this.rules[a[w]]), l && (!r || l[0].length > r[0].length)) {
|
|
299
|
+
if (r = l, f = w, this.options.backtrack_lexer) {
|
|
300
|
+
if (h = this.test_match(l, a[w]), h !== !1)
|
|
301
|
+
return h;
|
|
302
|
+
if (this._backtrack) {
|
|
303
|
+
r = !1;
|
|
304
|
+
continue;
|
|
305
|
+
} else
|
|
306
|
+
return !1;
|
|
307
|
+
} else if (!this.options.flex)
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
return r ? (h = this.test_match(r, a[f]), h !== !1 ? h : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
|
|
311
|
+
` + this.showPosition(), {
|
|
312
|
+
text: "",
|
|
313
|
+
token: null,
|
|
314
|
+
line: this.yylineno
|
|
315
|
+
});
|
|
316
|
+
},
|
|
317
|
+
// return next match that has a token
|
|
318
|
+
lex: function() {
|
|
319
|
+
var h = this.next();
|
|
320
|
+
return h || this.lex();
|
|
321
|
+
},
|
|
322
|
+
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
|
323
|
+
begin: function(h) {
|
|
324
|
+
this.conditionStack.push(h);
|
|
325
|
+
},
|
|
326
|
+
// pop the previously active lexer condition state off the condition stack
|
|
327
|
+
popState: function() {
|
|
328
|
+
var h = this.conditionStack.length - 1;
|
|
329
|
+
return h > 0 ? this.conditionStack.pop() : this.conditionStack[0];
|
|
330
|
+
},
|
|
331
|
+
// produce the lexer rule set which is active for the currently active lexer condition state
|
|
332
|
+
_currentRules: function() {
|
|
333
|
+
return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
|
|
334
|
+
},
|
|
335
|
+
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
|
336
|
+
topState: function(h) {
|
|
337
|
+
return h = this.conditionStack.length - 1 - Math.abs(h || 0), h >= 0 ? this.conditionStack[h] : "INITIAL";
|
|
338
|
+
},
|
|
339
|
+
// alias for begin(condition)
|
|
340
|
+
pushState: function(h) {
|
|
341
|
+
this.begin(h);
|
|
342
|
+
},
|
|
343
|
+
// return the number of states currently on the stack
|
|
344
|
+
stateStackSize: function() {
|
|
345
|
+
return this.conditionStack.length;
|
|
346
|
+
},
|
|
347
|
+
options: { "case-insensitive": !0 },
|
|
348
|
+
performAction: function(h, r, l, f) {
|
|
349
|
+
switch (l) {
|
|
350
|
+
case 0:
|
|
351
|
+
break;
|
|
352
|
+
case 1:
|
|
353
|
+
break;
|
|
354
|
+
case 2:
|
|
355
|
+
return this.popState(), 34;
|
|
356
|
+
case 3:
|
|
357
|
+
return this.popState(), 34;
|
|
358
|
+
case 4:
|
|
359
|
+
return 34;
|
|
360
|
+
case 5:
|
|
361
|
+
break;
|
|
362
|
+
case 6:
|
|
363
|
+
return 10;
|
|
364
|
+
case 7:
|
|
365
|
+
return this.pushState("acc_title"), 19;
|
|
366
|
+
case 8:
|
|
367
|
+
return this.popState(), "acc_title_value";
|
|
368
|
+
case 9:
|
|
369
|
+
return this.pushState("acc_descr"), 21;
|
|
370
|
+
case 10:
|
|
371
|
+
return this.popState(), "acc_descr_value";
|
|
372
|
+
case 11:
|
|
373
|
+
this.pushState("acc_descr_multiline");
|
|
374
|
+
break;
|
|
375
|
+
case 12:
|
|
376
|
+
this.popState();
|
|
377
|
+
break;
|
|
378
|
+
case 13:
|
|
379
|
+
return "acc_descr_multiline_value";
|
|
380
|
+
case 14:
|
|
381
|
+
return 5;
|
|
382
|
+
case 15:
|
|
383
|
+
return 8;
|
|
384
|
+
case 16:
|
|
385
|
+
return this.pushState("axis_data"), "X_AXIS";
|
|
386
|
+
case 17:
|
|
387
|
+
return this.pushState("axis_data"), "Y_AXIS";
|
|
388
|
+
case 18:
|
|
389
|
+
return this.pushState("axis_band_data"), 24;
|
|
390
|
+
case 19:
|
|
391
|
+
return 31;
|
|
392
|
+
case 20:
|
|
393
|
+
return this.pushState("data"), 16;
|
|
394
|
+
case 21:
|
|
395
|
+
return this.pushState("data"), 18;
|
|
396
|
+
case 22:
|
|
397
|
+
return this.pushState("data_inner"), 24;
|
|
398
|
+
case 23:
|
|
399
|
+
return 27;
|
|
400
|
+
case 24:
|
|
401
|
+
return this.popState(), 26;
|
|
402
|
+
case 25:
|
|
403
|
+
this.popState();
|
|
404
|
+
break;
|
|
405
|
+
case 26:
|
|
406
|
+
this.pushState("string");
|
|
407
|
+
break;
|
|
408
|
+
case 27:
|
|
409
|
+
this.popState();
|
|
410
|
+
break;
|
|
411
|
+
case 28:
|
|
412
|
+
return "STR";
|
|
413
|
+
case 29:
|
|
414
|
+
return 24;
|
|
415
|
+
case 30:
|
|
416
|
+
return 26;
|
|
417
|
+
case 31:
|
|
418
|
+
return 43;
|
|
419
|
+
case 32:
|
|
420
|
+
return "COLON";
|
|
421
|
+
case 33:
|
|
422
|
+
return 44;
|
|
423
|
+
case 34:
|
|
424
|
+
return 28;
|
|
425
|
+
case 35:
|
|
426
|
+
return 45;
|
|
427
|
+
case 36:
|
|
428
|
+
return 46;
|
|
429
|
+
case 37:
|
|
430
|
+
return 48;
|
|
431
|
+
case 38:
|
|
432
|
+
return 50;
|
|
433
|
+
case 39:
|
|
434
|
+
return 47;
|
|
435
|
+
case 40:
|
|
436
|
+
return 41;
|
|
437
|
+
case 41:
|
|
438
|
+
return 49;
|
|
439
|
+
case 42:
|
|
440
|
+
return 42;
|
|
441
|
+
case 43:
|
|
442
|
+
break;
|
|
443
|
+
case 44:
|
|
444
|
+
return 35;
|
|
445
|
+
case 45:
|
|
446
|
+
return 36;
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:(\r?\n))/i, /^(?:(\r?\n))/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:\{)/i, /^(?:[^\}]*)/i, /^(?:xychart-beta\b)/i, /^(?:(?:vertical|horizontal))/i, /^(?:x-axis\b)/i, /^(?:y-axis\b)/i, /^(?:\[)/i, /^(?:-->)/i, /^(?:line\b)/i, /^(?:bar\b)/i, /^(?:\[)/i, /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i, /^(?:\])/i, /^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s+)/i, /^(?:;)/i, /^(?:$)/i],
|
|
450
|
+
conditions: { data_inner: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, data: { rules: [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 22, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, axis_band_data: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, axis_data: { rules: [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, acc_descr_multiline: { rules: [12, 13], inclusive: !1 }, acc_descr: { rules: [10], inclusive: !1 }, acc_title: { rules: [8], inclusive: !1 }, title: { rules: [], inclusive: !1 }, md_string: { rules: [], inclusive: !1 }, string: { rules: [27, 28], inclusive: !1 }, INITIAL: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 } }
|
|
451
|
+
};
|
|
452
|
+
return $;
|
|
453
|
+
}();
|
|
454
|
+
K.lexer = $t;
|
|
455
|
+
function Z() {
|
|
456
|
+
this.yy = {};
|
|
457
|
+
}
|
|
458
|
+
return Z.prototype = K, K.Parser = Z, new Z();
|
|
459
|
+
}();
|
|
460
|
+
et.parser = et;
|
|
461
|
+
const Kt = et;
|
|
462
|
+
function ft(e) {
|
|
463
|
+
return e.type === "bar";
|
|
464
|
+
}
|
|
465
|
+
function Ct(e) {
|
|
466
|
+
return e.type === "band";
|
|
467
|
+
}
|
|
468
|
+
function O(e) {
|
|
469
|
+
return e.type === "linear";
|
|
470
|
+
}
|
|
471
|
+
class St {
|
|
472
|
+
constructor(t) {
|
|
473
|
+
this.parentGroup = t;
|
|
474
|
+
}
|
|
475
|
+
getMaxDimension(t, i) {
|
|
476
|
+
if (!this.parentGroup)
|
|
477
|
+
return {
|
|
478
|
+
width: t.reduce((c, g) => Math.max(g.length, c), 0) * i,
|
|
479
|
+
height: i
|
|
480
|
+
};
|
|
481
|
+
const s = {
|
|
482
|
+
width: 0,
|
|
483
|
+
height: 0
|
|
484
|
+
}, n = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", i);
|
|
485
|
+
for (const c of t) {
|
|
486
|
+
const g = jt(n, 1, c), p = g ? g.width : c.length * i, y = g ? g.height : i;
|
|
487
|
+
s.width = Math.max(s.width, p), s.height = Math.max(s.height, y);
|
|
488
|
+
}
|
|
489
|
+
return n.remove(), s;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
const yt = 0.7, mt = 0.2;
|
|
493
|
+
class _t {
|
|
494
|
+
constructor(t, i, s, n) {
|
|
495
|
+
this.axisConfig = t, this.title = i, this.textDimensionCalculator = s, this.axisThemeConfig = n, this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.axisPosition = "left", this.showTitle = !1, this.showLabel = !1, this.showTick = !1, this.showAxisLine = !1, this.outerPadding = 0, this.titleTextHeight = 0, this.labelTextHeight = 0, this.range = [0, 10], this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.axisPosition = "left";
|
|
496
|
+
}
|
|
497
|
+
setRange(t) {
|
|
498
|
+
this.range = t, this.axisPosition === "left" || this.axisPosition === "right" ? this.boundingRect.height = t[1] - t[0] : this.boundingRect.width = t[1] - t[0], this.recalculateScale();
|
|
499
|
+
}
|
|
500
|
+
getRange() {
|
|
501
|
+
return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
|
|
502
|
+
}
|
|
503
|
+
setAxisPosition(t) {
|
|
504
|
+
this.axisPosition = t, this.setRange(this.range);
|
|
505
|
+
}
|
|
506
|
+
getTickDistance() {
|
|
507
|
+
const t = this.getRange();
|
|
508
|
+
return Math.abs(t[0] - t[1]) / this.getTickValues().length;
|
|
509
|
+
}
|
|
510
|
+
getAxisOuterPadding() {
|
|
511
|
+
return this.outerPadding;
|
|
512
|
+
}
|
|
513
|
+
getLabelDimension() {
|
|
514
|
+
return this.textDimensionCalculator.getMaxDimension(
|
|
515
|
+
this.getTickValues().map((t) => t.toString()),
|
|
516
|
+
this.axisConfig.labelFontSize
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
recalculateOuterPaddingToDrawBar() {
|
|
520
|
+
yt * this.getTickDistance() > this.outerPadding * 2 && (this.outerPadding = Math.floor(yt * this.getTickDistance() / 2)), this.recalculateScale();
|
|
521
|
+
}
|
|
522
|
+
calculateSpaceIfDrawnHorizontally(t) {
|
|
523
|
+
let i = t.height;
|
|
524
|
+
if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
|
|
525
|
+
const s = this.getLabelDimension(), n = mt * t.width;
|
|
526
|
+
this.outerPadding = Math.min(s.width / 2, n);
|
|
527
|
+
const c = s.height + this.axisConfig.labelPadding * 2;
|
|
528
|
+
this.labelTextHeight = s.height, c <= i && (i -= c, this.showLabel = !0);
|
|
529
|
+
}
|
|
530
|
+
if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
|
|
531
|
+
const s = this.textDimensionCalculator.getMaxDimension(
|
|
532
|
+
[this.title],
|
|
533
|
+
this.axisConfig.titleFontSize
|
|
534
|
+
), n = s.height + this.axisConfig.titlePadding * 2;
|
|
535
|
+
this.titleTextHeight = s.height, n <= i && (i -= n, this.showTitle = !0);
|
|
536
|
+
}
|
|
537
|
+
this.boundingRect.width = t.width, this.boundingRect.height = t.height - i;
|
|
538
|
+
}
|
|
539
|
+
calculateSpaceIfDrawnVertical(t) {
|
|
540
|
+
let i = t.width;
|
|
541
|
+
if (this.axisConfig.showAxisLine && i > this.axisConfig.axisLineWidth && (i -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
|
|
542
|
+
const s = this.getLabelDimension(), n = mt * t.height;
|
|
543
|
+
this.outerPadding = Math.min(s.height / 2, n);
|
|
544
|
+
const c = s.width + this.axisConfig.labelPadding * 2;
|
|
545
|
+
c <= i && (i -= c, this.showLabel = !0);
|
|
546
|
+
}
|
|
547
|
+
if (this.axisConfig.showTick && i >= this.axisConfig.tickLength && (this.showTick = !0, i -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
|
|
548
|
+
const s = this.textDimensionCalculator.getMaxDimension(
|
|
549
|
+
[this.title],
|
|
550
|
+
this.axisConfig.titleFontSize
|
|
551
|
+
), n = s.height + this.axisConfig.titlePadding * 2;
|
|
552
|
+
this.titleTextHeight = s.height, n <= i && (i -= n, this.showTitle = !0);
|
|
553
|
+
}
|
|
554
|
+
this.boundingRect.width = t.width - i, this.boundingRect.height = t.height;
|
|
555
|
+
}
|
|
556
|
+
calculateSpace(t) {
|
|
557
|
+
return this.axisPosition === "left" || this.axisPosition === "right" ? this.calculateSpaceIfDrawnVertical(t) : this.calculateSpaceIfDrawnHorizontally(t), this.recalculateScale(), {
|
|
558
|
+
width: this.boundingRect.width,
|
|
559
|
+
height: this.boundingRect.height
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
setBoundingBoxXY(t) {
|
|
563
|
+
this.boundingRect.x = t.x, this.boundingRect.y = t.y;
|
|
564
|
+
}
|
|
565
|
+
getDrawableElementsForLeftAxis() {
|
|
566
|
+
const t = [];
|
|
567
|
+
if (this.showAxisLine) {
|
|
568
|
+
const i = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
|
|
569
|
+
t.push({
|
|
570
|
+
type: "path",
|
|
571
|
+
groupTexts: ["left-axis", "axisl-line"],
|
|
572
|
+
data: [
|
|
573
|
+
{
|
|
574
|
+
path: `M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y + this.boundingRect.height} `,
|
|
575
|
+
strokeFill: this.axisThemeConfig.axisLineColor,
|
|
576
|
+
strokeWidth: this.axisConfig.axisLineWidth
|
|
577
|
+
}
|
|
578
|
+
]
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
if (this.showLabel && t.push({
|
|
582
|
+
type: "text",
|
|
583
|
+
groupTexts: ["left-axis", "label"],
|
|
584
|
+
data: this.getTickValues().map((i) => ({
|
|
585
|
+
text: i.toString(),
|
|
586
|
+
x: this.boundingRect.x + this.boundingRect.width - (this.showLabel ? this.axisConfig.labelPadding : 0) - (this.showTick ? this.axisConfig.tickLength : 0) - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
|
|
587
|
+
y: this.getScaleValue(i),
|
|
588
|
+
fill: this.axisThemeConfig.labelColor,
|
|
589
|
+
fontSize: this.axisConfig.labelFontSize,
|
|
590
|
+
rotation: 0,
|
|
591
|
+
verticalPos: "middle",
|
|
592
|
+
horizontalPos: "right"
|
|
593
|
+
}))
|
|
594
|
+
}), this.showTick) {
|
|
595
|
+
const i = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
|
|
596
|
+
t.push({
|
|
597
|
+
type: "path",
|
|
598
|
+
groupTexts: ["left-axis", "ticks"],
|
|
599
|
+
data: this.getTickValues().map((s) => ({
|
|
600
|
+
path: `M ${i},${this.getScaleValue(s)} L ${i - this.axisConfig.tickLength},${this.getScaleValue(s)}`,
|
|
601
|
+
strokeFill: this.axisThemeConfig.tickColor,
|
|
602
|
+
strokeWidth: this.axisConfig.tickWidth
|
|
603
|
+
}))
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
return this.showTitle && t.push({
|
|
607
|
+
type: "text",
|
|
608
|
+
groupTexts: ["left-axis", "title"],
|
|
609
|
+
data: [
|
|
610
|
+
{
|
|
611
|
+
text: this.title,
|
|
612
|
+
x: this.boundingRect.x + this.axisConfig.titlePadding,
|
|
613
|
+
y: this.boundingRect.y + this.boundingRect.height / 2,
|
|
614
|
+
fill: this.axisThemeConfig.titleColor,
|
|
615
|
+
fontSize: this.axisConfig.titleFontSize,
|
|
616
|
+
rotation: 270,
|
|
617
|
+
verticalPos: "top",
|
|
618
|
+
horizontalPos: "center"
|
|
619
|
+
}
|
|
620
|
+
]
|
|
621
|
+
}), t;
|
|
622
|
+
}
|
|
623
|
+
getDrawableElementsForBottomAxis() {
|
|
624
|
+
const t = [];
|
|
625
|
+
if (this.showAxisLine) {
|
|
626
|
+
const i = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
|
|
627
|
+
t.push({
|
|
628
|
+
type: "path",
|
|
629
|
+
groupTexts: ["bottom-axis", "axis-line"],
|
|
630
|
+
data: [
|
|
631
|
+
{
|
|
632
|
+
path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
|
|
633
|
+
strokeFill: this.axisThemeConfig.axisLineColor,
|
|
634
|
+
strokeWidth: this.axisConfig.axisLineWidth
|
|
635
|
+
}
|
|
636
|
+
]
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
if (this.showLabel && t.push({
|
|
640
|
+
type: "text",
|
|
641
|
+
groupTexts: ["bottom-axis", "label"],
|
|
642
|
+
data: this.getTickValues().map((i) => ({
|
|
643
|
+
text: i.toString(),
|
|
644
|
+
x: this.getScaleValue(i),
|
|
645
|
+
y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
|
|
646
|
+
fill: this.axisThemeConfig.labelColor,
|
|
647
|
+
fontSize: this.axisConfig.labelFontSize,
|
|
648
|
+
rotation: 0,
|
|
649
|
+
verticalPos: "top",
|
|
650
|
+
horizontalPos: "center"
|
|
651
|
+
}))
|
|
652
|
+
}), this.showTick) {
|
|
653
|
+
const i = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
|
|
654
|
+
t.push({
|
|
655
|
+
type: "path",
|
|
656
|
+
groupTexts: ["bottom-axis", "ticks"],
|
|
657
|
+
data: this.getTickValues().map((s) => ({
|
|
658
|
+
path: `M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i + this.axisConfig.tickLength}`,
|
|
659
|
+
strokeFill: this.axisThemeConfig.tickColor,
|
|
660
|
+
strokeWidth: this.axisConfig.tickWidth
|
|
661
|
+
}))
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
return this.showTitle && t.push({
|
|
665
|
+
type: "text",
|
|
666
|
+
groupTexts: ["bottom-axis", "title"],
|
|
667
|
+
data: [
|
|
668
|
+
{
|
|
669
|
+
text: this.title,
|
|
670
|
+
x: this.range[0] + (this.range[1] - this.range[0]) / 2,
|
|
671
|
+
y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
|
|
672
|
+
fill: this.axisThemeConfig.titleColor,
|
|
673
|
+
fontSize: this.axisConfig.titleFontSize,
|
|
674
|
+
rotation: 0,
|
|
675
|
+
verticalPos: "top",
|
|
676
|
+
horizontalPos: "center"
|
|
677
|
+
}
|
|
678
|
+
]
|
|
679
|
+
}), t;
|
|
680
|
+
}
|
|
681
|
+
getDrawableElementsForTopAxis() {
|
|
682
|
+
const t = [];
|
|
683
|
+
if (this.showAxisLine) {
|
|
684
|
+
const i = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
|
|
685
|
+
t.push({
|
|
686
|
+
type: "path",
|
|
687
|
+
groupTexts: ["top-axis", "axis-line"],
|
|
688
|
+
data: [
|
|
689
|
+
{
|
|
690
|
+
path: `M ${this.boundingRect.x},${i} L ${this.boundingRect.x + this.boundingRect.width},${i}`,
|
|
691
|
+
strokeFill: this.axisThemeConfig.axisLineColor,
|
|
692
|
+
strokeWidth: this.axisConfig.axisLineWidth
|
|
693
|
+
}
|
|
694
|
+
]
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
if (this.showLabel && t.push({
|
|
698
|
+
type: "text",
|
|
699
|
+
groupTexts: ["top-axis", "label"],
|
|
700
|
+
data: this.getTickValues().map((i) => ({
|
|
701
|
+
text: i.toString(),
|
|
702
|
+
x: this.getScaleValue(i),
|
|
703
|
+
y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
|
|
704
|
+
fill: this.axisThemeConfig.labelColor,
|
|
705
|
+
fontSize: this.axisConfig.labelFontSize,
|
|
706
|
+
rotation: 0,
|
|
707
|
+
verticalPos: "top",
|
|
708
|
+
horizontalPos: "center"
|
|
709
|
+
}))
|
|
710
|
+
}), this.showTick) {
|
|
711
|
+
const i = this.boundingRect.y;
|
|
712
|
+
t.push({
|
|
713
|
+
type: "path",
|
|
714
|
+
groupTexts: ["top-axis", "ticks"],
|
|
715
|
+
data: this.getTickValues().map((s) => ({
|
|
716
|
+
path: `M ${this.getScaleValue(s)},${i + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(s)},${i + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
|
|
717
|
+
strokeFill: this.axisThemeConfig.tickColor,
|
|
718
|
+
strokeWidth: this.axisConfig.tickWidth
|
|
719
|
+
}))
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
return this.showTitle && t.push({
|
|
723
|
+
type: "text",
|
|
724
|
+
groupTexts: ["top-axis", "title"],
|
|
725
|
+
data: [
|
|
726
|
+
{
|
|
727
|
+
text: this.title,
|
|
728
|
+
x: this.boundingRect.x + this.boundingRect.width / 2,
|
|
729
|
+
y: this.boundingRect.y + this.axisConfig.titlePadding,
|
|
730
|
+
fill: this.axisThemeConfig.titleColor,
|
|
731
|
+
fontSize: this.axisConfig.titleFontSize,
|
|
732
|
+
rotation: 0,
|
|
733
|
+
verticalPos: "top",
|
|
734
|
+
horizontalPos: "center"
|
|
735
|
+
}
|
|
736
|
+
]
|
|
737
|
+
}), t;
|
|
738
|
+
}
|
|
739
|
+
getDrawableElements() {
|
|
740
|
+
if (this.axisPosition === "left")
|
|
741
|
+
return this.getDrawableElementsForLeftAxis();
|
|
742
|
+
if (this.axisPosition === "right")
|
|
743
|
+
throw Error("Drawing of right axis is not implemented");
|
|
744
|
+
return this.axisPosition === "bottom" ? this.getDrawableElementsForBottomAxis() : this.axisPosition === "top" ? this.getDrawableElementsForTopAxis() : [];
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
class Zt extends _t {
|
|
748
|
+
constructor(t, i, s, n, c) {
|
|
749
|
+
super(t, n, c, i), this.categories = s, this.scale = xt().domain(this.categories).range(this.getRange());
|
|
750
|
+
}
|
|
751
|
+
setRange(t) {
|
|
752
|
+
super.setRange(t);
|
|
753
|
+
}
|
|
754
|
+
recalculateScale() {
|
|
755
|
+
this.scale = xt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5), wt.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
|
|
756
|
+
}
|
|
757
|
+
getTickValues() {
|
|
758
|
+
return this.categories;
|
|
759
|
+
}
|
|
760
|
+
getScaleValue(t) {
|
|
761
|
+
return this.scale(t) || this.getRange()[0];
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
class qt extends _t {
|
|
765
|
+
constructor(t, i, s, n, c) {
|
|
766
|
+
super(t, n, c, i), this.domain = s, this.scale = dt().domain(this.domain).range(this.getRange());
|
|
767
|
+
}
|
|
768
|
+
getTickValues() {
|
|
769
|
+
return this.scale.ticks();
|
|
770
|
+
}
|
|
771
|
+
recalculateScale() {
|
|
772
|
+
const t = [...this.domain];
|
|
773
|
+
this.axisPosition === "left" && t.reverse(), this.scale = dt().domain(t).range(this.getRange());
|
|
774
|
+
}
|
|
775
|
+
getScaleValue(t) {
|
|
776
|
+
return this.scale(t);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
function bt(e, t, i, s) {
|
|
780
|
+
const n = new St(s);
|
|
781
|
+
return Ct(e) ? new Zt(
|
|
782
|
+
t,
|
|
783
|
+
i,
|
|
784
|
+
e.categories,
|
|
785
|
+
e.title,
|
|
786
|
+
n
|
|
787
|
+
) : new qt(
|
|
788
|
+
t,
|
|
789
|
+
i,
|
|
790
|
+
[e.min, e.max],
|
|
791
|
+
e.title,
|
|
792
|
+
n
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
class Jt {
|
|
796
|
+
constructor(t, i, s, n) {
|
|
797
|
+
this.textDimensionCalculator = t, this.chartConfig = i, this.chartData = s, this.chartThemeConfig = n, this.boundingRect = {
|
|
798
|
+
x: 0,
|
|
799
|
+
y: 0,
|
|
800
|
+
width: 0,
|
|
801
|
+
height: 0
|
|
802
|
+
}, this.showChartTitle = !1;
|
|
803
|
+
}
|
|
804
|
+
setBoundingBoxXY(t) {
|
|
805
|
+
this.boundingRect.x = t.x, this.boundingRect.y = t.y;
|
|
806
|
+
}
|
|
807
|
+
calculateSpace(t) {
|
|
808
|
+
const i = this.textDimensionCalculator.getMaxDimension(
|
|
809
|
+
[this.chartData.title],
|
|
810
|
+
this.chartConfig.titleFontSize
|
|
811
|
+
), s = Math.max(i.width, t.width), n = i.height + 2 * this.chartConfig.titlePadding;
|
|
812
|
+
return i.width <= s && i.height <= n && this.chartConfig.showTitle && this.chartData.title && (this.boundingRect.width = s, this.boundingRect.height = n, this.showChartTitle = !0), {
|
|
813
|
+
width: this.boundingRect.width,
|
|
814
|
+
height: this.boundingRect.height
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
getDrawableElements() {
|
|
818
|
+
const t = [];
|
|
819
|
+
return this.showChartTitle && t.push({
|
|
820
|
+
groupTexts: ["chart-title"],
|
|
821
|
+
type: "text",
|
|
822
|
+
data: [
|
|
823
|
+
{
|
|
824
|
+
fontSize: this.chartConfig.titleFontSize,
|
|
825
|
+
text: this.chartData.title,
|
|
826
|
+
verticalPos: "middle",
|
|
827
|
+
horizontalPos: "center",
|
|
828
|
+
x: this.boundingRect.x + this.boundingRect.width / 2,
|
|
829
|
+
y: this.boundingRect.y + this.boundingRect.height / 2,
|
|
830
|
+
fill: this.chartThemeConfig.titleColor,
|
|
831
|
+
rotation: 0
|
|
832
|
+
}
|
|
833
|
+
]
|
|
834
|
+
}), t;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
function ti(e, t, i, s) {
|
|
838
|
+
const n = new St(s);
|
|
839
|
+
return new Jt(n, e, t, i);
|
|
840
|
+
}
|
|
841
|
+
class ii {
|
|
842
|
+
constructor(t, i, s, n, c) {
|
|
843
|
+
this.plotData = t, this.xAxis = i, this.yAxis = s, this.orientation = n, this.plotIndex = c;
|
|
844
|
+
}
|
|
845
|
+
getDrawableElement() {
|
|
846
|
+
const t = this.plotData.data.map((s) => [
|
|
847
|
+
this.xAxis.getScaleValue(s[0]),
|
|
848
|
+
this.yAxis.getScaleValue(s[1])
|
|
849
|
+
]);
|
|
850
|
+
let i;
|
|
851
|
+
return this.orientation === "horizontal" ? i = pt().y((s) => s[0]).x((s) => s[1])(t) : i = pt().x((s) => s[0]).y((s) => s[1])(t), i ? [
|
|
852
|
+
{
|
|
853
|
+
groupTexts: ["plot", `line-plot-${this.plotIndex}`],
|
|
854
|
+
type: "path",
|
|
855
|
+
data: [
|
|
856
|
+
{
|
|
857
|
+
path: i,
|
|
858
|
+
strokeFill: this.plotData.strokeFill,
|
|
859
|
+
strokeWidth: this.plotData.strokeWidth
|
|
860
|
+
}
|
|
861
|
+
]
|
|
862
|
+
}
|
|
863
|
+
] : [];
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
class ei {
|
|
867
|
+
constructor(t, i, s, n, c, g) {
|
|
868
|
+
this.barData = t, this.boundingRect = i, this.xAxis = s, this.yAxis = n, this.orientation = c, this.plotIndex = g;
|
|
869
|
+
}
|
|
870
|
+
getDrawableElement() {
|
|
871
|
+
const t = this.barData.data.map((n) => [
|
|
872
|
+
this.xAxis.getScaleValue(n[0]),
|
|
873
|
+
this.yAxis.getScaleValue(n[1])
|
|
874
|
+
]), i = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - 0.05), s = i / 2;
|
|
875
|
+
return this.orientation === "horizontal" ? [
|
|
876
|
+
{
|
|
877
|
+
groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
|
|
878
|
+
type: "rect",
|
|
879
|
+
data: t.map((n) => ({
|
|
880
|
+
x: this.boundingRect.x,
|
|
881
|
+
y: n[0] - s,
|
|
882
|
+
height: i,
|
|
883
|
+
width: n[1] - this.boundingRect.x,
|
|
884
|
+
fill: this.barData.fill,
|
|
885
|
+
strokeWidth: 0,
|
|
886
|
+
strokeFill: this.barData.fill
|
|
887
|
+
}))
|
|
888
|
+
}
|
|
889
|
+
] : [
|
|
890
|
+
{
|
|
891
|
+
groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
|
|
892
|
+
type: "rect",
|
|
893
|
+
data: t.map((n) => ({
|
|
894
|
+
x: n[0] - s,
|
|
895
|
+
y: n[1],
|
|
896
|
+
width: i,
|
|
897
|
+
height: this.boundingRect.y + this.boundingRect.height - n[1],
|
|
898
|
+
fill: this.barData.fill,
|
|
899
|
+
strokeWidth: 0,
|
|
900
|
+
strokeFill: this.barData.fill
|
|
901
|
+
}))
|
|
902
|
+
}
|
|
903
|
+
];
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
class si {
|
|
907
|
+
constructor(t, i, s) {
|
|
908
|
+
this.chartConfig = t, this.chartData = i, this.chartThemeConfig = s, this.boundingRect = {
|
|
909
|
+
x: 0,
|
|
910
|
+
y: 0,
|
|
911
|
+
width: 0,
|
|
912
|
+
height: 0
|
|
913
|
+
};
|
|
914
|
+
}
|
|
915
|
+
setAxes(t, i) {
|
|
916
|
+
this.xAxis = t, this.yAxis = i;
|
|
917
|
+
}
|
|
918
|
+
setBoundingBoxXY(t) {
|
|
919
|
+
this.boundingRect.x = t.x, this.boundingRect.y = t.y;
|
|
920
|
+
}
|
|
921
|
+
calculateSpace(t) {
|
|
922
|
+
return this.boundingRect.width = t.width, this.boundingRect.height = t.height, {
|
|
923
|
+
width: this.boundingRect.width,
|
|
924
|
+
height: this.boundingRect.height
|
|
925
|
+
};
|
|
926
|
+
}
|
|
927
|
+
getDrawableElements() {
|
|
928
|
+
if (!(this.xAxis && this.yAxis))
|
|
929
|
+
throw Error("Axes must be passed to render Plots");
|
|
930
|
+
const t = [];
|
|
931
|
+
for (const [i, s] of this.chartData.plots.entries())
|
|
932
|
+
switch (s.type) {
|
|
933
|
+
case "line":
|
|
934
|
+
{
|
|
935
|
+
const n = new ii(
|
|
936
|
+
s,
|
|
937
|
+
this.xAxis,
|
|
938
|
+
this.yAxis,
|
|
939
|
+
this.chartConfig.chartOrientation,
|
|
940
|
+
i
|
|
941
|
+
);
|
|
942
|
+
t.push(...n.getDrawableElement());
|
|
943
|
+
}
|
|
944
|
+
break;
|
|
945
|
+
case "bar":
|
|
946
|
+
{
|
|
947
|
+
const n = new ei(
|
|
948
|
+
s,
|
|
949
|
+
this.boundingRect,
|
|
950
|
+
this.xAxis,
|
|
951
|
+
this.yAxis,
|
|
952
|
+
this.chartConfig.chartOrientation,
|
|
953
|
+
i
|
|
954
|
+
);
|
|
955
|
+
t.push(...n.getDrawableElement());
|
|
956
|
+
}
|
|
957
|
+
break;
|
|
958
|
+
}
|
|
959
|
+
return t;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
function ni(e, t, i) {
|
|
963
|
+
return new si(e, t, i);
|
|
964
|
+
}
|
|
965
|
+
class ai {
|
|
966
|
+
constructor(t, i, s, n) {
|
|
967
|
+
this.chartConfig = t, this.chartData = i, this.componentStore = {
|
|
968
|
+
title: ti(t, i, s, n),
|
|
969
|
+
plot: ni(t, i, s),
|
|
970
|
+
xAxis: bt(
|
|
971
|
+
i.xAxis,
|
|
972
|
+
t.xAxis,
|
|
973
|
+
{
|
|
974
|
+
titleColor: s.xAxisTitleColor,
|
|
975
|
+
labelColor: s.xAxisLabelColor,
|
|
976
|
+
tickColor: s.xAxisTickColor,
|
|
977
|
+
axisLineColor: s.xAxisLineColor
|
|
978
|
+
},
|
|
979
|
+
n
|
|
980
|
+
),
|
|
981
|
+
yAxis: bt(
|
|
982
|
+
i.yAxis,
|
|
983
|
+
t.yAxis,
|
|
984
|
+
{
|
|
985
|
+
titleColor: s.yAxisTitleColor,
|
|
986
|
+
labelColor: s.yAxisLabelColor,
|
|
987
|
+
tickColor: s.yAxisTickColor,
|
|
988
|
+
axisLineColor: s.yAxisLineColor
|
|
989
|
+
},
|
|
990
|
+
n
|
|
991
|
+
)
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
calculateVerticalSpace() {
|
|
995
|
+
let t = this.chartConfig.width, i = this.chartConfig.height, s = 0, n = 0, c = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), g = Math.floor(
|
|
996
|
+
i * this.chartConfig.plotReservedSpacePercent / 100
|
|
997
|
+
), p = this.componentStore.plot.calculateSpace({
|
|
998
|
+
width: c,
|
|
999
|
+
height: g
|
|
1000
|
+
});
|
|
1001
|
+
t -= p.width, i -= p.height, p = this.componentStore.title.calculateSpace({
|
|
1002
|
+
width: this.chartConfig.width,
|
|
1003
|
+
height: i
|
|
1004
|
+
}), n = p.height, i -= p.height, this.componentStore.xAxis.setAxisPosition("bottom"), p = this.componentStore.xAxis.calculateSpace({
|
|
1005
|
+
width: t,
|
|
1006
|
+
height: i
|
|
1007
|
+
}), i -= p.height, this.componentStore.yAxis.setAxisPosition("left"), p = this.componentStore.yAxis.calculateSpace({
|
|
1008
|
+
width: t,
|
|
1009
|
+
height: i
|
|
1010
|
+
}), s = p.width, t -= p.width, t > 0 && (c += t, t = 0), i > 0 && (g += i, i = 0), this.componentStore.plot.calculateSpace({
|
|
1011
|
+
width: c,
|
|
1012
|
+
height: g
|
|
1013
|
+
}), this.componentStore.plot.setBoundingBoxXY({ x: s, y: n }), this.componentStore.xAxis.setRange([s, s + c]), this.componentStore.xAxis.setBoundingBoxXY({ x: s, y: n + g }), this.componentStore.yAxis.setRange([n, n + g]), this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: n }), this.chartData.plots.some((y) => ft(y)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
|
|
1014
|
+
}
|
|
1015
|
+
calculateHorizontalSpace() {
|
|
1016
|
+
let t = this.chartConfig.width, i = this.chartConfig.height, s = 0, n = 0, c = 0, g = Math.floor(t * this.chartConfig.plotReservedSpacePercent / 100), p = Math.floor(
|
|
1017
|
+
i * this.chartConfig.plotReservedSpacePercent / 100
|
|
1018
|
+
), y = this.componentStore.plot.calculateSpace({
|
|
1019
|
+
width: g,
|
|
1020
|
+
height: p
|
|
1021
|
+
});
|
|
1022
|
+
t -= y.width, i -= y.height, y = this.componentStore.title.calculateSpace({
|
|
1023
|
+
width: this.chartConfig.width,
|
|
1024
|
+
height: i
|
|
1025
|
+
}), s = y.height, i -= y.height, this.componentStore.xAxis.setAxisPosition("left"), y = this.componentStore.xAxis.calculateSpace({
|
|
1026
|
+
width: t,
|
|
1027
|
+
height: i
|
|
1028
|
+
}), t -= y.width, n = y.width, this.componentStore.yAxis.setAxisPosition("top"), y = this.componentStore.yAxis.calculateSpace({
|
|
1029
|
+
width: t,
|
|
1030
|
+
height: i
|
|
1031
|
+
}), i -= y.height, c = s + y.height, t > 0 && (g += t, t = 0), i > 0 && (p += i, i = 0), this.componentStore.plot.calculateSpace({
|
|
1032
|
+
width: g,
|
|
1033
|
+
height: p
|
|
1034
|
+
}), this.componentStore.plot.setBoundingBoxXY({ x: n, y: c }), this.componentStore.yAxis.setRange([n, n + g]), this.componentStore.yAxis.setBoundingBoxXY({ x: n, y: s }), this.componentStore.xAxis.setRange([c, c + p]), this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: c }), this.chartData.plots.some((D) => ft(D)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
|
|
1035
|
+
}
|
|
1036
|
+
calculateSpace() {
|
|
1037
|
+
this.chartConfig.chartOrientation === "horizontal" ? this.calculateHorizontalSpace() : this.calculateVerticalSpace();
|
|
1038
|
+
}
|
|
1039
|
+
getDrawableElement() {
|
|
1040
|
+
this.calculateSpace();
|
|
1041
|
+
const t = [];
|
|
1042
|
+
this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
|
|
1043
|
+
for (const i of Object.values(this.componentStore))
|
|
1044
|
+
t.push(...i.getDrawableElements());
|
|
1045
|
+
return t;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
class hi {
|
|
1049
|
+
static build(t, i, s, n) {
|
|
1050
|
+
return new ai(t, i, s, n).getDrawableElement();
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
let B = 0, Tt, X = Lt(), V = Rt(), x = Dt(), st = V.plotColorPalette.split(",").map((e) => e.trim()), Q = !1, at = !1;
|
|
1054
|
+
function Rt() {
|
|
1055
|
+
const e = Gt(), t = nt();
|
|
1056
|
+
return kt(e.xyChart, t.themeVariables.xyChart);
|
|
1057
|
+
}
|
|
1058
|
+
function Lt() {
|
|
1059
|
+
const e = nt();
|
|
1060
|
+
return kt(
|
|
1061
|
+
Ht.xyChart,
|
|
1062
|
+
e.xyChart
|
|
1063
|
+
);
|
|
1064
|
+
}
|
|
1065
|
+
function Dt() {
|
|
1066
|
+
return {
|
|
1067
|
+
yAxis: {
|
|
1068
|
+
type: "linear",
|
|
1069
|
+
title: "",
|
|
1070
|
+
min: 1 / 0,
|
|
1071
|
+
max: -1 / 0
|
|
1072
|
+
},
|
|
1073
|
+
xAxis: {
|
|
1074
|
+
type: "band",
|
|
1075
|
+
title: "",
|
|
1076
|
+
categories: []
|
|
1077
|
+
},
|
|
1078
|
+
title: "",
|
|
1079
|
+
plots: []
|
|
1080
|
+
};
|
|
1081
|
+
}
|
|
1082
|
+
function ht(e) {
|
|
1083
|
+
const t = nt();
|
|
1084
|
+
return Qt(e.trim(), t);
|
|
1085
|
+
}
|
|
1086
|
+
function oi(e) {
|
|
1087
|
+
Tt = e;
|
|
1088
|
+
}
|
|
1089
|
+
function ri(e) {
|
|
1090
|
+
e === "horizontal" ? X.chartOrientation = "horizontal" : X.chartOrientation = "vertical";
|
|
1091
|
+
}
|
|
1092
|
+
function li(e) {
|
|
1093
|
+
x.xAxis.title = ht(e.text);
|
|
1094
|
+
}
|
|
1095
|
+
function Pt(e, t) {
|
|
1096
|
+
x.xAxis = { type: "linear", title: x.xAxis.title, min: e, max: t }, Q = !0;
|
|
1097
|
+
}
|
|
1098
|
+
function ci(e) {
|
|
1099
|
+
x.xAxis = {
|
|
1100
|
+
type: "band",
|
|
1101
|
+
title: x.xAxis.title,
|
|
1102
|
+
categories: e.map((t) => ht(t.text))
|
|
1103
|
+
}, Q = !0;
|
|
1104
|
+
}
|
|
1105
|
+
function gi(e) {
|
|
1106
|
+
x.yAxis.title = ht(e.text);
|
|
1107
|
+
}
|
|
1108
|
+
function ui(e, t) {
|
|
1109
|
+
x.yAxis = { type: "linear", title: x.yAxis.title, min: e, max: t }, at = !0;
|
|
1110
|
+
}
|
|
1111
|
+
function xi(e) {
|
|
1112
|
+
const t = Math.min(...e), i = Math.max(...e), s = O(x.yAxis) ? x.yAxis.min : 1 / 0, n = O(x.yAxis) ? x.yAxis.max : -1 / 0;
|
|
1113
|
+
x.yAxis = {
|
|
1114
|
+
type: "linear",
|
|
1115
|
+
title: x.yAxis.title,
|
|
1116
|
+
min: Math.min(s, t),
|
|
1117
|
+
max: Math.max(n, i)
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
function vt(e) {
|
|
1121
|
+
let t = [];
|
|
1122
|
+
if (e.length === 0)
|
|
1123
|
+
return t;
|
|
1124
|
+
if (!Q) {
|
|
1125
|
+
const i = O(x.xAxis) ? x.xAxis.min : 1 / 0, s = O(x.xAxis) ? x.xAxis.max : -1 / 0;
|
|
1126
|
+
Pt(Math.min(i, 1), Math.max(s, e.length));
|
|
1127
|
+
}
|
|
1128
|
+
if (at || xi(e), Ct(x.xAxis) && (t = x.xAxis.categories.map((i, s) => [i, e[s]])), O(x.xAxis)) {
|
|
1129
|
+
const i = x.xAxis.min, s = x.xAxis.max, n = (s - i + 1) / e.length, c = [];
|
|
1130
|
+
for (let g = i; g <= s; g += n)
|
|
1131
|
+
c.push(`${g}`);
|
|
1132
|
+
t = c.map((g, p) => [g, e[p]]);
|
|
1133
|
+
}
|
|
1134
|
+
return t;
|
|
1135
|
+
}
|
|
1136
|
+
function Et(e) {
|
|
1137
|
+
return st[e === 0 ? 0 : e % st.length];
|
|
1138
|
+
}
|
|
1139
|
+
function di(e, t) {
|
|
1140
|
+
const i = vt(t);
|
|
1141
|
+
x.plots.push({
|
|
1142
|
+
type: "line",
|
|
1143
|
+
strokeFill: Et(B),
|
|
1144
|
+
strokeWidth: 2,
|
|
1145
|
+
data: i
|
|
1146
|
+
}), B++;
|
|
1147
|
+
}
|
|
1148
|
+
function pi(e, t) {
|
|
1149
|
+
const i = vt(t);
|
|
1150
|
+
x.plots.push({
|
|
1151
|
+
type: "bar",
|
|
1152
|
+
fill: Et(B),
|
|
1153
|
+
data: i
|
|
1154
|
+
}), B++;
|
|
1155
|
+
}
|
|
1156
|
+
function fi() {
|
|
1157
|
+
if (x.plots.length === 0)
|
|
1158
|
+
throw Error("No Plot to render, please provide a plot with some data");
|
|
1159
|
+
return x.title = At(), hi.build(X, x, V, Tt);
|
|
1160
|
+
}
|
|
1161
|
+
function yi() {
|
|
1162
|
+
return V;
|
|
1163
|
+
}
|
|
1164
|
+
function mi() {
|
|
1165
|
+
return X;
|
|
1166
|
+
}
|
|
1167
|
+
const bi = function() {
|
|
1168
|
+
Yt(), B = 0, X = Lt(), x = Dt(), V = Rt(), st = V.plotColorPalette.split(",").map((e) => e.trim()), Q = !1, at = !1;
|
|
1169
|
+
}, Ai = {
|
|
1170
|
+
getDrawableElem: fi,
|
|
1171
|
+
clear: bi,
|
|
1172
|
+
setAccTitle: Xt,
|
|
1173
|
+
getAccTitle: Bt,
|
|
1174
|
+
setDiagramTitle: Ot,
|
|
1175
|
+
getDiagramTitle: At,
|
|
1176
|
+
getAccDescription: Nt,
|
|
1177
|
+
setAccDescription: Ft,
|
|
1178
|
+
setOrientation: ri,
|
|
1179
|
+
setXAxisTitle: li,
|
|
1180
|
+
setXAxisRangeData: Pt,
|
|
1181
|
+
setXAxisBand: ci,
|
|
1182
|
+
setYAxisTitle: gi,
|
|
1183
|
+
setYAxisRangeData: ui,
|
|
1184
|
+
setLineData: di,
|
|
1185
|
+
setBarData: pi,
|
|
1186
|
+
setTmpSVGG: oi,
|
|
1187
|
+
getChartThemeConfig: yi,
|
|
1188
|
+
getChartConfig: mi
|
|
1189
|
+
}, wi = (e, t, i, s) => {
|
|
1190
|
+
const n = s.db, c = n.getChartThemeConfig(), g = n.getChartConfig();
|
|
1191
|
+
function p(d) {
|
|
1192
|
+
return d === "top" ? "text-before-edge" : "middle";
|
|
1193
|
+
}
|
|
1194
|
+
function y(d) {
|
|
1195
|
+
return d === "left" ? "start" : d === "right" ? "end" : "middle";
|
|
1196
|
+
}
|
|
1197
|
+
function D(d) {
|
|
1198
|
+
return `translate(${d.x}, ${d.y}) rotate(${d.rotation || 0})`;
|
|
1199
|
+
}
|
|
1200
|
+
wt.debug(`Rendering xychart chart
|
|
1201
|
+
` + e);
|
|
1202
|
+
const C = Vt(t), _ = C.append("g").attr("class", "main"), P = _.append("rect").attr("width", g.width).attr("height", g.height).attr("class", "background");
|
|
1203
|
+
Ut(C, g.height, g.width, !0), C.attr("viewBox", `0 0 ${g.width} ${g.height}`), P.attr("fill", c.backgroundColor), n.setTmpSVGG(C.append("g").attr("class", "mermaid-tmp-group"));
|
|
1204
|
+
const v = n.getDrawableElem(), S = {};
|
|
1205
|
+
function E(d) {
|
|
1206
|
+
let A = _, o = "";
|
|
1207
|
+
for (const [T] of d.entries()) {
|
|
1208
|
+
let N = _;
|
|
1209
|
+
T > 0 && S[o] && (N = S[o]), o += d[T], A = S[o], A || (A = S[o] = N.append("g").attr("class", d[T]));
|
|
1210
|
+
}
|
|
1211
|
+
return A;
|
|
1212
|
+
}
|
|
1213
|
+
for (const d of v) {
|
|
1214
|
+
if (d.data.length === 0)
|
|
1215
|
+
continue;
|
|
1216
|
+
const A = E(d.groupTexts);
|
|
1217
|
+
switch (d.type) {
|
|
1218
|
+
case "rect":
|
|
1219
|
+
A.selectAll("rect").data(d.data).enter().append("rect").attr("x", (o) => o.x).attr("y", (o) => o.y).attr("width", (o) => o.width).attr("height", (o) => o.height).attr("fill", (o) => o.fill).attr("stroke", (o) => o.strokeFill).attr("stroke-width", (o) => o.strokeWidth);
|
|
1220
|
+
break;
|
|
1221
|
+
case "text":
|
|
1222
|
+
A.selectAll("text").data(d.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (o) => o.fill).attr("font-size", (o) => o.fontSize).attr("dominant-baseline", (o) => p(o.verticalPos)).attr("text-anchor", (o) => y(o.horizontalPos)).attr("transform", (o) => D(o)).text((o) => o.text);
|
|
1223
|
+
break;
|
|
1224
|
+
case "path":
|
|
1225
|
+
A.selectAll("path").data(d.data).enter().append("path").attr("d", (o) => o.path).attr("fill", (o) => o.fill ? o.fill : "none").attr("stroke", (o) => o.strokeFill).attr("stroke-width", (o) => o.strokeWidth);
|
|
1226
|
+
break;
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}, ki = {
|
|
1230
|
+
draw: wi
|
|
1231
|
+
}, _i = {
|
|
1232
|
+
parser: Kt,
|
|
1233
|
+
db: Ai,
|
|
1234
|
+
renderer: ki
|
|
1235
|
+
};
|
|
1236
|
+
export {
|
|
1237
|
+
_i as diagram
|
|
1238
|
+
};
|