@8btc/xcanvas 0.0.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/README.md +70 -0
- package/dist/Tableau10-BqnYsPR6.js +9 -0
- package/dist/XCanvas-BxdLBkBz.js +27732 -0
- package/dist/_commonjs-dynamic-modules-TGKdzP3c.js +6 -0
- package/dist/ar-SA-G6X2FPQ2-DjqDLLYL.js +41 -0
- package/dist/arc-D1qX5GFf.js +132 -0
- package/dist/array-DgktLKBx.js +6 -0
- package/dist/az-AZ-76LH7QW2-D7LOsF3_.js +32 -0
- package/dist/bg-BG-XCXSNQG7-WI4tFn23.js +36 -0
- package/dist/blockDiagram-38ab4fdb-DtemKfEh.js +1811 -0
- package/dist/bn-BD-2XOGV67Q-Bugx_8fy.js +36 -0
- package/dist/c4Diagram-3d4e48cf-Byd2vU9K.js +2463 -0
- package/dist/ca-ES-6MX7JW3Y-6rFwKGsQ.js +39 -0
- package/dist/channel-BT_3Ze-Y.js +7 -0
- package/dist/chunk-EIO257PC-C7qD7hGu.js +1641 -0
- package/dist/classDiagram-70f12bd4-CwfYadk-.js +354 -0
- package/dist/classDiagram-v2-f2320105-B28MuM8f.js +284 -0
- package/dist/clone-D2FUK8WY.js +8 -0
- package/dist/createText-2e5e7dd3-Ca1JfQaJ.js +4914 -0
- package/dist/cs-CZ-2BRQDIVT-Dhd8XszK.js +42 -0
- package/dist/da-DK-5WZEPLOC-BhL87sSs.js +36 -0
- package/dist/de-DE-XR44H4JA-xSrZSV0J.js +39 -0
- package/dist/directory-open-01563666-XowynPwH.js +14 -0
- package/dist/directory-open-4ed118d0-BwYbu9dw.js +55 -0
- package/dist/edges-e0da2a9e-9VbVapWU.js +1840 -0
- package/dist/el-GR-BZB4AONW-DQORZ_pY.js +41 -0
- package/dist/en-B4ZKOASM-D2BVbEdz.js +39 -0
- package/dist/erDiagram-9861fffd-D4S9QDes.js +1318 -0
- package/dist/es-ES-U4NZUMDT-C0Q89-0V.js +40 -0
- package/dist/eu-ES-A7QVB2H4-BwBW3cEw.js +42 -0
- package/dist/fa-IR-HGAKTJCU-DtZ74rm4.js +39 -0
- package/dist/fi-FI-Z5N7JZ37-QvQan48z.js +37 -0
- package/dist/file-open-002ab408-BNIYSKAV.js +18 -0
- package/dist/file-open-7c801643-B_l1UXdI.js +15 -0
- package/dist/file-save-3189631c-vzijizFw.js +23 -0
- package/dist/file-save-745eba88-B5-wM56X.js +25 -0
- package/dist/flowDb-956e92f1-S6T8ppJw.js +1713 -0
- package/dist/flowDiagram-66a62f08-C6TTwS5_.js +1264 -0
- package/dist/flowDiagram-v2-96b9c2cf-CzfeUNGP.js +24 -0
- package/dist/flowchart-elk-definition-4a651766-CRv1kWtk.js +92922 -0
- package/dist/fr-FR-RHASNOE6-CZFiweNU.js +40 -0
- package/dist/ganttDiagram-c361ad54-CAnfd8Sw.js +3420 -0
- package/dist/gitGraphDiagram-72cf32ee-CSGI-xRI.js +1790 -0
- package/dist/gl-ES-HMX3MZ6V-Bqv2xL-V.js +41 -0
- package/dist/graph-Ct2tKpKj.js +1253 -0
- package/dist/he-IL-6SHJWFNN-kso30jhn.js +41 -0
- package/dist/hi-IN-IWLTKZ5I-Busk5oaa.js +35 -0
- package/dist/hu-HU-A5ZG7DT2-xSR2C2H0.js +38 -0
- package/dist/id-ID-SAP4L64H-BQQZYm1L.js +41 -0
- package/dist/image-EDRW2JGV-Cx7o2kxD.js +6 -0
- package/dist/image-blob-reduce.esm-BKPqMdie.js +2396 -0
- package/dist/index-3862675e-B3j3w-v_.js +663 -0
- package/dist/index-CLOU2Ikr.js +14364 -0
- package/dist/index.css +450 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +7 -0
- package/dist/index.umd.cjs +235477 -0
- package/dist/infoDiagram-f8f76790-NqA75uBo.js +510 -0
- package/dist/init-ZxktEp_H.js +16 -0
- package/dist/it-IT-JPQ66NNP-CAMVZrYt.js +42 -0
- package/dist/ja-JP-DBVTYXUO-CAX8A_Uj.js +39 -0
- package/dist/journeyDiagram-49397b02-By5oBzsZ.js +1182 -0
- package/dist/kaa-6HZHGXH3-4-o94cPY.js +32 -0
- package/dist/kab-KAB-ZGHBKWFO-CgyjjBvZ.js +39 -0
- package/dist/katex-C-jAQc2m.js +14516 -0
- package/dist/kk-KZ-P5N5QNE5-BEqZcwLA.js +32 -0
- package/dist/km-KH-HSX4SM5Z-DvKDbeH4.js +42 -0
- package/dist/ko-KR-MTYHY66A-DKCuAbKE.js +40 -0
- package/dist/ku-TR-6OUDTVRD-CNUs4cCe.js +40 -0
- package/dist/layout-AJxYKqQV.js +2292 -0
- package/dist/line-DJIf5OM8.js +45 -0
- package/dist/linear-Cfj4s4vI.js +539 -0
- package/dist/lt-LT-XHIRWOB4-gouzGdoW.js +34 -0
- package/dist/lv-LV-5QDEKY6T-CTvg1XFv.js +38 -0
- package/dist/mindmap-definition-fc14e90a-CBlwH_UF.js +35283 -0
- package/dist/mr-IN-CRQNXWMA-QeYm06Kq.js +44 -0
- package/dist/my-MM-5M5IBNSE-DG3k9ORf.js +32 -0
- package/dist/nb-NO-T6EIAALU-Cj995Nmg.js +41 -0
- package/dist/nl-NL-IS3SIHDZ-B-2H7xey.js +39 -0
- package/dist/nn-NO-6E72VCQL-DrAwKKTN.js +39 -0
- package/dist/oc-FR-POXYY2M6-CeyJD7tq.js +39 -0
- package/dist/ordinal-DSZU4PqD.js +76 -0
- package/dist/pa-IN-N4M65BXN-DHzi6mjo.js +35 -0
- package/dist/path-Cp2qmpkd.js +109 -0
- package/dist/percentages-BXMCSKIN-CDYsTuua.js +6 -0
- package/dist/pica-CzzcRNRD.js +1702 -0
- package/dist/pieDiagram-8a3498a8-DueGoZOh.js +768 -0
- package/dist/pl-PL-T2D74RX3-BBNEV2c6.js +40 -0
- package/dist/pt-BR-5N22H2LF-D2cTx_F0.js +40 -0
- package/dist/pt-PT-UZXXM6DQ-BddvLLsF.js +40 -0
- package/dist/quadrantDiagram-120e2f19-Tb6_oGIn.js +1198 -0
- package/dist/requirementDiagram-deff3bca-CEeg0ep-.js +1089 -0
- package/dist/ro-RO-JPDTUUEW-DynuW50i.js +42 -0
- package/dist/roundRect-CjfubgrN.js +152 -0
- package/dist/ru-RU-B4JR7IUQ-B5Hecrew.js +40 -0
- package/dist/sankeyDiagram-04a897e0-CGTLQ8Gm.js +1172 -0
- package/dist/sequenceDiagram-704730f1-CZ72D-Nd.js +3336 -0
- package/dist/si-LK-N5RQ5JYF-BGMa93tc.js +32 -0
- package/dist/sk-SK-C5VTKIMK-BttCAlBm.js +37 -0
- package/dist/sl-SI-NN7IZMDC-DTC59nzG.js +37 -0
- package/dist/stateDiagram-587899a1-XISZzz_f.js +451 -0
- package/dist/stateDiagram-v2-d93cdb3a-DbCcmzTc.js +319 -0
- package/dist/styles-6aaf32cf-CyfdkEib.js +1363 -0
- package/dist/styles-9a916d00-zQ92RrTB.js +1483 -0
- package/dist/styles-c10674c1-BWmkigmR.js +571 -0
- package/dist/subset-shared.chunk-BuFt2PpZ.js +8 -0
- package/dist/subset-worker.chunk-CgaFXU4O.js +14 -0
- package/dist/sv-SE-XGPEYMSR-BPDlPxC1.js +41 -0
- package/dist/svgDrawCommon-08f97a94-CJ0lufOi.js +100 -0
- package/dist/ta-IN-2NMHFXQM-CI1ZsNk9.js +40 -0
- package/dist/th-TH-HPSO5L25-CUM-w2Qt.js +33 -0
- package/dist/timeline-definition-85554ec2-DV6084Gl.js +1210 -0
- package/dist/tr-TR-DEFEU3FU-CGpyf_vD.js +38 -0
- package/dist/uk-UA-QMV73CPH-Bg15Mv3J.js +37 -0
- package/dist/vi-VN-M7AON7JQ-AYmca9so.js +36 -0
- package/dist/vite.svg +1 -0
- package/dist/xychartDiagram-e933f94c-P1e6EEaH.js +1796 -0
- package/dist/zh-CN-LNUGB5OW-Dem2Cc-c.js +41 -0
- package/dist/zh-HK-E62DVLB3-BjsDyiLI.js +32 -0
- package/dist/zh-TW-RAJ6MFWO-IDAsc9Pz.js +40 -0
- package/package.json +52 -0
|
@@ -0,0 +1,768 @@
|
|
|
1
|
+
import { I as tau, a as getAccDescription, s as setAccDescription, b as getAccTitle, c as setAccTitle, o as getDiagramTitle, p as setDiagramTitle, l as log$1, g as getConfig$1, a8 as cleanAndMerge, B as selectSvgElement, V as parseFontSize, e as configureSvgSize, i as sanitizeText$2, r as clear$1, Q as defaultConfig$2 } from "./index-CLOU2Ikr.js";
|
|
2
|
+
import { a as arc } from "./arc-D1qX5GFf.js";
|
|
3
|
+
import { o as ordinal } from "./ordinal-DSZU4PqD.js";
|
|
4
|
+
import { a as array } from "./array-DgktLKBx.js";
|
|
5
|
+
import { c as constant } from "./path-Cp2qmpkd.js";
|
|
6
|
+
function descending(a, b) {
|
|
7
|
+
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
|
8
|
+
}
|
|
9
|
+
function identity(d) {
|
|
10
|
+
return d;
|
|
11
|
+
}
|
|
12
|
+
function pie() {
|
|
13
|
+
var value = identity, sortValues = descending, sort = null, startAngle = constant(0), endAngle = constant(tau), padAngle = constant(0);
|
|
14
|
+
function pie2(data) {
|
|
15
|
+
var i, n = (data = array(data)).length, j, k, sum = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v;
|
|
16
|
+
for (i = 0; i < n; ++i) {
|
|
17
|
+
if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {
|
|
18
|
+
sum += v;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (sortValues != null) index.sort(function(i2, j2) {
|
|
22
|
+
return sortValues(arcs[i2], arcs[j2]);
|
|
23
|
+
});
|
|
24
|
+
else if (sort != null) index.sort(function(i2, j2) {
|
|
25
|
+
return sort(data[i2], data[j2]);
|
|
26
|
+
});
|
|
27
|
+
for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {
|
|
28
|
+
j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
|
|
29
|
+
data: data[j],
|
|
30
|
+
index: i,
|
|
31
|
+
value: v,
|
|
32
|
+
startAngle: a0,
|
|
33
|
+
endAngle: a1,
|
|
34
|
+
padAngle: p
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return arcs;
|
|
38
|
+
}
|
|
39
|
+
pie2.value = function(_) {
|
|
40
|
+
return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie2) : value;
|
|
41
|
+
};
|
|
42
|
+
pie2.sortValues = function(_) {
|
|
43
|
+
return arguments.length ? (sortValues = _, sort = null, pie2) : sortValues;
|
|
44
|
+
};
|
|
45
|
+
pie2.sort = function(_) {
|
|
46
|
+
return arguments.length ? (sort = _, sortValues = null, pie2) : sort;
|
|
47
|
+
};
|
|
48
|
+
pie2.startAngle = function(_) {
|
|
49
|
+
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie2) : startAngle;
|
|
50
|
+
};
|
|
51
|
+
pie2.endAngle = function(_) {
|
|
52
|
+
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie2) : endAngle;
|
|
53
|
+
};
|
|
54
|
+
pie2.padAngle = function(_) {
|
|
55
|
+
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie2) : padAngle;
|
|
56
|
+
};
|
|
57
|
+
return pie2;
|
|
58
|
+
}
|
|
59
|
+
var parser = (function() {
|
|
60
|
+
var o = function(k, v, o2, l) {
|
|
61
|
+
for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
|
|
62
|
+
;
|
|
63
|
+
return o2;
|
|
64
|
+
}, $V0 = [1, 3], $V1 = [1, 4], $V2 = [1, 5], $V3 = [1, 6], $V4 = [1, 10, 12, 14, 16, 18, 19, 20, 21, 22], $V5 = [2, 4], $V6 = [1, 5, 10, 12, 14, 16, 18, 19, 20, 21, 22], $V7 = [20, 21, 22], $V8 = [2, 7], $V9 = [1, 12], $Va = [1, 13], $Vb = [1, 14], $Vc = [1, 15], $Vd = [1, 16], $Ve = [1, 17];
|
|
65
|
+
var parser2 = {
|
|
66
|
+
trace: function trace() {
|
|
67
|
+
},
|
|
68
|
+
yy: {},
|
|
69
|
+
symbols_: { "error": 2, "start": 3, "eol": 4, "PIE": 5, "document": 6, "showData": 7, "line": 8, "statement": 9, "txt": 10, "value": 11, "title": 12, "title_value": 13, "acc_title": 14, "acc_title_value": 15, "acc_descr": 16, "acc_descr_value": 17, "acc_descr_multiline_value": 18, "section": 19, "NEWLINE": 20, ";": 21, "EOF": 22, "$accept": 0, "$end": 1 },
|
|
70
|
+
terminals_: { 2: "error", 5: "PIE", 7: "showData", 10: "txt", 11: "value", 12: "title", 13: "title_value", 14: "acc_title", 15: "acc_title_value", 16: "acc_descr", 17: "acc_descr_value", 18: "acc_descr_multiline_value", 19: "section", 20: "NEWLINE", 21: ";", 22: "EOF" },
|
|
71
|
+
productions_: [0, [3, 2], [3, 2], [3, 3], [6, 0], [6, 2], [8, 2], [9, 0], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [4, 1], [4, 1], [4, 1]],
|
|
72
|
+
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
|
|
73
|
+
var $0 = $$.length - 1;
|
|
74
|
+
switch (yystate) {
|
|
75
|
+
case 3:
|
|
76
|
+
yy.setShowData(true);
|
|
77
|
+
break;
|
|
78
|
+
case 6:
|
|
79
|
+
this.$ = $$[$0 - 1];
|
|
80
|
+
break;
|
|
81
|
+
case 8:
|
|
82
|
+
yy.addSection($$[$0 - 1], yy.cleanupValue($$[$0]));
|
|
83
|
+
break;
|
|
84
|
+
case 9:
|
|
85
|
+
this.$ = $$[$0].trim();
|
|
86
|
+
yy.setDiagramTitle(this.$);
|
|
87
|
+
break;
|
|
88
|
+
case 10:
|
|
89
|
+
this.$ = $$[$0].trim();
|
|
90
|
+
yy.setAccTitle(this.$);
|
|
91
|
+
break;
|
|
92
|
+
case 11:
|
|
93
|
+
case 12:
|
|
94
|
+
this.$ = $$[$0].trim();
|
|
95
|
+
yy.setAccDescription(this.$);
|
|
96
|
+
break;
|
|
97
|
+
case 13:
|
|
98
|
+
yy.addSection($$[$0].substr(8));
|
|
99
|
+
this.$ = $$[$0].substr(8);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
table: [{ 3: 1, 4: 2, 5: $V0, 20: $V1, 21: $V2, 22: $V3 }, { 1: [3] }, { 3: 7, 4: 2, 5: $V0, 20: $V1, 21: $V2, 22: $V3 }, o($V4, $V5, { 6: 8, 7: [1, 9] }), o($V6, [2, 14]), o($V6, [2, 15]), o($V6, [2, 16]), { 1: [2, 1] }, o($V7, $V8, { 8: 10, 9: 11, 1: [2, 2], 10: $V9, 12: $Va, 14: $Vb, 16: $Vc, 18: $Vd, 19: $Ve }), o($V4, $V5, { 6: 18 }), o($V4, [2, 5]), { 4: 19, 20: $V1, 21: $V2, 22: $V3 }, { 11: [1, 20] }, { 13: [1, 21] }, { 15: [1, 22] }, { 17: [1, 23] }, o($V7, [2, 12]), o($V7, [2, 13]), o($V7, $V8, { 8: 10, 9: 11, 1: [2, 3], 10: $V9, 12: $Va, 14: $Vb, 16: $Vc, 18: $Vd, 19: $Ve }), o($V4, [2, 6]), o($V7, [2, 8]), o($V7, [2, 9]), o($V7, [2, 10]), o($V7, [2, 11])],
|
|
104
|
+
defaultActions: { 7: [2, 1] },
|
|
105
|
+
parseError: function parseError(str, hash) {
|
|
106
|
+
if (hash.recoverable) {
|
|
107
|
+
this.trace(str);
|
|
108
|
+
} else {
|
|
109
|
+
var error = new Error(str);
|
|
110
|
+
error.hash = hash;
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
parse: function parse(input) {
|
|
115
|
+
var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
|
|
116
|
+
var args = lstack.slice.call(arguments, 1);
|
|
117
|
+
var lexer2 = Object.create(this.lexer);
|
|
118
|
+
var sharedState = { yy: {} };
|
|
119
|
+
for (var k in this.yy) {
|
|
120
|
+
if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
|
|
121
|
+
sharedState.yy[k] = this.yy[k];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
lexer2.setInput(input, sharedState.yy);
|
|
125
|
+
sharedState.yy.lexer = lexer2;
|
|
126
|
+
sharedState.yy.parser = this;
|
|
127
|
+
if (typeof lexer2.yylloc == "undefined") {
|
|
128
|
+
lexer2.yylloc = {};
|
|
129
|
+
}
|
|
130
|
+
var yyloc = lexer2.yylloc;
|
|
131
|
+
lstack.push(yyloc);
|
|
132
|
+
var ranges = lexer2.options && lexer2.options.ranges;
|
|
133
|
+
if (typeof sharedState.yy.parseError === "function") {
|
|
134
|
+
this.parseError = sharedState.yy.parseError;
|
|
135
|
+
} else {
|
|
136
|
+
this.parseError = Object.getPrototypeOf(this).parseError;
|
|
137
|
+
}
|
|
138
|
+
function lex() {
|
|
139
|
+
var token;
|
|
140
|
+
token = tstack.pop() || lexer2.lex() || EOF;
|
|
141
|
+
if (typeof token !== "number") {
|
|
142
|
+
if (token instanceof Array) {
|
|
143
|
+
tstack = token;
|
|
144
|
+
token = tstack.pop();
|
|
145
|
+
}
|
|
146
|
+
token = self.symbols_[token] || token;
|
|
147
|
+
}
|
|
148
|
+
return token;
|
|
149
|
+
}
|
|
150
|
+
var symbol, state, action, r, yyval = {}, p, len, newState, expected;
|
|
151
|
+
while (true) {
|
|
152
|
+
state = stack[stack.length - 1];
|
|
153
|
+
if (this.defaultActions[state]) {
|
|
154
|
+
action = this.defaultActions[state];
|
|
155
|
+
} else {
|
|
156
|
+
if (symbol === null || typeof symbol == "undefined") {
|
|
157
|
+
symbol = lex();
|
|
158
|
+
}
|
|
159
|
+
action = table[state] && table[state][symbol];
|
|
160
|
+
}
|
|
161
|
+
if (typeof action === "undefined" || !action.length || !action[0]) {
|
|
162
|
+
var errStr = "";
|
|
163
|
+
expected = [];
|
|
164
|
+
for (p in table[state]) {
|
|
165
|
+
if (this.terminals_[p] && p > TERROR) {
|
|
166
|
+
expected.push("'" + this.terminals_[p] + "'");
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (lexer2.showPosition) {
|
|
170
|
+
errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
|
|
171
|
+
} else {
|
|
172
|
+
errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
|
|
173
|
+
}
|
|
174
|
+
this.parseError(errStr, {
|
|
175
|
+
text: lexer2.match,
|
|
176
|
+
token: this.terminals_[symbol] || symbol,
|
|
177
|
+
line: lexer2.yylineno,
|
|
178
|
+
loc: yyloc,
|
|
179
|
+
expected
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
if (action[0] instanceof Array && action.length > 1) {
|
|
183
|
+
throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
|
|
184
|
+
}
|
|
185
|
+
switch (action[0]) {
|
|
186
|
+
case 1:
|
|
187
|
+
stack.push(symbol);
|
|
188
|
+
vstack.push(lexer2.yytext);
|
|
189
|
+
lstack.push(lexer2.yylloc);
|
|
190
|
+
stack.push(action[1]);
|
|
191
|
+
symbol = null;
|
|
192
|
+
{
|
|
193
|
+
yyleng = lexer2.yyleng;
|
|
194
|
+
yytext = lexer2.yytext;
|
|
195
|
+
yylineno = lexer2.yylineno;
|
|
196
|
+
yyloc = lexer2.yylloc;
|
|
197
|
+
}
|
|
198
|
+
break;
|
|
199
|
+
case 2:
|
|
200
|
+
len = this.productions_[action[1]][1];
|
|
201
|
+
yyval.$ = vstack[vstack.length - len];
|
|
202
|
+
yyval._$ = {
|
|
203
|
+
first_line: lstack[lstack.length - (len || 1)].first_line,
|
|
204
|
+
last_line: lstack[lstack.length - 1].last_line,
|
|
205
|
+
first_column: lstack[lstack.length - (len || 1)].first_column,
|
|
206
|
+
last_column: lstack[lstack.length - 1].last_column
|
|
207
|
+
};
|
|
208
|
+
if (ranges) {
|
|
209
|
+
yyval._$.range = [
|
|
210
|
+
lstack[lstack.length - (len || 1)].range[0],
|
|
211
|
+
lstack[lstack.length - 1].range[1]
|
|
212
|
+
];
|
|
213
|
+
}
|
|
214
|
+
r = this.performAction.apply(yyval, [
|
|
215
|
+
yytext,
|
|
216
|
+
yyleng,
|
|
217
|
+
yylineno,
|
|
218
|
+
sharedState.yy,
|
|
219
|
+
action[1],
|
|
220
|
+
vstack,
|
|
221
|
+
lstack
|
|
222
|
+
].concat(args));
|
|
223
|
+
if (typeof r !== "undefined") {
|
|
224
|
+
return r;
|
|
225
|
+
}
|
|
226
|
+
if (len) {
|
|
227
|
+
stack = stack.slice(0, -1 * len * 2);
|
|
228
|
+
vstack = vstack.slice(0, -1 * len);
|
|
229
|
+
lstack = lstack.slice(0, -1 * len);
|
|
230
|
+
}
|
|
231
|
+
stack.push(this.productions_[action[1]][0]);
|
|
232
|
+
vstack.push(yyval.$);
|
|
233
|
+
lstack.push(yyval._$);
|
|
234
|
+
newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
|
|
235
|
+
stack.push(newState);
|
|
236
|
+
break;
|
|
237
|
+
case 3:
|
|
238
|
+
return true;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
var lexer = /* @__PURE__ */ (function() {
|
|
245
|
+
var lexer2 = {
|
|
246
|
+
EOF: 1,
|
|
247
|
+
parseError: function parseError(str, hash) {
|
|
248
|
+
if (this.yy.parser) {
|
|
249
|
+
this.yy.parser.parseError(str, hash);
|
|
250
|
+
} else {
|
|
251
|
+
throw new Error(str);
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
// resets the lexer, sets new input
|
|
255
|
+
setInput: function(input, yy) {
|
|
256
|
+
this.yy = yy || this.yy || {};
|
|
257
|
+
this._input = input;
|
|
258
|
+
this._more = this._backtrack = this.done = false;
|
|
259
|
+
this.yylineno = this.yyleng = 0;
|
|
260
|
+
this.yytext = this.matched = this.match = "";
|
|
261
|
+
this.conditionStack = ["INITIAL"];
|
|
262
|
+
this.yylloc = {
|
|
263
|
+
first_line: 1,
|
|
264
|
+
first_column: 0,
|
|
265
|
+
last_line: 1,
|
|
266
|
+
last_column: 0
|
|
267
|
+
};
|
|
268
|
+
if (this.options.ranges) {
|
|
269
|
+
this.yylloc.range = [0, 0];
|
|
270
|
+
}
|
|
271
|
+
this.offset = 0;
|
|
272
|
+
return this;
|
|
273
|
+
},
|
|
274
|
+
// consumes and returns one char from the input
|
|
275
|
+
input: function() {
|
|
276
|
+
var ch = this._input[0];
|
|
277
|
+
this.yytext += ch;
|
|
278
|
+
this.yyleng++;
|
|
279
|
+
this.offset++;
|
|
280
|
+
this.match += ch;
|
|
281
|
+
this.matched += ch;
|
|
282
|
+
var lines = ch.match(/(?:\r\n?|\n).*/g);
|
|
283
|
+
if (lines) {
|
|
284
|
+
this.yylineno++;
|
|
285
|
+
this.yylloc.last_line++;
|
|
286
|
+
} else {
|
|
287
|
+
this.yylloc.last_column++;
|
|
288
|
+
}
|
|
289
|
+
if (this.options.ranges) {
|
|
290
|
+
this.yylloc.range[1]++;
|
|
291
|
+
}
|
|
292
|
+
this._input = this._input.slice(1);
|
|
293
|
+
return ch;
|
|
294
|
+
},
|
|
295
|
+
// unshifts one char (or a string) into the input
|
|
296
|
+
unput: function(ch) {
|
|
297
|
+
var len = ch.length;
|
|
298
|
+
var lines = ch.split(/(?:\r\n?|\n)/g);
|
|
299
|
+
this._input = ch + this._input;
|
|
300
|
+
this.yytext = this.yytext.substr(0, this.yytext.length - len);
|
|
301
|
+
this.offset -= len;
|
|
302
|
+
var oldLines = this.match.split(/(?:\r\n?|\n)/g);
|
|
303
|
+
this.match = this.match.substr(0, this.match.length - 1);
|
|
304
|
+
this.matched = this.matched.substr(0, this.matched.length - 1);
|
|
305
|
+
if (lines.length - 1) {
|
|
306
|
+
this.yylineno -= lines.length - 1;
|
|
307
|
+
}
|
|
308
|
+
var r = this.yylloc.range;
|
|
309
|
+
this.yylloc = {
|
|
310
|
+
first_line: this.yylloc.first_line,
|
|
311
|
+
last_line: this.yylineno + 1,
|
|
312
|
+
first_column: this.yylloc.first_column,
|
|
313
|
+
last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
|
|
314
|
+
};
|
|
315
|
+
if (this.options.ranges) {
|
|
316
|
+
this.yylloc.range = [r[0], r[0] + this.yyleng - len];
|
|
317
|
+
}
|
|
318
|
+
this.yyleng = this.yytext.length;
|
|
319
|
+
return this;
|
|
320
|
+
},
|
|
321
|
+
// When called from action, caches matched text and appends it on next action
|
|
322
|
+
more: function() {
|
|
323
|
+
this._more = true;
|
|
324
|
+
return this;
|
|
325
|
+
},
|
|
326
|
+
// 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.
|
|
327
|
+
reject: function() {
|
|
328
|
+
if (this.options.backtrack_lexer) {
|
|
329
|
+
this._backtrack = true;
|
|
330
|
+
} else {
|
|
331
|
+
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).\n" + this.showPosition(), {
|
|
332
|
+
text: "",
|
|
333
|
+
token: null,
|
|
334
|
+
line: this.yylineno
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
return this;
|
|
338
|
+
},
|
|
339
|
+
// retain first n characters of the match
|
|
340
|
+
less: function(n) {
|
|
341
|
+
this.unput(this.match.slice(n));
|
|
342
|
+
},
|
|
343
|
+
// displays already matched input, i.e. for error messages
|
|
344
|
+
pastInput: function() {
|
|
345
|
+
var past = this.matched.substr(0, this.matched.length - this.match.length);
|
|
346
|
+
return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
|
|
347
|
+
},
|
|
348
|
+
// displays upcoming input, i.e. for error messages
|
|
349
|
+
upcomingInput: function() {
|
|
350
|
+
var next = this.match;
|
|
351
|
+
if (next.length < 20) {
|
|
352
|
+
next += this._input.substr(0, 20 - next.length);
|
|
353
|
+
}
|
|
354
|
+
return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
|
|
355
|
+
},
|
|
356
|
+
// displays the character position where the lexing error occurred, i.e. for error messages
|
|
357
|
+
showPosition: function() {
|
|
358
|
+
var pre = this.pastInput();
|
|
359
|
+
var c = new Array(pre.length + 1).join("-");
|
|
360
|
+
return pre + this.upcomingInput() + "\n" + c + "^";
|
|
361
|
+
},
|
|
362
|
+
// test the lexed token: return FALSE when not a match, otherwise return token
|
|
363
|
+
test_match: function(match, indexed_rule) {
|
|
364
|
+
var token, lines, backup;
|
|
365
|
+
if (this.options.backtrack_lexer) {
|
|
366
|
+
backup = {
|
|
367
|
+
yylineno: this.yylineno,
|
|
368
|
+
yylloc: {
|
|
369
|
+
first_line: this.yylloc.first_line,
|
|
370
|
+
last_line: this.last_line,
|
|
371
|
+
first_column: this.yylloc.first_column,
|
|
372
|
+
last_column: this.yylloc.last_column
|
|
373
|
+
},
|
|
374
|
+
yytext: this.yytext,
|
|
375
|
+
match: this.match,
|
|
376
|
+
matches: this.matches,
|
|
377
|
+
matched: this.matched,
|
|
378
|
+
yyleng: this.yyleng,
|
|
379
|
+
offset: this.offset,
|
|
380
|
+
_more: this._more,
|
|
381
|
+
_input: this._input,
|
|
382
|
+
yy: this.yy,
|
|
383
|
+
conditionStack: this.conditionStack.slice(0),
|
|
384
|
+
done: this.done
|
|
385
|
+
};
|
|
386
|
+
if (this.options.ranges) {
|
|
387
|
+
backup.yylloc.range = this.yylloc.range.slice(0);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
lines = match[0].match(/(?:\r\n?|\n).*/g);
|
|
391
|
+
if (lines) {
|
|
392
|
+
this.yylineno += lines.length;
|
|
393
|
+
}
|
|
394
|
+
this.yylloc = {
|
|
395
|
+
first_line: this.yylloc.last_line,
|
|
396
|
+
last_line: this.yylineno + 1,
|
|
397
|
+
first_column: this.yylloc.last_column,
|
|
398
|
+
last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
|
|
399
|
+
};
|
|
400
|
+
this.yytext += match[0];
|
|
401
|
+
this.match += match[0];
|
|
402
|
+
this.matches = match;
|
|
403
|
+
this.yyleng = this.yytext.length;
|
|
404
|
+
if (this.options.ranges) {
|
|
405
|
+
this.yylloc.range = [this.offset, this.offset += this.yyleng];
|
|
406
|
+
}
|
|
407
|
+
this._more = false;
|
|
408
|
+
this._backtrack = false;
|
|
409
|
+
this._input = this._input.slice(match[0].length);
|
|
410
|
+
this.matched += match[0];
|
|
411
|
+
token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
|
|
412
|
+
if (this.done && this._input) {
|
|
413
|
+
this.done = false;
|
|
414
|
+
}
|
|
415
|
+
if (token) {
|
|
416
|
+
return token;
|
|
417
|
+
} else if (this._backtrack) {
|
|
418
|
+
for (var k in backup) {
|
|
419
|
+
this[k] = backup[k];
|
|
420
|
+
}
|
|
421
|
+
return false;
|
|
422
|
+
}
|
|
423
|
+
return false;
|
|
424
|
+
},
|
|
425
|
+
// return next match in input
|
|
426
|
+
next: function() {
|
|
427
|
+
if (this.done) {
|
|
428
|
+
return this.EOF;
|
|
429
|
+
}
|
|
430
|
+
if (!this._input) {
|
|
431
|
+
this.done = true;
|
|
432
|
+
}
|
|
433
|
+
var token, match, tempMatch, index;
|
|
434
|
+
if (!this._more) {
|
|
435
|
+
this.yytext = "";
|
|
436
|
+
this.match = "";
|
|
437
|
+
}
|
|
438
|
+
var rules = this._currentRules();
|
|
439
|
+
for (var i = 0; i < rules.length; i++) {
|
|
440
|
+
tempMatch = this._input.match(this.rules[rules[i]]);
|
|
441
|
+
if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
|
|
442
|
+
match = tempMatch;
|
|
443
|
+
index = i;
|
|
444
|
+
if (this.options.backtrack_lexer) {
|
|
445
|
+
token = this.test_match(tempMatch, rules[i]);
|
|
446
|
+
if (token !== false) {
|
|
447
|
+
return token;
|
|
448
|
+
} else if (this._backtrack) {
|
|
449
|
+
match = false;
|
|
450
|
+
continue;
|
|
451
|
+
} else {
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
} else if (!this.options.flex) {
|
|
455
|
+
break;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
if (match) {
|
|
460
|
+
token = this.test_match(match, rules[index]);
|
|
461
|
+
if (token !== false) {
|
|
462
|
+
return token;
|
|
463
|
+
}
|
|
464
|
+
return false;
|
|
465
|
+
}
|
|
466
|
+
if (this._input === "") {
|
|
467
|
+
return this.EOF;
|
|
468
|
+
} else {
|
|
469
|
+
return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
|
|
470
|
+
text: "",
|
|
471
|
+
token: null,
|
|
472
|
+
line: this.yylineno
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
// return next match that has a token
|
|
477
|
+
lex: function lex() {
|
|
478
|
+
var r = this.next();
|
|
479
|
+
if (r) {
|
|
480
|
+
return r;
|
|
481
|
+
} else {
|
|
482
|
+
return this.lex();
|
|
483
|
+
}
|
|
484
|
+
},
|
|
485
|
+
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
|
486
|
+
begin: function begin(condition) {
|
|
487
|
+
this.conditionStack.push(condition);
|
|
488
|
+
},
|
|
489
|
+
// pop the previously active lexer condition state off the condition stack
|
|
490
|
+
popState: function popState() {
|
|
491
|
+
var n = this.conditionStack.length - 1;
|
|
492
|
+
if (n > 0) {
|
|
493
|
+
return this.conditionStack.pop();
|
|
494
|
+
} else {
|
|
495
|
+
return this.conditionStack[0];
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
// produce the lexer rule set which is active for the currently active lexer condition state
|
|
499
|
+
_currentRules: function _currentRules() {
|
|
500
|
+
if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
|
|
501
|
+
return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
|
|
502
|
+
} else {
|
|
503
|
+
return this.conditions["INITIAL"].rules;
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
|
|
507
|
+
topState: function topState(n) {
|
|
508
|
+
n = this.conditionStack.length - 1 - Math.abs(n || 0);
|
|
509
|
+
if (n >= 0) {
|
|
510
|
+
return this.conditionStack[n];
|
|
511
|
+
} else {
|
|
512
|
+
return "INITIAL";
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
// alias for begin(condition)
|
|
516
|
+
pushState: function pushState(condition) {
|
|
517
|
+
this.begin(condition);
|
|
518
|
+
},
|
|
519
|
+
// return the number of states currently on the stack
|
|
520
|
+
stateStackSize: function stateStackSize() {
|
|
521
|
+
return this.conditionStack.length;
|
|
522
|
+
},
|
|
523
|
+
options: { "case-insensitive": true },
|
|
524
|
+
performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
|
|
525
|
+
switch ($avoiding_name_collisions) {
|
|
526
|
+
case 0:
|
|
527
|
+
break;
|
|
528
|
+
case 1:
|
|
529
|
+
break;
|
|
530
|
+
case 2:
|
|
531
|
+
return 20;
|
|
532
|
+
case 3:
|
|
533
|
+
break;
|
|
534
|
+
case 4:
|
|
535
|
+
break;
|
|
536
|
+
case 5:
|
|
537
|
+
this.begin("title");
|
|
538
|
+
return 12;
|
|
539
|
+
case 6:
|
|
540
|
+
this.popState();
|
|
541
|
+
return "title_value";
|
|
542
|
+
case 7:
|
|
543
|
+
this.begin("acc_title");
|
|
544
|
+
return 14;
|
|
545
|
+
case 8:
|
|
546
|
+
this.popState();
|
|
547
|
+
return "acc_title_value";
|
|
548
|
+
case 9:
|
|
549
|
+
this.begin("acc_descr");
|
|
550
|
+
return 16;
|
|
551
|
+
case 10:
|
|
552
|
+
this.popState();
|
|
553
|
+
return "acc_descr_value";
|
|
554
|
+
case 11:
|
|
555
|
+
this.begin("acc_descr_multiline");
|
|
556
|
+
break;
|
|
557
|
+
case 12:
|
|
558
|
+
this.popState();
|
|
559
|
+
break;
|
|
560
|
+
case 13:
|
|
561
|
+
return "acc_descr_multiline_value";
|
|
562
|
+
case 14:
|
|
563
|
+
this.begin("string");
|
|
564
|
+
break;
|
|
565
|
+
case 15:
|
|
566
|
+
this.popState();
|
|
567
|
+
break;
|
|
568
|
+
case 16:
|
|
569
|
+
return "txt";
|
|
570
|
+
case 17:
|
|
571
|
+
return 5;
|
|
572
|
+
case 18:
|
|
573
|
+
return 7;
|
|
574
|
+
case 19:
|
|
575
|
+
return "value";
|
|
576
|
+
case 20:
|
|
577
|
+
return 22;
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:[\s]+)/i, /^(?:title\b)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:pie\b)/i, /^(?:showData\b)/i, /^(?::[\s]*[\d]+(?:\.[\d]+)?)/i, /^(?:$)/i],
|
|
581
|
+
conditions: { "acc_descr_multiline": { "rules": [12, 13], "inclusive": false }, "acc_descr": { "rules": [10], "inclusive": false }, "acc_title": { "rules": [8], "inclusive": false }, "title": { "rules": [6], "inclusive": false }, "string": { "rules": [15, 16], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 7, 9, 11, 14, 17, 18, 19, 20], "inclusive": true } }
|
|
582
|
+
};
|
|
583
|
+
return lexer2;
|
|
584
|
+
})();
|
|
585
|
+
parser2.lexer = lexer;
|
|
586
|
+
function Parser() {
|
|
587
|
+
this.yy = {};
|
|
588
|
+
}
|
|
589
|
+
Parser.prototype = parser2;
|
|
590
|
+
parser2.Parser = Parser;
|
|
591
|
+
return new Parser();
|
|
592
|
+
})();
|
|
593
|
+
parser.parser = parser;
|
|
594
|
+
const parser$1 = parser;
|
|
595
|
+
const DEFAULT_PIE_CONFIG = defaultConfig$2.pie;
|
|
596
|
+
const DEFAULT_PIE_DB = {
|
|
597
|
+
sections: {},
|
|
598
|
+
showData: false
|
|
599
|
+
};
|
|
600
|
+
let sections = DEFAULT_PIE_DB.sections;
|
|
601
|
+
let showData = DEFAULT_PIE_DB.showData;
|
|
602
|
+
const config = structuredClone(DEFAULT_PIE_CONFIG);
|
|
603
|
+
const getConfig = () => structuredClone(config);
|
|
604
|
+
const clear = () => {
|
|
605
|
+
sections = structuredClone(DEFAULT_PIE_DB.sections);
|
|
606
|
+
showData = DEFAULT_PIE_DB.showData;
|
|
607
|
+
clear$1();
|
|
608
|
+
};
|
|
609
|
+
const addSection = (label, value) => {
|
|
610
|
+
label = sanitizeText$2(label, getConfig$1());
|
|
611
|
+
if (sections[label] === void 0) {
|
|
612
|
+
sections[label] = value;
|
|
613
|
+
log$1.debug(`added new section: ${label}, with value: ${value}`);
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
const getSections = () => sections;
|
|
617
|
+
const cleanupValue = (value) => {
|
|
618
|
+
if (value.substring(0, 1) === ":") {
|
|
619
|
+
value = value.substring(1).trim();
|
|
620
|
+
}
|
|
621
|
+
return Number(value.trim());
|
|
622
|
+
};
|
|
623
|
+
const setShowData = (toggle) => {
|
|
624
|
+
showData = toggle;
|
|
625
|
+
};
|
|
626
|
+
const getShowData = () => showData;
|
|
627
|
+
const db = {
|
|
628
|
+
getConfig,
|
|
629
|
+
clear,
|
|
630
|
+
setDiagramTitle,
|
|
631
|
+
getDiagramTitle,
|
|
632
|
+
setAccTitle,
|
|
633
|
+
getAccTitle,
|
|
634
|
+
setAccDescription,
|
|
635
|
+
getAccDescription,
|
|
636
|
+
addSection,
|
|
637
|
+
getSections,
|
|
638
|
+
cleanupValue,
|
|
639
|
+
setShowData,
|
|
640
|
+
getShowData
|
|
641
|
+
};
|
|
642
|
+
const getStyles = (options) => `
|
|
643
|
+
.pieCircle{
|
|
644
|
+
stroke: ${options.pieStrokeColor};
|
|
645
|
+
stroke-width : ${options.pieStrokeWidth};
|
|
646
|
+
opacity : ${options.pieOpacity};
|
|
647
|
+
}
|
|
648
|
+
.pieOuterCircle{
|
|
649
|
+
stroke: ${options.pieOuterStrokeColor};
|
|
650
|
+
stroke-width: ${options.pieOuterStrokeWidth};
|
|
651
|
+
fill: none;
|
|
652
|
+
}
|
|
653
|
+
.pieTitleText {
|
|
654
|
+
text-anchor: middle;
|
|
655
|
+
font-size: ${options.pieTitleTextSize};
|
|
656
|
+
fill: ${options.pieTitleTextColor};
|
|
657
|
+
font-family: ${options.fontFamily};
|
|
658
|
+
}
|
|
659
|
+
.slice {
|
|
660
|
+
font-family: ${options.fontFamily};
|
|
661
|
+
fill: ${options.pieSectionTextColor};
|
|
662
|
+
font-size:${options.pieSectionTextSize};
|
|
663
|
+
// fill: white;
|
|
664
|
+
}
|
|
665
|
+
.legend text {
|
|
666
|
+
fill: ${options.pieLegendTextColor};
|
|
667
|
+
font-family: ${options.fontFamily};
|
|
668
|
+
font-size: ${options.pieLegendTextSize};
|
|
669
|
+
}
|
|
670
|
+
`;
|
|
671
|
+
const styles = getStyles;
|
|
672
|
+
const createPieArcs = (sections2) => {
|
|
673
|
+
const pieData = Object.entries(sections2).map((element) => {
|
|
674
|
+
return {
|
|
675
|
+
label: element[0],
|
|
676
|
+
value: element[1]
|
|
677
|
+
};
|
|
678
|
+
}).sort((a, b) => {
|
|
679
|
+
return b.value - a.value;
|
|
680
|
+
});
|
|
681
|
+
const pie$1 = pie().value(
|
|
682
|
+
(d3Section) => d3Section.value
|
|
683
|
+
);
|
|
684
|
+
return pie$1(pieData);
|
|
685
|
+
};
|
|
686
|
+
const draw = (text, id, _version, diagObj) => {
|
|
687
|
+
log$1.debug("rendering pie chart\n" + text);
|
|
688
|
+
const db2 = diagObj.db;
|
|
689
|
+
const globalConfig = getConfig$1();
|
|
690
|
+
const pieConfig = cleanAndMerge(db2.getConfig(), globalConfig.pie);
|
|
691
|
+
const MARGIN = 40;
|
|
692
|
+
const LEGEND_RECT_SIZE = 18;
|
|
693
|
+
const LEGEND_SPACING = 4;
|
|
694
|
+
const height = 450;
|
|
695
|
+
const pieWidth = height;
|
|
696
|
+
const svg = selectSvgElement(id);
|
|
697
|
+
const group = svg.append("g");
|
|
698
|
+
const sections2 = db2.getSections();
|
|
699
|
+
group.attr("transform", "translate(" + pieWidth / 2 + "," + height / 2 + ")");
|
|
700
|
+
const { themeVariables } = globalConfig;
|
|
701
|
+
let [outerStrokeWidth] = parseFontSize(themeVariables.pieOuterStrokeWidth);
|
|
702
|
+
outerStrokeWidth ?? (outerStrokeWidth = 2);
|
|
703
|
+
const textPosition = pieConfig.textPosition;
|
|
704
|
+
const radius = Math.min(pieWidth, height) / 2 - MARGIN;
|
|
705
|
+
const arcGenerator = arc().innerRadius(0).outerRadius(radius);
|
|
706
|
+
const labelArcGenerator = arc().innerRadius(radius * textPosition).outerRadius(radius * textPosition);
|
|
707
|
+
group.append("circle").attr("cx", 0).attr("cy", 0).attr("r", radius + outerStrokeWidth / 2).attr("class", "pieOuterCircle");
|
|
708
|
+
const arcs = createPieArcs(sections2);
|
|
709
|
+
const myGeneratedColors = [
|
|
710
|
+
themeVariables.pie1,
|
|
711
|
+
themeVariables.pie2,
|
|
712
|
+
themeVariables.pie3,
|
|
713
|
+
themeVariables.pie4,
|
|
714
|
+
themeVariables.pie5,
|
|
715
|
+
themeVariables.pie6,
|
|
716
|
+
themeVariables.pie7,
|
|
717
|
+
themeVariables.pie8,
|
|
718
|
+
themeVariables.pie9,
|
|
719
|
+
themeVariables.pie10,
|
|
720
|
+
themeVariables.pie11,
|
|
721
|
+
themeVariables.pie12
|
|
722
|
+
];
|
|
723
|
+
const color = ordinal(myGeneratedColors);
|
|
724
|
+
group.selectAll("mySlices").data(arcs).enter().append("path").attr("d", arcGenerator).attr("fill", (datum) => {
|
|
725
|
+
return color(datum.data.label);
|
|
726
|
+
}).attr("class", "pieCircle");
|
|
727
|
+
let sum = 0;
|
|
728
|
+
Object.keys(sections2).forEach((key) => {
|
|
729
|
+
sum += sections2[key];
|
|
730
|
+
});
|
|
731
|
+
group.selectAll("mySlices").data(arcs).enter().append("text").text((datum) => {
|
|
732
|
+
return (datum.data.value / sum * 100).toFixed(0) + "%";
|
|
733
|
+
}).attr("transform", (datum) => {
|
|
734
|
+
return "translate(" + labelArcGenerator.centroid(datum) + ")";
|
|
735
|
+
}).style("text-anchor", "middle").attr("class", "slice");
|
|
736
|
+
group.append("text").text(db2.getDiagramTitle()).attr("x", 0).attr("y", -400 / 2).attr("class", "pieTitleText");
|
|
737
|
+
const legend = group.selectAll(".legend").data(color.domain()).enter().append("g").attr("class", "legend").attr("transform", (_datum, index) => {
|
|
738
|
+
const height2 = LEGEND_RECT_SIZE + LEGEND_SPACING;
|
|
739
|
+
const offset = height2 * color.domain().length / 2;
|
|
740
|
+
const horizontal = 12 * LEGEND_RECT_SIZE;
|
|
741
|
+
const vertical = index * height2 - offset;
|
|
742
|
+
return "translate(" + horizontal + "," + vertical + ")";
|
|
743
|
+
});
|
|
744
|
+
legend.append("rect").attr("width", LEGEND_RECT_SIZE).attr("height", LEGEND_RECT_SIZE).style("fill", color).style("stroke", color);
|
|
745
|
+
legend.data(arcs).append("text").attr("x", LEGEND_RECT_SIZE + LEGEND_SPACING).attr("y", LEGEND_RECT_SIZE - LEGEND_SPACING).text((datum) => {
|
|
746
|
+
const { label, value } = datum.data;
|
|
747
|
+
if (db2.getShowData()) {
|
|
748
|
+
return `${label} [${value}]`;
|
|
749
|
+
}
|
|
750
|
+
return label;
|
|
751
|
+
});
|
|
752
|
+
const longestTextWidth = Math.max(
|
|
753
|
+
...legend.selectAll("text").nodes().map((node) => (node == null ? void 0 : node.getBoundingClientRect().width) ?? 0)
|
|
754
|
+
);
|
|
755
|
+
const totalWidth = pieWidth + MARGIN + LEGEND_RECT_SIZE + LEGEND_SPACING + longestTextWidth;
|
|
756
|
+
svg.attr("viewBox", `0 0 ${totalWidth} ${height}`);
|
|
757
|
+
configureSvgSize(svg, height, totalWidth, pieConfig.useMaxWidth);
|
|
758
|
+
};
|
|
759
|
+
const renderer = { draw };
|
|
760
|
+
const diagram = {
|
|
761
|
+
parser: parser$1,
|
|
762
|
+
db,
|
|
763
|
+
renderer,
|
|
764
|
+
styles
|
|
765
|
+
};
|
|
766
|
+
export {
|
|
767
|
+
diagram
|
|
768
|
+
};
|