pace-chart-lib 0.0.12 → 1.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/dist/components/Charts/ChartsWithAxis/AreaFamily/AreaChart.js +9 -11
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/NormalizedStackAreaChart.js +6 -9
- package/dist/components/Charts/ChartsWithAxis/AreaFamily/StackAreaChart.js +7 -10
- package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisFunctions.d.ts +4 -4
- package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisFunctions.js +12 -17
- package/dist/components/Charts/ChartsWithAxis/ChartsWithAxisTypes.types.d.ts +2 -4
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnChart.js +9 -11
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/ColumnHistogramChart.js +8 -7
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/CustomColumnChart.js +11 -13
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/LayeredColumnChart.js +11 -13
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/NormalizedStackColumnChart.js +7 -10
- package/dist/components/Charts/ChartsWithAxis/ColumnFamily/StackColumnChart.js +7 -10
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalBarChart.js +9 -11
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/HorizontalHistogramChart.js +11 -13
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/LayeredHorizontalBarChart.js +11 -13
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/NormalizedStackHorizontalBarChart.js +6 -7
- package/dist/components/Charts/ChartsWithAxis/HorizontalBarFamily/StackHorizontalBarChart.js +3 -3
- package/dist/components/Charts/ChartsWithAxis/LineFamily/LineChart.js +9 -11
- package/dist/components/Charts/ChartsWithAxis/LineFamily/NormalizedStackLineChart.js +7 -10
- package/dist/components/Charts/ChartsWithAxis/LineFamily/StackLineChart.js +7 -10
- package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/TornadoChart.js +10 -12
- package/dist/components/Charts/ChartsWithAxis/MiscellaneousChartFamily/WaterfallChart.js +19 -22
- package/dist/components/Charts/ChartsWithoutAxis/OtherCharts/OrganizationChart.js +4 -3
- package/dist/components/Charts/Core/Common.types.d.ts +3 -3
- package/dist/components/Charts/Core/CommonFunctions.js +3 -1
- package/package.json +27 -11
- package/dist/Components1/Charts/ChartsWithAxis/BarFamily/BarChart.d.ts +0 -12
- package/dist/Components1/Charts/ChartsWithAxis/BarFamily/BarChart.js +0 -9
- package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisFunctions.d.ts +0 -46
- package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisFunctions.js +0 -2285
- package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.d.ts +0 -169
- package/dist/Components1/Charts/ChartsWithAxis/ChartsWithAxisTypes.type.js +0 -47
- package/dist/Components1/Charts/ChartsWithAxis/LineFamily/LineChart.d.ts +0 -4
- package/dist/Components1/Charts/ChartsWithAxis/LineFamily/LineChart.js +0 -403
- package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.d.ts +0 -0
- package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisFunctions.js +0 -0
- package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.d.ts +0 -0
- package/dist/Components1/Charts/ChartsWithoutAxis/ChartsWithoutAxisTypes.type.js +0 -0
- package/dist/Components1/Charts/Core/Common.type.d.ts +0 -8
- package/dist/Components1/Charts/Core/Common.type.js +0 -9
- package/dist/Components1/Charts/Core/CommonFunctions.d.ts +0 -12
- package/dist/Components1/Charts/Core/CommonFunctions.js +0 -512
- package/dist/Components1/Charts/Core/DefaultProperties.d.ts +0 -586
- package/dist/Components1/Charts/Core/DefaultProperties.js +0 -585
|
@@ -1,512 +0,0 @@
|
|
|
1
|
-
import { calculateWidthHeightDynamically } from "../ChartsWithAxis/ChartsWithAxisFunctions";
|
|
2
|
-
import { actualChartTypes } from "../ChartsWithAxis/ChartsWithAxisTypes.type";
|
|
3
|
-
import { legendShape } from "../Core/Common.type";
|
|
4
|
-
const chartsWithDataTableArray = [
|
|
5
|
-
actualChartTypes.bar,
|
|
6
|
-
actualChartTypes.stackColumn,
|
|
7
|
-
actualChartTypes.stackColumn100,
|
|
8
|
-
actualChartTypes.line,
|
|
9
|
-
actualChartTypes.stackLine,
|
|
10
|
-
actualChartTypes.stackLine100,
|
|
11
|
-
actualChartTypes.area,
|
|
12
|
-
actualChartTypes.stackArea,
|
|
13
|
-
actualChartTypes.stackArea100,
|
|
14
|
-
];
|
|
15
|
-
const chartsWithoutPlotArea = [
|
|
16
|
-
actualChartTypes.pie,
|
|
17
|
-
actualChartTypes.pieOfPie,
|
|
18
|
-
actualChartTypes.sunburst,
|
|
19
|
-
actualChartTypes.pyramidChart,
|
|
20
|
-
actualChartTypes.organizationalChart,
|
|
21
|
-
actualChartTypes.vennDiagramChart,
|
|
22
|
-
actualChartTypes.progressChart,
|
|
23
|
-
actualChartTypes.maps,
|
|
24
|
-
actualChartTypes.wordCloud,
|
|
25
|
-
actualChartTypes.sankey,
|
|
26
|
-
actualChartTypes.speedometerChart,
|
|
27
|
-
actualChartTypes.radialBarChart,
|
|
28
|
-
];
|
|
29
|
-
export function getRandomColor() {
|
|
30
|
-
let letters = "0123456789ABCDEF";
|
|
31
|
-
let color = "#";
|
|
32
|
-
for (let i = 0; i < 6; i++) {
|
|
33
|
-
color += letters[Math.floor(Math.random() * 16)];
|
|
34
|
-
}
|
|
35
|
-
return { color };
|
|
36
|
-
}
|
|
37
|
-
export function getCircleShape(d, innerDiv) {
|
|
38
|
-
innerDiv
|
|
39
|
-
.append("div")
|
|
40
|
-
.style("height", "12px")
|
|
41
|
-
.style("width", "12px")
|
|
42
|
-
.style("border-radius", "50%")
|
|
43
|
-
.style("background", d.properties.Color);
|
|
44
|
-
}
|
|
45
|
-
export function getHollowCircleShape(d, innerDiv) {
|
|
46
|
-
innerDiv
|
|
47
|
-
.append("div")
|
|
48
|
-
.style("height", "12px")
|
|
49
|
-
.style("width", "12px")
|
|
50
|
-
.style("border-radius", "50%")
|
|
51
|
-
.style("border", `3px solid ${d.properties.Color}`);
|
|
52
|
-
}
|
|
53
|
-
export function getLineShape(d, innerDiv, formatOptions) {
|
|
54
|
-
let shape = innerDiv
|
|
55
|
-
.append("div")
|
|
56
|
-
.style("height", "2px")
|
|
57
|
-
.style("width", "22px")
|
|
58
|
-
.style("background", d.properties.LineStyle == "Solid" ? d.properties.Color : "transparent")
|
|
59
|
-
.style("position", "relative")
|
|
60
|
-
.style("border-top", d.properties.LineStyle == "None" ? "unset" : d.properties.LineStyle == "Dotted" ? "2px dotted " + d.color : "2px dashed " + d.color);
|
|
61
|
-
if (formatOptions.marker.markerVisibility) {
|
|
62
|
-
switch (d.properties.markershape.toLowerCase()) {
|
|
63
|
-
case "circle":
|
|
64
|
-
shape
|
|
65
|
-
.append("div")
|
|
66
|
-
.append("svg")
|
|
67
|
-
.style("position", "absolute")
|
|
68
|
-
.style("left", "50%")
|
|
69
|
-
.style("top", "50%")
|
|
70
|
-
.attr("transform", "translate(-5,-6)")
|
|
71
|
-
.attr("height", "10px")
|
|
72
|
-
.attr("width", "10px")
|
|
73
|
-
.append("circle")
|
|
74
|
-
.attr("cx", "5")
|
|
75
|
-
.attr("cy", "5")
|
|
76
|
-
.attr("r", "4.5")
|
|
77
|
-
.style("fill", d.properties.markercolor);
|
|
78
|
-
break;
|
|
79
|
-
case "square":
|
|
80
|
-
shape
|
|
81
|
-
.append("div")
|
|
82
|
-
.style("position", "absolute")
|
|
83
|
-
.style("left", "50%")
|
|
84
|
-
.style("top", "50%")
|
|
85
|
-
.style("transform", "translate(-2px, -7px)")
|
|
86
|
-
.style("height", "8px")
|
|
87
|
-
.style("width", "8px")
|
|
88
|
-
.style("top", "2px")
|
|
89
|
-
.style("left", "9px")
|
|
90
|
-
.style("background", d.properties.markercolor);
|
|
91
|
-
break;
|
|
92
|
-
case "triangle":
|
|
93
|
-
shape
|
|
94
|
-
.append("div")
|
|
95
|
-
.style("position", "absolute")
|
|
96
|
-
.style("transform", "translate(5px, -6.5px)")
|
|
97
|
-
.style("border-left", "6px solid transparent")
|
|
98
|
-
.style("border-right", "6px solid transparent")
|
|
99
|
-
.style("border-bottom", `10px solid ${d.properties.markercolor}`);
|
|
100
|
-
break;
|
|
101
|
-
case "cross":
|
|
102
|
-
shape
|
|
103
|
-
.append("div")
|
|
104
|
-
.style("position", "absolute")
|
|
105
|
-
.style("left", "50%")
|
|
106
|
-
.style("top", "50%")
|
|
107
|
-
.style("transform", "translate(-5px, -3px)")
|
|
108
|
-
.style("height", "4px")
|
|
109
|
-
.style("width", "10px")
|
|
110
|
-
.style("background", d.properties.markercolor)
|
|
111
|
-
.append("div")
|
|
112
|
-
.style("height", "10px")
|
|
113
|
-
.style("width", "4px")
|
|
114
|
-
.style("background", d.properties.markercolor)
|
|
115
|
-
.style("position", "relative")
|
|
116
|
-
.style("top", "-3px")
|
|
117
|
-
.style("left", "3px");
|
|
118
|
-
break;
|
|
119
|
-
case "diamond":
|
|
120
|
-
shape
|
|
121
|
-
.append("div")
|
|
122
|
-
.style("height", "7px")
|
|
123
|
-
.style("width", "7px")
|
|
124
|
-
.style("background", d.properties.markercolor)
|
|
125
|
-
.style("transform", "rotate(45deg)")
|
|
126
|
-
.style("top", "-4px")
|
|
127
|
-
.style("left", "7px")
|
|
128
|
-
.style("position", "absolute");
|
|
129
|
-
break;
|
|
130
|
-
case "star":
|
|
131
|
-
shape
|
|
132
|
-
.append("div")
|
|
133
|
-
.style("border-left", "4px solid transparent")
|
|
134
|
-
.style("border-right", "4px solid transparent")
|
|
135
|
-
.style("border-bottom", `8px solid ${d.properties.markercolor}`)
|
|
136
|
-
.style("position", "absolute")
|
|
137
|
-
.style("top", "-6.5px")
|
|
138
|
-
.style("left", "7px")
|
|
139
|
-
.style("transform", "rotate(0deg)")
|
|
140
|
-
.append("div")
|
|
141
|
-
.style("border-left", "4px solid transparent")
|
|
142
|
-
.style("border-right", "4px solid transparent")
|
|
143
|
-
.style("border-top", `8px solid ${d.properties.markercolor}`)
|
|
144
|
-
.style("position", "absolute")
|
|
145
|
-
.style("top", "2px")
|
|
146
|
-
.style("left", "-4px")
|
|
147
|
-
.style("transform", "rotate(360deg)");
|
|
148
|
-
break;
|
|
149
|
-
case "wye":
|
|
150
|
-
shape
|
|
151
|
-
.append("div")
|
|
152
|
-
.style("height", "6.5px")
|
|
153
|
-
.style("width", "3px")
|
|
154
|
-
.style("background", d.properties.markercolor)
|
|
155
|
-
.style("position", "absolute")
|
|
156
|
-
.style("left", "10px")
|
|
157
|
-
.style("top", "-3.5px")
|
|
158
|
-
.append("div")
|
|
159
|
-
.style("height", "5px")
|
|
160
|
-
.style("width", "3px")
|
|
161
|
-
.style("background", d.properties.markercolor)
|
|
162
|
-
.style("transform", "rotate(-55deg)")
|
|
163
|
-
.style("position", "relative")
|
|
164
|
-
.style("top", "-2px")
|
|
165
|
-
.style("left", "-2px")
|
|
166
|
-
.append("div")
|
|
167
|
-
.style("height", "5px")
|
|
168
|
-
.style("width", "3px")
|
|
169
|
-
.style("background", d.properties.markercolor)
|
|
170
|
-
.style("transform", "rotate(108deg)")
|
|
171
|
-
.style("position", "relative")
|
|
172
|
-
.style("top", "3px")
|
|
173
|
-
.style("left", "2px");
|
|
174
|
-
break;
|
|
175
|
-
case "none":
|
|
176
|
-
shape;
|
|
177
|
-
default:
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
export function getAreaShape(d, innerDiv, formatOptions) {
|
|
183
|
-
let flexdiv = innerDiv
|
|
184
|
-
.append("div")
|
|
185
|
-
.style("height", "10px")
|
|
186
|
-
.style("width", "15px")
|
|
187
|
-
.style("background", d.color)
|
|
188
|
-
.style("display", "flex")
|
|
189
|
-
.style("flex-direction", "column")
|
|
190
|
-
.style("border-radius", "1px");
|
|
191
|
-
if (formatOptions.Marker.markerVisibility) {
|
|
192
|
-
switch (d.markershape[0].toLowerCase()) {
|
|
193
|
-
case "circle":
|
|
194
|
-
flexdiv
|
|
195
|
-
.append("div")
|
|
196
|
-
.style("height", "20%")
|
|
197
|
-
.style("width", "100%")
|
|
198
|
-
.style("background", d.color)
|
|
199
|
-
.style("position", "relative")
|
|
200
|
-
.append("svg")
|
|
201
|
-
.style("position", "absolute")
|
|
202
|
-
.style("left", "50%")
|
|
203
|
-
.style("top", "50%")
|
|
204
|
-
.attr("transform", "translate(-5,-5)")
|
|
205
|
-
.attr("height", "10px")
|
|
206
|
-
.attr("width", "10px")
|
|
207
|
-
.append("circle")
|
|
208
|
-
.attr("cx", "5")
|
|
209
|
-
.attr("cy", "5")
|
|
210
|
-
.attr("r", "2.5")
|
|
211
|
-
.style("fill", d.properties.markercolor);
|
|
212
|
-
break;
|
|
213
|
-
case "square":
|
|
214
|
-
flexdiv
|
|
215
|
-
.append("div")
|
|
216
|
-
.style("height", "20%")
|
|
217
|
-
.style("width", "100%")
|
|
218
|
-
.style("background", d.properties.markercolor)
|
|
219
|
-
.style("position", "relative")
|
|
220
|
-
.append("div")
|
|
221
|
-
.style("position", "absolute")
|
|
222
|
-
.style("left", "50%")
|
|
223
|
-
.style("top", "50%")
|
|
224
|
-
.style("transform", "translate(-4px, -3.5px)")
|
|
225
|
-
.style("height", "5px")
|
|
226
|
-
.style("width", "5px")
|
|
227
|
-
.style("top", "2px")
|
|
228
|
-
.style("left", "9px")
|
|
229
|
-
.style("background", d.properties.markercolor)
|
|
230
|
-
.style("border-radius", "1px");
|
|
231
|
-
break;
|
|
232
|
-
case "triangle":
|
|
233
|
-
flexdiv
|
|
234
|
-
.append("div")
|
|
235
|
-
.style("height", "20%")
|
|
236
|
-
.style("width", "100%")
|
|
237
|
-
.style("background", d.properties.markercolor)
|
|
238
|
-
.style("position", "relative")
|
|
239
|
-
.append("div")
|
|
240
|
-
.style("position", "absolute")
|
|
241
|
-
.style("transform", "translate(5px, -3.5px)")
|
|
242
|
-
.style("border-left", "3px solid transparent")
|
|
243
|
-
.style("border-right", "3px solid transparent")
|
|
244
|
-
.style("border-bottom", `7px solid ${d.properties.markercolor}`);
|
|
245
|
-
break;
|
|
246
|
-
case "cross":
|
|
247
|
-
flexdiv
|
|
248
|
-
.append("div")
|
|
249
|
-
.style("height", "20%")
|
|
250
|
-
.style("width", "100%")
|
|
251
|
-
.style("background", d.properties.markercolor)
|
|
252
|
-
.style("position", "relative")
|
|
253
|
-
.append("div")
|
|
254
|
-
.style("position", "absolute")
|
|
255
|
-
.style("left", "50%")
|
|
256
|
-
.style("top", "50%")
|
|
257
|
-
.style("transform", "translate(-3px, -2px)")
|
|
258
|
-
.style("height", "4px")
|
|
259
|
-
.style("width", "7px")
|
|
260
|
-
.style("background", d.properties.markercolor)
|
|
261
|
-
.append("div")
|
|
262
|
-
.style("height", "6px")
|
|
263
|
-
.style("width", "3px")
|
|
264
|
-
.style("background", d.properties.markercolor)
|
|
265
|
-
.style("position", "relative")
|
|
266
|
-
.style("top", "-1px")
|
|
267
|
-
.style("left", "2px");
|
|
268
|
-
break;
|
|
269
|
-
case "diamond":
|
|
270
|
-
flexdiv
|
|
271
|
-
.append("div")
|
|
272
|
-
.style("height", "20%")
|
|
273
|
-
.style("width", "100%")
|
|
274
|
-
.style("background", d.properties.markercolor)
|
|
275
|
-
.style("position", "relative")
|
|
276
|
-
.append("div")
|
|
277
|
-
.style("height", "4px")
|
|
278
|
-
.style("width", "4px")
|
|
279
|
-
.style("background", d.properties.markercolor)
|
|
280
|
-
.style("transform", "rotate(45deg)")
|
|
281
|
-
.style("top", "-1px")
|
|
282
|
-
.style("left", "5px")
|
|
283
|
-
.style("position", "absolute");
|
|
284
|
-
break;
|
|
285
|
-
case "star":
|
|
286
|
-
flexdiv
|
|
287
|
-
.append("div")
|
|
288
|
-
.style("height", "20%")
|
|
289
|
-
.style("width", "100%")
|
|
290
|
-
.style("background", d.properties.markercolor)
|
|
291
|
-
.style("position", "relative")
|
|
292
|
-
.append("div")
|
|
293
|
-
.style("border-left", "2.5px solid transparent")
|
|
294
|
-
.style("border-right", "2.5px solid transparent")
|
|
295
|
-
.style("border-bottom", `6px solid ${d.properties.markercolor}`)
|
|
296
|
-
.style("position", "absolute")
|
|
297
|
-
.style("top", "-3px")
|
|
298
|
-
.style("left", "6px")
|
|
299
|
-
.style("transform", "rotate(0deg)")
|
|
300
|
-
.append("div")
|
|
301
|
-
.style("border-left", "2.5px solid transparent")
|
|
302
|
-
.style("border-right", "2.5px solid transparent")
|
|
303
|
-
.style("border-top", `6px solid ${d.properties.markercolor}`)
|
|
304
|
-
.style("position", "absolute")
|
|
305
|
-
.style("top", "0.5px")
|
|
306
|
-
.style("left", "-2px")
|
|
307
|
-
.style("transform", "rotate(360deg)");
|
|
308
|
-
break;
|
|
309
|
-
case "wye":
|
|
310
|
-
flexdiv
|
|
311
|
-
.append("div")
|
|
312
|
-
.style("height", "20%")
|
|
313
|
-
.style("width", "100%")
|
|
314
|
-
.style("background", d.properties.markercolor)
|
|
315
|
-
.style("position", "relative")
|
|
316
|
-
.append("div")
|
|
317
|
-
.style("height", "4.5px")
|
|
318
|
-
.style("width", "2px")
|
|
319
|
-
.style("background", d.properties.markercolor)
|
|
320
|
-
.style("position", "absolute")
|
|
321
|
-
.style("left", "6.5px")
|
|
322
|
-
.style("top", "-0.5px")
|
|
323
|
-
.append("div")
|
|
324
|
-
.style("height", "3px")
|
|
325
|
-
.style("width", "2px")
|
|
326
|
-
.style("background", d.properties.markercolor)
|
|
327
|
-
.style("transform", "rotate(-55deg)")
|
|
328
|
-
.style("position", "relative")
|
|
329
|
-
.style("top", "-2px")
|
|
330
|
-
.style("left", "-2px")
|
|
331
|
-
.append("div")
|
|
332
|
-
.style("height", "3px")
|
|
333
|
-
.style("width", "2px")
|
|
334
|
-
.style("background", d.properties.markercolor)
|
|
335
|
-
.style("transform", "rotate(108deg)")
|
|
336
|
-
.style("position", "relative")
|
|
337
|
-
.style("top", "3px")
|
|
338
|
-
.style("left", "2px");
|
|
339
|
-
break;
|
|
340
|
-
case "none":
|
|
341
|
-
flexdiv
|
|
342
|
-
.append("div")
|
|
343
|
-
.style("height", "20%")
|
|
344
|
-
.style("width", "100%")
|
|
345
|
-
.style("background", d.properties.markercolor);
|
|
346
|
-
break;
|
|
347
|
-
default:
|
|
348
|
-
break;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
flexdiv
|
|
352
|
-
.append("div")
|
|
353
|
-
.style("height", "20%")
|
|
354
|
-
.style("width", "100%")
|
|
355
|
-
.style("background", "white");
|
|
356
|
-
flexdiv
|
|
357
|
-
.append("div")
|
|
358
|
-
.style("height", "60%")
|
|
359
|
-
.style("width", "100%")
|
|
360
|
-
.style("background", d.color)
|
|
361
|
-
.style("border-radius", "1px");
|
|
362
|
-
}
|
|
363
|
-
export function getReactShape(d, innerDiv) {
|
|
364
|
-
innerDiv
|
|
365
|
-
.append("div")
|
|
366
|
-
.style("height", "10px")
|
|
367
|
-
.style("width", "15px")
|
|
368
|
-
.style("border-style", d)
|
|
369
|
-
.style("border-width", d)
|
|
370
|
-
.style("border-color", d)
|
|
371
|
-
.style("background", d.color)
|
|
372
|
-
.style("border-radius", "1px");
|
|
373
|
-
}
|
|
374
|
-
export const legendsWithScroll = (svg, seriesData, x, y, width, height, legendPosition, alignment, shape, chartFormatOptions, chartId) => {
|
|
375
|
-
let justifyContent = "";
|
|
376
|
-
let flexDirection = "";
|
|
377
|
-
if (legendPosition == "Left" || legendPosition == "Right") {
|
|
378
|
-
flexDirection = "column";
|
|
379
|
-
justifyContent =
|
|
380
|
-
alignment == "Top" ? "start" : alignment == "Middle" ? "center" : "end";
|
|
381
|
-
}
|
|
382
|
-
else {
|
|
383
|
-
flexDirection = "row";
|
|
384
|
-
justifyContent =
|
|
385
|
-
alignment == "Start"
|
|
386
|
-
? "start"
|
|
387
|
-
: alignment == "Middle"
|
|
388
|
-
? "center"
|
|
389
|
-
: "end";
|
|
390
|
-
}
|
|
391
|
-
let object = svg
|
|
392
|
-
.append("foreignObject")
|
|
393
|
-
.attr("x", x)
|
|
394
|
-
.attr("y", y)
|
|
395
|
-
.style("pointer-events", "auto")
|
|
396
|
-
.attr("width", width + "px")
|
|
397
|
-
.attr("height", height + "px")
|
|
398
|
-
.style("user-select", "none");
|
|
399
|
-
var div = object
|
|
400
|
-
.append("xhtml:div")
|
|
401
|
-
.attr("id", "legendObject" + chartId)
|
|
402
|
-
.attr("class", "legendsBoxWrapper")
|
|
403
|
-
.style("width", width + "px")
|
|
404
|
-
.style("display", "flex")
|
|
405
|
-
.style("height", height - 1 + "px")
|
|
406
|
-
.style("overflow", "auto")
|
|
407
|
-
.style("pointer-events", "auto")
|
|
408
|
-
.style("justify-content", justifyContent)
|
|
409
|
-
.style("flex-direction", flexDirection)
|
|
410
|
-
.style("outline-offset", -chartFormatOptions.legends.legendBorderThickness + "px")
|
|
411
|
-
.style("outline", chartFormatOptions.legends.legendBorder
|
|
412
|
-
? `${chartFormatOptions.legends.legendBorderThickness +
|
|
413
|
-
"px" +
|
|
414
|
-
" solid" +
|
|
415
|
-
chartFormatOptions.legends.legendBorderColor}`
|
|
416
|
-
: "none")
|
|
417
|
-
.append("div")
|
|
418
|
-
// .style("width", "100%")
|
|
419
|
-
.attr("class", "scrollbar")
|
|
420
|
-
.style("display", "flex")
|
|
421
|
-
.style("justify-content", justifyContent)
|
|
422
|
-
.style("flex-direction", flexDirection)
|
|
423
|
-
.style("flex-wrap", "nowrap")
|
|
424
|
-
.style("padding-left", "3px");
|
|
425
|
-
if (legendPosition == "Bottom" || legendPosition == "Top")
|
|
426
|
-
div.style("flex-direction", "row");
|
|
427
|
-
seriesData.forEach((d, i) => {
|
|
428
|
-
let innerdiv = div
|
|
429
|
-
.append("div")
|
|
430
|
-
.style("display", "inline-flex")
|
|
431
|
-
.style("justify-content", "flex-start")
|
|
432
|
-
.style("align-items", "center")
|
|
433
|
-
.style("width", "fit-content")
|
|
434
|
-
.style("margin", "3px 0px")
|
|
435
|
-
.style("flex-wrap", "nowrap")
|
|
436
|
-
.style("white-space", "nowrap")
|
|
437
|
-
.on("mousemove", function (d) {
|
|
438
|
-
if (chartFormatOptions.legends.onHoverEffect) {
|
|
439
|
-
svg
|
|
440
|
-
.selectAll(".parentGroup")
|
|
441
|
-
.classed("highlight", false)
|
|
442
|
-
.classed("unhighlight", true);
|
|
443
|
-
svg
|
|
444
|
-
.selectAll('[hoverId="' + this.textContent.replace(/ /g, "-") + '"]')
|
|
445
|
-
.classed("highlight", true)
|
|
446
|
-
.classed("unhighlight", false);
|
|
447
|
-
}
|
|
448
|
-
})
|
|
449
|
-
.on("mouseout", function (d) {
|
|
450
|
-
if (chartFormatOptions.legends.onHoverEffect) {
|
|
451
|
-
svg
|
|
452
|
-
.selectAll(".parentGroup")
|
|
453
|
-
.classed("highlight", false)
|
|
454
|
-
.classed("unhighlight", false);
|
|
455
|
-
svg
|
|
456
|
-
.selectAll('[hoverId="' + this.textContent.replace(/ /g, "-") + '"]')
|
|
457
|
-
.classed("highlight", false)
|
|
458
|
-
.classed("unhighlight", false);
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
if (legendPosition == "Bottom" || legendPosition == "Top") {
|
|
462
|
-
innerdiv.style("margin-right", "16px").style("white-space", "nowrap");
|
|
463
|
-
}
|
|
464
|
-
if (shape == legendShape.circle) {
|
|
465
|
-
getCircleShape(d, innerdiv);
|
|
466
|
-
}
|
|
467
|
-
else if (shape == legendShape.hollowCircle) {
|
|
468
|
-
getHollowCircleShape(d, innerdiv);
|
|
469
|
-
}
|
|
470
|
-
else if (shape == legendShape.line) {
|
|
471
|
-
getLineShape(d, innerdiv, chartFormatOptions);
|
|
472
|
-
}
|
|
473
|
-
else if (shape == legendShape.areaWithLine) {
|
|
474
|
-
getAreaShape(d, innerdiv, chartFormatOptions);
|
|
475
|
-
}
|
|
476
|
-
else if (shape == legendShape.rectangle) {
|
|
477
|
-
getReactShape(d, innerdiv);
|
|
478
|
-
}
|
|
479
|
-
let legendColor = chartFormatOptions.legends.legendColorMode == 1
|
|
480
|
-
? d.properties.color
|
|
481
|
-
? d.properties.color
|
|
482
|
-
: "#000000"
|
|
483
|
-
: chartFormatOptions.legends.legendSelectedUnicolor;
|
|
484
|
-
innerdiv
|
|
485
|
-
.append("div")
|
|
486
|
-
.style("margin-left", "5px")
|
|
487
|
-
.style("color", legendColor)
|
|
488
|
-
.attr("title", d)
|
|
489
|
-
.style("font-size", d.properties.fontSize + "px")
|
|
490
|
-
.style("font-family", d.properties.fontFamily)
|
|
491
|
-
.style("font-style", d.properties.fontStyle.includes("Italic") ? "Italic" : "")
|
|
492
|
-
.style("text-decoration", d.properties.fontStyle.includes("Underline") ? "Underline" : "")
|
|
493
|
-
.style("font-weight", d.properties.fontStyle.includes("Bold") ? "Bold" : "")
|
|
494
|
-
.style("white-space", "nowrap")
|
|
495
|
-
.attr("title", d.legend)
|
|
496
|
-
.html(d.legend);
|
|
497
|
-
});
|
|
498
|
-
};
|
|
499
|
-
export function calculateMaxLegendWidth(list, formatOptions) {
|
|
500
|
-
let maxLength = 0;
|
|
501
|
-
let maxLegend = list[0];
|
|
502
|
-
list.forEach(legend => {
|
|
503
|
-
//legend.includes("-") ? legend.split("-")[1] :
|
|
504
|
-
let splitedLegend = legend.includes("~$~") ? legend.split("~$~")[1] : legend.includes("-") ? legend.slice(legend.indexOf("-") + 1) : legend;
|
|
505
|
-
let splitedLegendLength = splitedLegend.length;
|
|
506
|
-
if (maxLength < splitedLegendLength) {
|
|
507
|
-
maxLength = splitedLegendLength;
|
|
508
|
-
maxLegend = splitedLegend;
|
|
509
|
-
}
|
|
510
|
-
});
|
|
511
|
-
return calculateWidthHeightDynamically(maxLegend, formatOptions.legends.legendFontSize, formatOptions.legends.legendFontFamily);
|
|
512
|
-
}
|