fluency-v8-components 1.3.5 → 1.3.6

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.
Files changed (178) hide show
  1. package/dist/fluency-v8-components.es.js +1 -1
  2. package/dist/fluency-v8-components.umd.js +99 -99
  3. package/dist/{index-q2NbjdVo.mjs → index-BBxccHNP.mjs} +7 -6
  4. package/dist/{index.es-PAPL4E6Y.mjs → index.es-D_XhLSeH.mjs} +1 -1
  5. package/package.json +3 -2
  6. package/src/assets/images/ai.svg +1 -0
  7. package/src/assets/images/github-dark.svg +1 -0
  8. package/src/assets/images/github.svg +1 -0
  9. package/src/assets/images/high-priority.svg +1 -0
  10. package/src/assets/images/power-off.svg +1 -0
  11. package/src/assets/images/save.svg +1 -0
  12. package/src/assets/index.ts +15 -0
  13. package/src/assets/main.css +505 -0
  14. package/src/assets/prism-theme.css +290 -0
  15. package/src/components/buttons/ActionButtons.vue +374 -0
  16. package/src/components/buttons/DropdownButton.vue +104 -0
  17. package/src/components/buttons/IconButton.vue +63 -0
  18. package/src/components/buttons/ImageButton.vue +16 -0
  19. package/src/components/buttons/MenuButton.vue +138 -0
  20. package/src/components/buttons/SubmitButtons.vue +51 -0
  21. package/src/components/buttons/TextButton.vue +40 -0
  22. package/src/components/charts/AlertChart.vue +376 -0
  23. package/src/components/charts/BarChart.vue +212 -0
  24. package/src/components/charts/BarChartHorizontal.vue +243 -0
  25. package/src/components/charts/CronChart.vue +146 -0
  26. package/src/components/charts/EmptyChart.vue +76 -0
  27. package/src/components/charts/GradientChart.vue +310 -0
  28. package/src/components/charts/LineChart.test.js +59 -0
  29. package/src/components/charts/LineChart.vue +434 -0
  30. package/src/components/charts/PieChart.vue +293 -0
  31. package/src/components/charts/ProgressChart.vue +106 -0
  32. package/src/components/charts/StackedChart.vue +364 -0
  33. package/src/components/charts/StackedChartClustered.vue +395 -0
  34. package/src/components/charts/TimelineChart.vue +215 -0
  35. package/src/components/charts/WorkflowChart.vue +520 -0
  36. package/src/components/common/AutoCompleteSearchBar.vue +100 -0
  37. package/src/components/common/AutoRefreshButton.vue +53 -0
  38. package/src/components/common/Breadcrumb.vue +45 -0
  39. package/src/components/common/ButtonToggle.vue +24 -0
  40. package/src/components/common/Card.vue +116 -0
  41. package/src/components/common/Carousel.vue +66 -0
  42. package/src/components/common/CategoryCard.vue +28 -0
  43. package/src/components/common/CodeEditor.vue +59 -0
  44. package/src/components/common/DatePicker.vue +21 -0
  45. package/src/components/common/DatePickerInput.vue +109 -0
  46. package/src/components/common/Dialog.vue +103 -0
  47. package/src/components/common/EditorHeading.vue +10 -0
  48. package/src/components/common/EventList.vue +41 -0
  49. package/src/components/common/Facet.vue +206 -0
  50. package/src/components/common/Feed.vue +58 -0
  51. package/src/components/common/Flag.vue +27 -0
  52. package/src/components/common/HomeCard.vue +20 -0
  53. package/src/components/common/ItemBox.vue +49 -0
  54. package/src/components/common/Loading.vue +19 -0
  55. package/src/components/common/LoadingDots.vue +12 -0
  56. package/src/components/common/PageHeading.vue +30 -0
  57. package/src/components/common/Pagination.vue +105 -0
  58. package/src/components/common/Popover.vue +24 -0
  59. package/src/components/common/PowerToggle.vue +130 -0
  60. package/src/components/common/ProgressBar.vue +33 -0
  61. package/src/components/common/RadioButtons.vue +52 -0
  62. package/src/components/common/Schedule.vue +79 -0
  63. package/src/components/common/SearchBar.vue +30 -0
  64. package/src/components/common/Separator.vue +3 -0
  65. package/src/components/common/Slideout.vue +95 -0
  66. package/src/components/common/Sort.vue +83 -0
  67. package/src/components/common/Table.vue +48 -0
  68. package/src/components/common/Tabs.vue +129 -0
  69. package/src/components/common/Tag.vue +53 -0
  70. package/src/components/common/Tooltip.vue +49 -0
  71. package/src/components/common/VerticalTabs.vue +34 -0
  72. package/src/components/common/card/CardItem.vue +27 -0
  73. package/src/components/common/card/CardItemGroup.vue +45 -0
  74. package/src/components/common/facet/Leaf.vue +97 -0
  75. package/src/components/common/facet/TriState.vue +37 -0
  76. package/src/components/common/table/TableData.vue +48 -0
  77. package/src/components/common/table/TableHeader.vue +21 -0
  78. package/src/components/dialogs/ChooseValueDialog.vue +97 -0
  79. package/src/components/dialogs/ConfirmDialog.vue +73 -0
  80. package/src/components/dialogs/CopyDialog.vue +51 -0
  81. package/src/components/dialogs/DownloadDialog.vue +48 -0
  82. package/src/components/dialogs/NameDescDialog.vue +74 -0
  83. package/src/components/dialogs/NameDialog.vue +56 -0
  84. package/src/components/dialogs/PopupEditor.vue +113 -0
  85. package/src/components/dialogs/ProgressDialog.vue +58 -0
  86. package/src/components/dialogs/ResetPasswordDialog.vue +58 -0
  87. package/src/components/dialogs/Wizard.vue +99 -0
  88. package/src/components/dialogs/wizard/Stepper.vue +31 -0
  89. package/src/components/form/CheckBox.vue +26 -0
  90. package/src/components/form/Editor.vue +93 -0
  91. package/src/components/form/FormCol.vue +19 -0
  92. package/src/components/form/FormRow.vue +19 -0
  93. package/src/components/form/FormSection.vue +21 -0
  94. package/src/components/form/GreyForm.vue +7 -0
  95. package/src/components/form/GreyInput.vue +51 -0
  96. package/src/components/form/GreyInputAutocomplete.vue +100 -0
  97. package/src/components/form/GreyInputCopy.vue +66 -0
  98. package/src/components/form/GreyInputGrow.vue +42 -0
  99. package/src/components/form/GreyInputToken.vue +78 -0
  100. package/src/components/form/GreyPassword.vue +36 -0
  101. package/src/components/form/GreySelect.vue +154 -0
  102. package/src/components/form/GreySelectInput.vue +123 -0
  103. package/src/components/form/GreySelectInputMultiple.vue +218 -0
  104. package/src/components/form/GreyTel.vue +58 -0
  105. package/src/components/form/HamburgerItem.vue +95 -0
  106. package/src/components/form/KeyValueEntry.vue +74 -0
  107. package/src/components/form/RadioInput.vue +38 -0
  108. package/src/components/form/UploadFile.vue +99 -0
  109. package/src/components/icons/AiIcon.vue +6 -0
  110. package/src/components/icons/GithubIcon.vue +18 -0
  111. package/src/components/icons/HighPriorityIcon.vue +6 -0
  112. package/src/components/icons/PowerOffIcon.vue +6 -0
  113. package/src/components/icons/SaveIcon.vue +6 -0
  114. package/src/components/index.js +134 -0
  115. package/src/components/menu/DialogMenu.vue +142 -0
  116. package/src/components/menu/GrandChild.vue +39 -0
  117. package/src/components/menu/GridMenu.vue +88 -0
  118. package/src/components/menu/MenuAvatar.vue +66 -0
  119. package/src/components/menu/MenuDesktop.vue +90 -0
  120. package/src/components/notifications/Notify.vue +123 -0
  121. package/src/components/notifications/NotifyList.vue +130 -0
  122. package/src/components/page-structure/FacetPage.vue +77 -0
  123. package/src/components/query/Child.vue +63 -0
  124. package/src/components/query/LVDBQuery.vue +38 -0
  125. package/src/components/status/Active.vue +44 -0
  126. package/src/components/status/ScoreLevel.vue +43 -0
  127. package/src/components/status/Status.vue +51 -0
  128. package/src/components/status/TaskDot.vue +25 -0
  129. package/src/components/status/TaskStatus.vue +26 -0
  130. package/src/components/status/TicketStatus.vue +201 -0
  131. package/src/components/status/Trend.vue +20 -0
  132. package/src/components/tables/ArgumentRunTable.vue +96 -0
  133. package/src/components/tables/ArgumentTable.vue +67 -0
  134. package/src/components/tables/CloudFormationParameters.vue +25 -0
  135. package/src/constants/colors.js +248 -0
  136. package/src/constants/font-map.js +128 -0
  137. package/src/constants/fpl2.js +162 -0
  138. package/src/constants/icon-svg.js +405 -0
  139. package/src/constants/schedule.js +52 -0
  140. package/src/fpl/AddPanel.vue +237 -0
  141. package/src/fpl/Configs/Alert.vue +16 -0
  142. package/src/fpl/Configs/AlertSprite.vue +2 -0
  143. package/src/fpl/Configs/Chart.vue +63 -0
  144. package/src/fpl/Configs/Config.js +154 -0
  145. package/src/fpl/Configs/Counter.vue +35 -0
  146. package/src/fpl/Configs/Histogram.vue +70 -0
  147. package/src/fpl/Configs/IPMap.vue +37 -0
  148. package/src/fpl/Configs/Image.vue +163 -0
  149. package/src/fpl/Configs/MetricChart.vue +20 -0
  150. package/src/fpl/Configs/PieChart.vue +37 -0
  151. package/src/fpl/Configs/SparkChart.vue +41 -0
  152. package/src/fpl/Configs/StackedBarChart.vue +49 -0
  153. package/src/fpl/Configs/Table.vue +211 -0
  154. package/src/fpl/Configs/Text.vue +14 -0
  155. package/src/fpl/Configs/TopNChart.vue +37 -0
  156. package/src/fpl/Outputs/FPLAlert.vue +64 -0
  157. package/src/fpl/Outputs/FPLStream.vue +41 -0
  158. package/src/fpl/Outputs/FPLTable.vue +77 -0
  159. package/src/fpl/Panel.vue +202 -0
  160. package/src/fpl/Panels/Alert.vue +85 -0
  161. package/src/fpl/Panels/AlertSprite.vue +9 -0
  162. package/src/fpl/Panels/Chart.vue +98 -0
  163. package/src/fpl/Panels/Counter.vue +43 -0
  164. package/src/fpl/Panels/Histogram.vue +138 -0
  165. package/src/fpl/Panels/IPMap.vue +48 -0
  166. package/src/fpl/Panels/Image.vue +35 -0
  167. package/src/fpl/Panels/MetricChart.vue +97 -0
  168. package/src/fpl/Panels/PieChart.vue +54 -0
  169. package/src/fpl/Panels/SparkChart.vue +166 -0
  170. package/src/fpl/Panels/StackedBarChart.vue +74 -0
  171. package/src/fpl/Panels/Table.vue +103 -0
  172. package/src/fpl/Panels/Text.vue +24 -0
  173. package/src/fpl/Panels/TopNChart.vue +69 -0
  174. package/src/fpl/index.js +39 -0
  175. package/src/utils/download.js +220 -0
  176. package/src/utils/formatOutput.js +156 -0
  177. package/src/utils/random.js +32 -0
  178. package/src/utils/timeUtils.js +138 -0
@@ -0,0 +1,434 @@
1
+ <template>
2
+ <div :id="id" class="float-left">
3
+ <div :id="id + 'tooltip'" role="tooltip" class="tooltip"></div>
4
+ </div>
5
+ <div v-if="useLegend" :style="`height: ${height}px; overflow: auto`">
6
+ <div :id="id + 'legend'"></div>
7
+ </div>
8
+ </template>
9
+ <script>
10
+ import * as d3 from "d3";
11
+ import { platformMetricsLabels, chartColors } from "@/constants/colors";
12
+ import { humanCount, dataCount } from "@/utils/formatOutput";
13
+ import { adjustText, getTextWidth } from "@/constants/font-map";
14
+
15
+ export default {
16
+ props: {
17
+ id: {
18
+ type: String,
19
+ required: true,
20
+ },
21
+ data: {
22
+ type: Array,
23
+ required: true,
24
+ },
25
+ unit: {
26
+ type: String,
27
+ default: "Count",
28
+ },
29
+ width: {
30
+ type: Number,
31
+ default: 350,
32
+ },
33
+ height: {
34
+ type: Number,
35
+ default: 200,
36
+ },
37
+ hideZeros: {
38
+ type: Boolean,
39
+ default: true,
40
+ },
41
+ isTime: {
42
+ type: Boolean,
43
+ default: true,
44
+ },
45
+ tooltipOffset: {
46
+ type: String,
47
+ default: "layer",
48
+ },
49
+ slotName: {
50
+ type: String,
51
+ default: "Field",
52
+ },
53
+ valueName: {
54
+ type: String,
55
+ default: "Value",
56
+ },
57
+ useLegend: {
58
+ type: Boolean,
59
+ default: true,
60
+ },
61
+ theme: {
62
+ type: String,
63
+ default: "light",
64
+ },
65
+ },
66
+ data() {
67
+ return {
68
+ svg: null,
69
+ legend: null,
70
+ };
71
+ },
72
+ mounted() {
73
+ this.initializeChart();
74
+ this.createChart(this.data);
75
+ },
76
+ methods: {
77
+ initializeChart() {
78
+ this.svg = d3
79
+ .select("#" + this.id)
80
+ .append("svg")
81
+ .attr("width", this.width)
82
+ .attr("height", this.height);
83
+ },
84
+ createChart(rawData) {
85
+ let data = [];
86
+ rawData.forEach((d, i) => {
87
+ d.index = i;
88
+ d.values = d.values.map((v) => (isNaN(v) ? 0 : v));
89
+ const total = d.values.reduce((a, b) => a + b, 0);
90
+ d.total = isNaN(total) ? 0 : total;
91
+ if (!this.hideZeros) {
92
+ data.push(d);
93
+ } else if (total > 0) {
94
+ data.push(d);
95
+ }
96
+ });
97
+ data = data.sort((a, b) => b.total - a.total);
98
+ rawData = rawData.sort((a, b) => b.total - a.total);
99
+ // Declare the chart dimensions and margins.
100
+ const width = this.width;
101
+ const height = this.height;
102
+ const marginTop = 20;
103
+ const marginRight = 15;
104
+ const marginBottom = 30;
105
+ const marginLeft = 50;
106
+
107
+ // get the longest slots array and largest value
108
+ const hidden = [];
109
+
110
+ // Declare the tooltip mouseover functions
111
+ const mouseover = (event, d) => {
112
+ const slot = this.isTime ? new Date(d.slots).toUTCString() : d.slots;
113
+ const value =
114
+ this.unit === "Bytes (B)" || this.unit === "B"
115
+ ? dataCount(d.values) + "B"
116
+ : this.unit === "Percent (%)"
117
+ ? d.values.toFixed(2) + "%"
118
+ : this.unit === "$"
119
+ ? "$" + d.values.toFixed(2)
120
+ : humanCount(d.values);
121
+ const text = d.action
122
+ ? `${d.action}<br>${
123
+ this.isTime ? "Time" : this.slotName
124
+ }: ${slot}<br>${this.valueName}: ${value}`
125
+ : `${this.isTime ? "Time" : this.slotName}: ${slot}<br>${
126
+ this.valueName
127
+ }: ${value}`;
128
+ event.target.r.baseVal.value = 5;
129
+ d3.select("#" + this.id + "tooltip")
130
+ .html(text)
131
+ .style("opacity", 1)
132
+ .style("left", event[this.tooltipOffset + "X"] + 10 + "px")
133
+ .style("top", event[this.tooltipOffset + "Y"] + "px");
134
+ };
135
+ const mouseout = (event, d) => {
136
+ event.target.r.baseVal.value = 3;
137
+ d3.select("#" + this.id + "tooltip")
138
+ .style("opacity", 0)
139
+ .style("left", "0px")
140
+ .style("top", "0px");
141
+ };
142
+
143
+ // Declare the legend mouseover functions
144
+ const legendMouseover = (event, d) => {
145
+ const action = d.index;
146
+ if (event.target.classList.contains("show")) {
147
+ d3.selectAll("." + this.id + "line").attr("stroke-width", 1);
148
+ d3.selectAll("." + this.id + action + "line").attr(
149
+ "stroke-width",
150
+ 2.5
151
+ );
152
+ d3.selectAll("." + this.id + "points").attr("r", 1);
153
+ d3.selectAll("." + this.id + action + "points").attr("r", 3);
154
+ d3.selectAll("#" + this.id + action + "dots").attr("r", 6);
155
+ d3.selectAll("." + this.id + action + "labels").attr(
156
+ "font-weight",
157
+ 1000
158
+ );
159
+ }
160
+ };
161
+ const legendMouseout = (event, d) => {
162
+ const action = d.index;
163
+ d3.selectAll("." + this.id + "line").attr("stroke-width", 1.5);
164
+ d3.selectAll("." + this.id + "points").attr("r", 2.5);
165
+ d3.selectAll("#" + this.id + action + "dots").attr("r", 5);
166
+ d3.selectAll("." + this.id + action + "labels").attr(
167
+ "font-weight",
168
+ 500
169
+ );
170
+ };
171
+ const legendClick = (event, d) => {
172
+ const action = d.index;
173
+ if (event.target.classList.contains("show")) {
174
+ hidden.push(action);
175
+ event.target.classList.remove("show");
176
+ event.target.classList.add("hide");
177
+ d3.selectAll("#" + this.id + action + "dots").attr("opacity", "0.5");
178
+ } else {
179
+ hidden.splice(hidden.indexOf(action), 1);
180
+ event.target.classList.remove("hide");
181
+ event.target.classList.add("show");
182
+ d3.selectAll("#" + this.id + action + "dots").attr("opacity", "1");
183
+ }
184
+
185
+ // redraw the chart
186
+ d3.selectAll("." + this.id + "line").remove();
187
+ d3.selectAll("." + this.id + "points").remove();
188
+ d3.select("." + this.id + "xaxis").remove();
189
+ d3.select("." + this.id + "yaxis").remove();
190
+ drawAxis();
191
+ };
192
+
193
+ const drawAxis = () => {
194
+ const dat = data.filter((d) => !hidden.includes(d.index));
195
+ const axisVals = this.getAxisLargest(dat);
196
+ // Declare the x (horizontal position) scale.
197
+ const x = this.isTime
198
+ ? d3.scaleUtc(d3.extent(axisVals[0]), [
199
+ marginLeft,
200
+ width - marginRight,
201
+ ])
202
+ : d3.scaleBand(axisVals[0], [marginLeft, width - marginRight]);
203
+
204
+ // Declare the y (vertical position) scale.
205
+ const y = d3.scaleLinear(
206
+ [0, axisVals[1]],
207
+ [height - marginBottom, marginTop]
208
+ );
209
+
210
+ // Add the x-axis.
211
+ this.svg
212
+ .append("g")
213
+ .attr("class", this.id + "xaxis")
214
+ .attr("transform", `translate(0,${height - marginBottom})`)
215
+ .call(
216
+ this.isTime
217
+ ? d3
218
+ .axisBottom(x)
219
+ .ticks(width / 80)
220
+ .tickSizeOuter(0)
221
+ : d3
222
+ .axisBottom(x)
223
+ .ticks(width / 20)
224
+ .tickSizeOuter(0)
225
+ .tickFormat((d) => {
226
+ if (!this.isTime) {
227
+ return adjustText(
228
+ d,
229
+ ((width - marginRight) / axisVals[0].length) * 8
230
+ );
231
+ }
232
+ })
233
+ );
234
+
235
+ // Add the y-axis, remove the domain line, add grid lines and a label.
236
+ this.svg
237
+ .append("g")
238
+ .attr("class", this.id + "yaxis")
239
+ .attr("transform", `translate(${marginLeft},0)`)
240
+ .call(
241
+ d3
242
+ .axisLeft(y)
243
+ .ticks(height / 40)
244
+ .tickFormat((d) => {
245
+ return this.unit === "Bytes (B)" || this.unit === "B"
246
+ ? dataCount(d)
247
+ : humanCount(d);
248
+ })
249
+ )
250
+ .call((g) => g.select(".domain").remove())
251
+ .call((g) =>
252
+ g
253
+ .selectAll(".tick line")
254
+ .clone()
255
+ .attr("x2", width - marginLeft - marginRight)
256
+ .attr("stroke-opacity", 0.1)
257
+ )
258
+ .call((g) =>
259
+ g
260
+ .append("text")
261
+ .attr("x", -marginLeft)
262
+ .attr("y", 10)
263
+ .attr("fill", "currentColor")
264
+ .attr("text-anchor", "start")
265
+ .text(this.unit)
266
+ );
267
+
268
+ // Declare the line generator.
269
+ const line = d3
270
+ .line()
271
+ .x((d, i) => {
272
+ return x(d.slots);
273
+ })
274
+ .y((d, i) => {
275
+ return y(d.values);
276
+ });
277
+
278
+ const lines = this.svg
279
+ .selectAll(".line")
280
+ .data(dat)
281
+ .enter()
282
+ .append("path")
283
+ .attr("class", (d) => this.id + d.index + "line " + this.id + "line")
284
+ .attr("fill", "none")
285
+ .attr("z-index", 1)
286
+ .attr("stroke", (d) => {
287
+ return (
288
+ platformMetricsLabels[this.theme][d.action] ||
289
+ chartColors[d.index % chartColors.length]
290
+ );
291
+ })
292
+ .attr("stroke-width", 1.5)
293
+ .attr("d", function (d) {
294
+ return line(
295
+ d.slots.map((slot, i) => {
296
+ return { slots: slot, values: d.values[i] };
297
+ })
298
+ );
299
+ });
300
+ const totalLength = lines.node()?.getTotalLength() || 0;
301
+ const totalDuration = 1200;
302
+ lines
303
+ .attr("stroke-dasharray", totalLength + " " + totalLength)
304
+ .attr("stroke-dashoffset", totalLength)
305
+ .transition()
306
+ .duration(totalDuration)
307
+ .ease(d3.easeLinear)
308
+ .attr("stroke-dashoffset", 0);
309
+
310
+ // Add points to the line chart
311
+ for (const series of dat) {
312
+ const seriesData = series.slots.map((slot, i) => {
313
+ return {
314
+ index: series.index,
315
+ action: series.action,
316
+ slots: slot,
317
+ values: series.values[i],
318
+ };
319
+ });
320
+ this.svg
321
+ .selectAll(".point")
322
+ .data(seriesData)
323
+ .enter()
324
+ .append("circle")
325
+ .attr(
326
+ "class",
327
+ (d) => this.id + d.index + "points " + this.id + "points"
328
+ )
329
+ .attr(
330
+ "fill",
331
+ (d) =>
332
+ platformMetricsLabels[this.theme][series.action] ||
333
+ chartColors[d.index % chartColors.length]
334
+ )
335
+ .attr("r", 2.5)
336
+ .attr("cx", (d) => x(d.slots))
337
+ .attr("cy", (d) => y(d.values))
338
+ .attr("opacity", 0)
339
+ .on("mouseover", mouseover)
340
+ .on("mouseout", mouseout)
341
+ .transition()
342
+ .delay((d, i) => {
343
+ return (i / seriesData.length) * totalDuration;
344
+ })
345
+ .duration(250)
346
+ .attr("opacity", 1);
347
+ }
348
+ };
349
+
350
+ drawAxis();
351
+ // Append a path for the line chart for each series
352
+ if (data.length === 0) {
353
+ this.svg
354
+ .append("text")
355
+ .attr("x", width / 2)
356
+ .attr("y", height / 2)
357
+ .attr("text-anchor", "middle")
358
+ .attr("fill", "currentColor")
359
+ .text("No data available");
360
+ }
361
+
362
+ // Add a legend
363
+ const longestLegend = Math.max(
364
+ ...rawData.map((d) => getTextWidth(d.action || "(no name)")),
365
+ 0
366
+ );
367
+ this.legend = d3
368
+ .select("#" + this.id + "legend")
369
+ .append("svg")
370
+ .attr("width", longestLegend / 7 + 30)
371
+ .attr("height", Math.max(25 * rawData.length, this.height));
372
+
373
+ // Add one dot in the legend for each name.
374
+ this.legend
375
+ .selectAll("legendDots")
376
+ .data(rawData)
377
+ .enter()
378
+ .append("circle")
379
+ .attr("id", (d) => this.id + d.index + "dots")
380
+ .attr("class", "show")
381
+ .attr("cx", 10)
382
+ .attr("cy", (d, i) => height / (rawData.length + 1) + i * 25 + 4)
383
+ .attr("r", 5)
384
+ .style("fill", (d) => {
385
+ return (
386
+ platformMetricsLabels[this.theme][d.action] ||
387
+ chartColors[d.index % chartColors.length]
388
+ );
389
+ })
390
+ .on("mouseover", legendMouseover)
391
+ .on("mouseout", legendMouseout)
392
+ .on("click", legendClick);
393
+
394
+ // Add one dot in the legend for each name.
395
+ this.legend
396
+ .selectAll("legendLabels")
397
+ .data(rawData)
398
+ .enter()
399
+ .append("text")
400
+ .attr("class", (d) => this.id + d.index + "labels")
401
+ .attr("x", 20)
402
+ .attr("y", (d, i) => height / (rawData.length + 1) + i * 25 + 5)
403
+ .style("fill", (d) => {
404
+ return (
405
+ platformMetricsLabels[this.theme][d.action] ||
406
+ chartColors[d.index % chartColors.length]
407
+ );
408
+ })
409
+ .text((d) => d.action || "(no name)")
410
+ .attr("font-weight", 500)
411
+ .attr("text-anchor", "left")
412
+ .attr("font-size", "13px")
413
+ .style("alignment-baseline", "middle");
414
+ },
415
+
416
+ getAxisLargest(data) {
417
+ let slots = [];
418
+ let largestValue = this.unit === "Percent (%)" ? 100 : 0;
419
+ data.forEach((d, i) => {
420
+ d.slots.forEach((slot) => {
421
+ if (!slots.includes(slot)) {
422
+ slots.push(slot);
423
+ }
424
+ });
425
+ const max = Math.max(...d.values);
426
+ if (max > largestValue) {
427
+ largestValue = max;
428
+ }
429
+ });
430
+ return [slots, largestValue];
431
+ },
432
+ },
433
+ };
434
+ </script>