@carbon/charts-vue 0.48.3 → 0.49.2

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/charts-vue.umd.js CHANGED
@@ -317,6 +317,7 @@ __webpack_require__.d(events_namespaceObject, "Tooltip", function() { return eve
317
317
  __webpack_require__.d(events_namespaceObject, "Threshold", function() { return events_Threshold; });
318
318
  __webpack_require__.d(events_namespaceObject, "Legend", function() { return events_Legend; });
319
319
  __webpack_require__.d(events_namespaceObject, "CirclePack", function() { return events_CirclePack; });
320
+ __webpack_require__.d(events_namespaceObject, "Alluvial", function() { return events_Alluvial; });
320
321
  __webpack_require__.d(events_namespaceObject, "Meter", function() { return events_Meter; });
321
322
  var configuration_namespaceObject = {};
322
323
  __webpack_require__.r(configuration_namespaceObject);
@@ -337,6 +338,7 @@ __webpack_require__.d(configuration_namespaceObject, "lines", function() { retur
337
338
  __webpack_require__.d(configuration_namespaceObject, "meter", function() { return meter; });
338
339
  __webpack_require__.d(configuration_namespaceObject, "pie", function() { return configuration_non_customizable_pie; });
339
340
  __webpack_require__.d(configuration_namespaceObject, "radar", function() { return radar; });
341
+ __webpack_require__.d(configuration_namespaceObject, "alluvial", function() { return alluvial; });
340
342
  __webpack_require__.d(configuration_namespaceObject, "spacers", function() { return spacers; });
341
343
  __webpack_require__.d(configuration_namespaceObject, "tooltips", function() { return tooltips; });
342
344
  __webpack_require__.d(configuration_namespaceObject, "transitions", function() { return configuration_non_customizable_transitions; });
@@ -634,6 +636,20 @@ var events_CirclePack;
634
636
  CirclePack["CIRCLE_MOUSEOUT"] = "circle-leaf-mouseout";
635
637
  CirclePack["CIRCLE_MOUSEMOVE"] = "circle-leaf-mousemove";
636
638
  })(events_CirclePack || (events_CirclePack = {}));
639
+ /**
640
+ * enum of all alluvial related events
641
+ */
642
+ var events_Alluvial;
643
+ (function (Alluvial) {
644
+ Alluvial["NODE_MOUSEOVER"] = "alluvial-node-mouseover";
645
+ Alluvial["NODE_CLICK"] = "alluvial-node-click";
646
+ Alluvial["NODE_MOUSEOUT"] = "alluvial-node-mouseout";
647
+ Alluvial["NODE_MOUSEMOVE"] = "alluvial-node-mousemove";
648
+ Alluvial["LINE_MOUSEOVER"] = "alluvial-line-mouseover";
649
+ Alluvial["LINE_CLICK"] = "alluvial-line-click";
650
+ Alluvial["LINE_MOUSEOUT"] = "alluvial-line-mouseout";
651
+ Alluvial["LINE_MOUSEMOVE"] = "alluvial-line-mousemove";
652
+ })(events_Alluvial || (events_Alluvial = {}));
637
653
  /**
638
654
  * enum of all meter related events
639
655
  */
@@ -1101,6 +1117,16 @@ var radar = {
1101
1117
  xAxisRectHeight: 50,
1102
1118
  dotsRadius: 5,
1103
1119
  };
1120
+ var alluvial = {
1121
+ nodeWidth: 4,
1122
+ nodeHoveredWidth: 8,
1123
+ minNodePadding: 24,
1124
+ opacity: {
1125
+ unfocus: 0.3,
1126
+ default: 0.8,
1127
+ selected: 1,
1128
+ },
1129
+ };
1104
1130
  var spacers = {
1105
1131
  default: {
1106
1132
  size: 24,
@@ -8748,6 +8774,16 @@ var circlePackChart = tools_Tools.merge({}, chart, circlePack, {
8748
8774
  groupMapsTo: 'name',
8749
8775
  }),
8750
8776
  });
8777
+ var alluvialChart = tools_Tools.merge({}, chart, {
8778
+ alluvial: {
8779
+ data: tools_Tools.merge(chart.data, {
8780
+ groupMapsTo: 'source',
8781
+ }),
8782
+ nodePadding: 24,
8783
+ monochrome: false,
8784
+ nodes: [],
8785
+ },
8786
+ });
8751
8787
  var configuration_options = {
8752
8788
  chart: chart,
8753
8789
  axisChart: axisChart,
@@ -8774,6 +8810,7 @@ var configuration_options = {
8774
8810
  treemapChart: treemapChart,
8775
8811
  circlePackChart: circlePackChart,
8776
8812
  wordCloudChart: wordCloudChart,
8813
+ alluvialChart: alluvialChart,
8777
8814
  };
8778
8815
 
8779
8816
  //# sourceMappingURL=../src/configuration.js.map
@@ -9417,7 +9454,9 @@ var model_ChartModel = /** @class */ (function () {
9417
9454
  var axesOptions = tools_Tools.getProperty(options, 'axes');
9418
9455
  // filter out the groups that are irrelevant to the component
9419
9456
  if (groups) {
9420
- allData = allData.filter(function (item) { return groups.includes(item.group); });
9457
+ allData = allData.filter(function (item) {
9458
+ return groups.includes(item[groupMapsTo]);
9459
+ });
9421
9460
  }
9422
9461
  if (axesOptions) {
9423
9462
  Object.keys(axesOptions).forEach(function (axis) {
@@ -19180,6 +19219,7 @@ var legend_Legend = /** @class */ (function (_super) {
19180
19219
  var userProvidedOrder = tools_Tools.getProperty(legendOptions, 'order');
19181
19220
  var svg = this.getComponentContainer()
19182
19221
  .classed('center-aligned', alignment === Alignments.CENTER)
19222
+ .classed('right-aligned', alignment === Alignments.RIGHT)
19183
19223
  .classed(legendOrientation, true)
19184
19224
  .classed('has-deactivated-items', hasDeactivatedItems)
19185
19225
  .attr('role', Roles.GROUP)
@@ -19443,12 +19483,12 @@ var legend_Legend = /** @class */ (function (_super) {
19443
19483
  }
19444
19484
  };
19445
19485
  Legend.prototype.truncateLegendText = function (addedLegendItemsText) {
19446
- var trucationOptions = tools_Tools.getProperty(this.getOptions(), 'legend', 'truncation');
19486
+ var truncationOptions = tools_Tools.getProperty(this.getOptions(), 'legend', 'truncation');
19447
19487
  // Truncation
19448
19488
  // get user provided custom values for truncation
19449
- var truncationType = tools_Tools.getProperty(trucationOptions, 'type');
19450
- var truncationThreshold = tools_Tools.getProperty(trucationOptions, 'threshold');
19451
- var truncationNumCharacter = tools_Tools.getProperty(trucationOptions, 'numCharacter');
19489
+ var truncationType = tools_Tools.getProperty(truncationOptions, 'type');
19490
+ var truncationThreshold = tools_Tools.getProperty(truncationOptions, 'threshold');
19491
+ var truncationNumCharacter = tools_Tools.getProperty(truncationOptions, 'numCharacter');
19452
19492
  // truncate the legend label if it's too long
19453
19493
  if (truncationType !== TruncationTypes.NONE) {
19454
19494
  addedLegendItemsText.html(function (d) {
@@ -26800,10 +26840,10 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
26800
26840
  var matchingDataPoint = displayData.find(function (d) {
26801
26841
  var domainIdentifier = self.services.cartesianScales.getDomainIdentifier(d);
26802
26842
  var rangeIdentifier = self.services.cartesianScales.getRangeIdentifier(d);
26803
- return (d[rangeIdentifier] === datum.data[datum.group] &&
26843
+ return (d[rangeIdentifier] === datum.data[datum[groupMapsTo]] &&
26804
26844
  d[domainIdentifier].toString() ===
26805
26845
  datum.data.sharedStackKey &&
26806
- d[groupMapsTo] === datum.group);
26846
+ d[groupMapsTo] === datum[groupMapsTo]);
26807
26847
  });
26808
26848
  if (matchingDataPoint === undefined) {
26809
26849
  // use the primary range and domain ids
@@ -26811,8 +26851,8 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
26811
26851
  var rangeIdentifier = self.services.cartesianScales.getRangeIdentifier();
26812
26852
  matchingDataPoint = (_a = {},
26813
26853
  _a[domainIdentifier] = datum.data.sharedStackKey,
26814
- _a[rangeIdentifier] = datum.data[datum.group],
26815
- _a[groupMapsTo] = datum.group,
26854
+ _a[rangeIdentifier] = datum.data[datum[groupMapsTo]],
26855
+ _a[groupMapsTo] = datum[groupMapsTo],
26816
26856
  _a);
26817
26857
  }
26818
26858
  // Show tooltip
@@ -34252,6 +34292,1191 @@ var wordcloud_WordCloud = /** @class */ (function (_super) {
34252
34292
  }(component_Component));
34253
34293
 
34254
34294
  //# sourceMappingURL=../../../src/components/graphs/wordcloud.js.map
34295
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/node_modules/d3-array/src/sum.js
34296
+ function src_sum_sum(values, valueof) {
34297
+ let sum = 0;
34298
+ if (valueof === undefined) {
34299
+ for (let value of values) {
34300
+ if (value = +value) {
34301
+ sum += value;
34302
+ }
34303
+ }
34304
+ } else {
34305
+ let index = -1;
34306
+ for (let value of values) {
34307
+ if (value = +valueof(value, ++index, values)) {
34308
+ sum += value;
34309
+ }
34310
+ }
34311
+ }
34312
+ return sum;
34313
+ }
34314
+
34315
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/node_modules/d3-array/src/max.js
34316
+ function src_max_max(values, valueof) {
34317
+ let max;
34318
+ if (valueof === undefined) {
34319
+ for (const value of values) {
34320
+ if (value != null
34321
+ && (max < value || (max === undefined && value >= value))) {
34322
+ max = value;
34323
+ }
34324
+ }
34325
+ } else {
34326
+ let index = -1;
34327
+ for (let value of values) {
34328
+ if ((value = valueof(value, ++index, values)) != null
34329
+ && (max < value || (max === undefined && value >= value))) {
34330
+ max = value;
34331
+ }
34332
+ }
34333
+ }
34334
+ return max;
34335
+ }
34336
+
34337
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/node_modules/d3-array/src/min.js
34338
+ function src_min_min(values, valueof) {
34339
+ let min;
34340
+ if (valueof === undefined) {
34341
+ for (const value of values) {
34342
+ if (value != null
34343
+ && (min > value || (min === undefined && value >= value))) {
34344
+ min = value;
34345
+ }
34346
+ }
34347
+ } else {
34348
+ let index = -1;
34349
+ for (let value of values) {
34350
+ if ((value = valueof(value, ++index, values)) != null
34351
+ && (min > value || (min === undefined && value >= value))) {
34352
+ min = value;
34353
+ }
34354
+ }
34355
+ }
34356
+ return min;
34357
+ }
34358
+
34359
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/src/align.js
34360
+
34361
+
34362
+ function targetDepth(d) {
34363
+ return d.target.depth;
34364
+ }
34365
+
34366
+ function align_left(node) {
34367
+ return node.depth;
34368
+ }
34369
+
34370
+ function align_right(node, n) {
34371
+ return n - 1 - node.height;
34372
+ }
34373
+
34374
+ function justify(node, n) {
34375
+ return node.sourceLinks.length ? node.depth : n - 1;
34376
+ }
34377
+
34378
+ function center(node) {
34379
+ return node.targetLinks.length ? node.depth
34380
+ : node.sourceLinks.length ? src_min_min(node.sourceLinks, targetDepth) - 1
34381
+ : 0;
34382
+ }
34383
+
34384
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/src/constant.js
34385
+ function constant_constant(x) {
34386
+ return function() {
34387
+ return x;
34388
+ };
34389
+ }
34390
+
34391
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/src/sankey.js
34392
+
34393
+
34394
+
34395
+
34396
+ function ascendingSourceBreadth(a, b) {
34397
+ return ascendingBreadth(a.source, b.source) || a.index - b.index;
34398
+ }
34399
+
34400
+ function ascendingTargetBreadth(a, b) {
34401
+ return ascendingBreadth(a.target, b.target) || a.index - b.index;
34402
+ }
34403
+
34404
+ function ascendingBreadth(a, b) {
34405
+ return a.y0 - b.y0;
34406
+ }
34407
+
34408
+ function sankey_value(d) {
34409
+ return d.value;
34410
+ }
34411
+
34412
+ function defaultId(d) {
34413
+ return d.index;
34414
+ }
34415
+
34416
+ function defaultNodes(graph) {
34417
+ return graph.nodes;
34418
+ }
34419
+
34420
+ function defaultLinks(graph) {
34421
+ return graph.links;
34422
+ }
34423
+
34424
+ function sankey_find(nodeById, id) {
34425
+ const node = nodeById.get(id);
34426
+ if (!node) throw new Error("missing: " + id);
34427
+ return node;
34428
+ }
34429
+
34430
+ function computeLinkBreadths({nodes}) {
34431
+ for (const node of nodes) {
34432
+ let y0 = node.y0;
34433
+ let y1 = y0;
34434
+ for (const link of node.sourceLinks) {
34435
+ link.y0 = y0 + link.width / 2;
34436
+ y0 += link.width;
34437
+ }
34438
+ for (const link of node.targetLinks) {
34439
+ link.y1 = y1 + link.width / 2;
34440
+ y1 += link.width;
34441
+ }
34442
+ }
34443
+ }
34444
+
34445
+ function Sankey() {
34446
+ let x0 = 0, y0 = 0, x1 = 1, y1 = 1; // extent
34447
+ let dx = 24; // nodeWidth
34448
+ let dy = 8, py; // nodePadding
34449
+ let id = defaultId;
34450
+ let align = justify;
34451
+ let sort;
34452
+ let linkSort;
34453
+ let nodes = defaultNodes;
34454
+ let links = defaultLinks;
34455
+ let iterations = 6;
34456
+
34457
+ function sankey() {
34458
+ const graph = {nodes: nodes.apply(null, arguments), links: links.apply(null, arguments)};
34459
+ computeNodeLinks(graph);
34460
+ computeNodeValues(graph);
34461
+ computeNodeDepths(graph);
34462
+ computeNodeHeights(graph);
34463
+ computeNodeBreadths(graph);
34464
+ computeLinkBreadths(graph);
34465
+ return graph;
34466
+ }
34467
+
34468
+ sankey.update = function(graph) {
34469
+ computeLinkBreadths(graph);
34470
+ return graph;
34471
+ };
34472
+
34473
+ sankey.nodeId = function(_) {
34474
+ return arguments.length ? (id = typeof _ === "function" ? _ : constant_constant(_), sankey) : id;
34475
+ };
34476
+
34477
+ sankey.nodeAlign = function(_) {
34478
+ return arguments.length ? (align = typeof _ === "function" ? _ : constant_constant(_), sankey) : align;
34479
+ };
34480
+
34481
+ sankey.nodeSort = function(_) {
34482
+ return arguments.length ? (sort = _, sankey) : sort;
34483
+ };
34484
+
34485
+ sankey.nodeWidth = function(_) {
34486
+ return arguments.length ? (dx = +_, sankey) : dx;
34487
+ };
34488
+
34489
+ sankey.nodePadding = function(_) {
34490
+ return arguments.length ? (dy = py = +_, sankey) : dy;
34491
+ };
34492
+
34493
+ sankey.nodes = function(_) {
34494
+ return arguments.length ? (nodes = typeof _ === "function" ? _ : constant_constant(_), sankey) : nodes;
34495
+ };
34496
+
34497
+ sankey.links = function(_) {
34498
+ return arguments.length ? (links = typeof _ === "function" ? _ : constant_constant(_), sankey) : links;
34499
+ };
34500
+
34501
+ sankey.linkSort = function(_) {
34502
+ return arguments.length ? (linkSort = _, sankey) : linkSort;
34503
+ };
34504
+
34505
+ sankey.size = function(_) {
34506
+ return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], sankey) : [x1 - x0, y1 - y0];
34507
+ };
34508
+
34509
+ sankey.extent = function(_) {
34510
+ return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], sankey) : [[x0, y0], [x1, y1]];
34511
+ };
34512
+
34513
+ sankey.iterations = function(_) {
34514
+ return arguments.length ? (iterations = +_, sankey) : iterations;
34515
+ };
34516
+
34517
+ function computeNodeLinks({nodes, links}) {
34518
+ for (const [i, node] of nodes.entries()) {
34519
+ node.index = i;
34520
+ node.sourceLinks = [];
34521
+ node.targetLinks = [];
34522
+ }
34523
+ const nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d]));
34524
+ for (const [i, link] of links.entries()) {
34525
+ link.index = i;
34526
+ let {source, target} = link;
34527
+ if (typeof source !== "object") source = link.source = sankey_find(nodeById, source);
34528
+ if (typeof target !== "object") target = link.target = sankey_find(nodeById, target);
34529
+ source.sourceLinks.push(link);
34530
+ target.targetLinks.push(link);
34531
+ }
34532
+ if (linkSort != null) {
34533
+ for (const {sourceLinks, targetLinks} of nodes) {
34534
+ sourceLinks.sort(linkSort);
34535
+ targetLinks.sort(linkSort);
34536
+ }
34537
+ }
34538
+ }
34539
+
34540
+ function computeNodeValues({nodes}) {
34541
+ for (const node of nodes) {
34542
+ node.value = node.fixedValue === undefined
34543
+ ? Math.max(src_sum_sum(node.sourceLinks, sankey_value), src_sum_sum(node.targetLinks, sankey_value))
34544
+ : node.fixedValue;
34545
+ }
34546
+ }
34547
+
34548
+ function computeNodeDepths({nodes}) {
34549
+ const n = nodes.length;
34550
+ let current = new Set(nodes);
34551
+ let next = new Set;
34552
+ let x = 0;
34553
+ while (current.size) {
34554
+ for (const node of current) {
34555
+ node.depth = x;
34556
+ for (const {target} of node.sourceLinks) {
34557
+ next.add(target);
34558
+ }
34559
+ }
34560
+ if (++x > n) throw new Error("circular link");
34561
+ current = next;
34562
+ next = new Set;
34563
+ }
34564
+ }
34565
+
34566
+ function computeNodeHeights({nodes}) {
34567
+ const n = nodes.length;
34568
+ let current = new Set(nodes);
34569
+ let next = new Set;
34570
+ let x = 0;
34571
+ while (current.size) {
34572
+ for (const node of current) {
34573
+ node.height = x;
34574
+ for (const {source} of node.targetLinks) {
34575
+ next.add(source);
34576
+ }
34577
+ }
34578
+ if (++x > n) throw new Error("circular link");
34579
+ current = next;
34580
+ next = new Set;
34581
+ }
34582
+ }
34583
+
34584
+ function computeNodeLayers({nodes}) {
34585
+ const x = src_max_max(nodes, d => d.depth) + 1;
34586
+ const kx = (x1 - x0 - dx) / (x - 1);
34587
+ const columns = new Array(x);
34588
+ for (const node of nodes) {
34589
+ const i = Math.max(0, Math.min(x - 1, Math.floor(align.call(null, node, x))));
34590
+ node.layer = i;
34591
+ node.x0 = x0 + i * kx;
34592
+ node.x1 = node.x0 + dx;
34593
+ if (columns[i]) columns[i].push(node);
34594
+ else columns[i] = [node];
34595
+ }
34596
+ if (sort) for (const column of columns) {
34597
+ column.sort(sort);
34598
+ }
34599
+ return columns;
34600
+ }
34601
+
34602
+ function initializeNodeBreadths(columns) {
34603
+ const ky = src_min_min(columns, c => (y1 - y0 - (c.length - 1) * py) / src_sum_sum(c, sankey_value));
34604
+ for (const nodes of columns) {
34605
+ let y = y0;
34606
+ for (const node of nodes) {
34607
+ node.y0 = y;
34608
+ node.y1 = y + node.value * ky;
34609
+ y = node.y1 + py;
34610
+ for (const link of node.sourceLinks) {
34611
+ link.width = link.value * ky;
34612
+ }
34613
+ }
34614
+ y = (y1 - y + py) / (nodes.length + 1);
34615
+ for (let i = 0; i < nodes.length; ++i) {
34616
+ const node = nodes[i];
34617
+ node.y0 += y * (i + 1);
34618
+ node.y1 += y * (i + 1);
34619
+ }
34620
+ reorderLinks(nodes);
34621
+ }
34622
+ }
34623
+
34624
+ function computeNodeBreadths(graph) {
34625
+ const columns = computeNodeLayers(graph);
34626
+ py = Math.min(dy, (y1 - y0) / (src_max_max(columns, c => c.length) - 1));
34627
+ initializeNodeBreadths(columns);
34628
+ for (let i = 0; i < iterations; ++i) {
34629
+ const alpha = Math.pow(0.99, i);
34630
+ const beta = Math.max(1 - alpha, (i + 1) / iterations);
34631
+ relaxRightToLeft(columns, alpha, beta);
34632
+ relaxLeftToRight(columns, alpha, beta);
34633
+ }
34634
+ }
34635
+
34636
+ // Reposition each node based on its incoming (target) links.
34637
+ function relaxLeftToRight(columns, alpha, beta) {
34638
+ for (let i = 1, n = columns.length; i < n; ++i) {
34639
+ const column = columns[i];
34640
+ for (const target of column) {
34641
+ let y = 0;
34642
+ let w = 0;
34643
+ for (const {source, value} of target.targetLinks) {
34644
+ let v = value * (target.layer - source.layer);
34645
+ y += targetTop(source, target) * v;
34646
+ w += v;
34647
+ }
34648
+ if (!(w > 0)) continue;
34649
+ let dy = (y / w - target.y0) * alpha;
34650
+ target.y0 += dy;
34651
+ target.y1 += dy;
34652
+ reorderNodeLinks(target);
34653
+ }
34654
+ if (sort === undefined) column.sort(ascendingBreadth);
34655
+ resolveCollisions(column, beta);
34656
+ }
34657
+ }
34658
+
34659
+ // Reposition each node based on its outgoing (source) links.
34660
+ function relaxRightToLeft(columns, alpha, beta) {
34661
+ for (let n = columns.length, i = n - 2; i >= 0; --i) {
34662
+ const column = columns[i];
34663
+ for (const source of column) {
34664
+ let y = 0;
34665
+ let w = 0;
34666
+ for (const {target, value} of source.sourceLinks) {
34667
+ let v = value * (target.layer - source.layer);
34668
+ y += sourceTop(source, target) * v;
34669
+ w += v;
34670
+ }
34671
+ if (!(w > 0)) continue;
34672
+ let dy = (y / w - source.y0) * alpha;
34673
+ source.y0 += dy;
34674
+ source.y1 += dy;
34675
+ reorderNodeLinks(source);
34676
+ }
34677
+ if (sort === undefined) column.sort(ascendingBreadth);
34678
+ resolveCollisions(column, beta);
34679
+ }
34680
+ }
34681
+
34682
+ function resolveCollisions(nodes, alpha) {
34683
+ const i = nodes.length >> 1;
34684
+ const subject = nodes[i];
34685
+ resolveCollisionsBottomToTop(nodes, subject.y0 - py, i - 1, alpha);
34686
+ resolveCollisionsTopToBottom(nodes, subject.y1 + py, i + 1, alpha);
34687
+ resolveCollisionsBottomToTop(nodes, y1, nodes.length - 1, alpha);
34688
+ resolveCollisionsTopToBottom(nodes, y0, 0, alpha);
34689
+ }
34690
+
34691
+ // Push any overlapping nodes down.
34692
+ function resolveCollisionsTopToBottom(nodes, y, i, alpha) {
34693
+ for (; i < nodes.length; ++i) {
34694
+ const node = nodes[i];
34695
+ const dy = (y - node.y0) * alpha;
34696
+ if (dy > 1e-6) node.y0 += dy, node.y1 += dy;
34697
+ y = node.y1 + py;
34698
+ }
34699
+ }
34700
+
34701
+ // Push any overlapping nodes up.
34702
+ function resolveCollisionsBottomToTop(nodes, y, i, alpha) {
34703
+ for (; i >= 0; --i) {
34704
+ const node = nodes[i];
34705
+ const dy = (node.y1 - y) * alpha;
34706
+ if (dy > 1e-6) node.y0 -= dy, node.y1 -= dy;
34707
+ y = node.y0 - py;
34708
+ }
34709
+ }
34710
+
34711
+ function reorderNodeLinks({sourceLinks, targetLinks}) {
34712
+ if (linkSort === undefined) {
34713
+ for (const {source: {sourceLinks}} of targetLinks) {
34714
+ sourceLinks.sort(ascendingTargetBreadth);
34715
+ }
34716
+ for (const {target: {targetLinks}} of sourceLinks) {
34717
+ targetLinks.sort(ascendingSourceBreadth);
34718
+ }
34719
+ }
34720
+ }
34721
+
34722
+ function reorderLinks(nodes) {
34723
+ if (linkSort === undefined) {
34724
+ for (const {sourceLinks, targetLinks} of nodes) {
34725
+ sourceLinks.sort(ascendingTargetBreadth);
34726
+ targetLinks.sort(ascendingSourceBreadth);
34727
+ }
34728
+ }
34729
+ }
34730
+
34731
+ // Returns the target.y0 that would produce an ideal link from source to target.
34732
+ function targetTop(source, target) {
34733
+ let y = source.y0 - (source.sourceLinks.length - 1) * py / 2;
34734
+ for (const {target: node, width} of source.sourceLinks) {
34735
+ if (node === target) break;
34736
+ y += width + py;
34737
+ }
34738
+ for (const {source: node, width} of target.targetLinks) {
34739
+ if (node === source) break;
34740
+ y -= width;
34741
+ }
34742
+ return y;
34743
+ }
34744
+
34745
+ // Returns the source.y0 that would produce an ideal link from source to target.
34746
+ function sourceTop(source, target) {
34747
+ let y = target.y0 - (target.targetLinks.length - 1) * py / 2;
34748
+ for (const {source: node, width} of target.targetLinks) {
34749
+ if (node === source) break;
34750
+ y += width + py;
34751
+ }
34752
+ for (const {target: node, width} of source.sourceLinks) {
34753
+ if (node === target) break;
34754
+ y -= width;
34755
+ }
34756
+ return y;
34757
+ }
34758
+
34759
+ return sankey;
34760
+ }
34761
+
34762
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/node_modules/d3-path/src/path.js
34763
+ var src_path_pi = Math.PI,
34764
+ src_path_tau = 2 * src_path_pi,
34765
+ src_path_epsilon = 1e-6,
34766
+ path_tauEpsilon = src_path_tau - src_path_epsilon;
34767
+
34768
+ function path_Path() {
34769
+ this._x0 = this._y0 = // start of current subpath
34770
+ this._x1 = this._y1 = null; // end of current subpath
34771
+ this._ = "";
34772
+ }
34773
+
34774
+ function src_path_path() {
34775
+ return new path_Path;
34776
+ }
34777
+
34778
+ path_Path.prototype = src_path_path.prototype = {
34779
+ constructor: path_Path,
34780
+ moveTo: function(x, y) {
34781
+ this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
34782
+ },
34783
+ closePath: function() {
34784
+ if (this._x1 !== null) {
34785
+ this._x1 = this._x0, this._y1 = this._y0;
34786
+ this._ += "Z";
34787
+ }
34788
+ },
34789
+ lineTo: function(x, y) {
34790
+ this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
34791
+ },
34792
+ quadraticCurveTo: function(x1, y1, x, y) {
34793
+ this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
34794
+ },
34795
+ bezierCurveTo: function(x1, y1, x2, y2, x, y) {
34796
+ this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
34797
+ },
34798
+ arcTo: function(x1, y1, x2, y2, r) {
34799
+ x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
34800
+ var x0 = this._x1,
34801
+ y0 = this._y1,
34802
+ x21 = x2 - x1,
34803
+ y21 = y2 - y1,
34804
+ x01 = x0 - x1,
34805
+ y01 = y0 - y1,
34806
+ l01_2 = x01 * x01 + y01 * y01;
34807
+
34808
+ // Is the radius negative? Error.
34809
+ if (r < 0) throw new Error("negative radius: " + r);
34810
+
34811
+ // Is this path empty? Move to (x1,y1).
34812
+ if (this._x1 === null) {
34813
+ this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
34814
+ }
34815
+
34816
+ // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
34817
+ else if (!(l01_2 > src_path_epsilon));
34818
+
34819
+ // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
34820
+ // Equivalently, is (x1,y1) coincident with (x2,y2)?
34821
+ // Or, is the radius zero? Line to (x1,y1).
34822
+ else if (!(Math.abs(y01 * x21 - y21 * x01) > src_path_epsilon) || !r) {
34823
+ this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
34824
+ }
34825
+
34826
+ // Otherwise, draw an arc!
34827
+ else {
34828
+ var x20 = x2 - x0,
34829
+ y20 = y2 - y0,
34830
+ l21_2 = x21 * x21 + y21 * y21,
34831
+ l20_2 = x20 * x20 + y20 * y20,
34832
+ l21 = Math.sqrt(l21_2),
34833
+ l01 = Math.sqrt(l01_2),
34834
+ l = r * Math.tan((src_path_pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
34835
+ t01 = l / l01,
34836
+ t21 = l / l21;
34837
+
34838
+ // If the start tangent is not coincident with (x0,y0), line to.
34839
+ if (Math.abs(t01 - 1) > src_path_epsilon) {
34840
+ this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
34841
+ }
34842
+
34843
+ this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
34844
+ }
34845
+ },
34846
+ arc: function(x, y, r, a0, a1, ccw) {
34847
+ x = +x, y = +y, r = +r, ccw = !!ccw;
34848
+ var dx = r * Math.cos(a0),
34849
+ dy = r * Math.sin(a0),
34850
+ x0 = x + dx,
34851
+ y0 = y + dy,
34852
+ cw = 1 ^ ccw,
34853
+ da = ccw ? a0 - a1 : a1 - a0;
34854
+
34855
+ // Is the radius negative? Error.
34856
+ if (r < 0) throw new Error("negative radius: " + r);
34857
+
34858
+ // Is this path empty? Move to (x0,y0).
34859
+ if (this._x1 === null) {
34860
+ this._ += "M" + x0 + "," + y0;
34861
+ }
34862
+
34863
+ // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
34864
+ else if (Math.abs(this._x1 - x0) > src_path_epsilon || Math.abs(this._y1 - y0) > src_path_epsilon) {
34865
+ this._ += "L" + x0 + "," + y0;
34866
+ }
34867
+
34868
+ // Is this arc empty? We’re done.
34869
+ if (!r) return;
34870
+
34871
+ // Does the angle go the wrong way? Flip the direction.
34872
+ if (da < 0) da = da % src_path_tau + src_path_tau;
34873
+
34874
+ // Is this a complete circle? Draw two arcs to complete the circle.
34875
+ if (da > path_tauEpsilon) {
34876
+ this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
34877
+ }
34878
+
34879
+ // Is this arc non-empty? Draw an arc!
34880
+ else if (da > src_path_epsilon) {
34881
+ this._ += "A" + r + "," + r + ",0," + (+(da >= src_path_pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
34882
+ }
34883
+ },
34884
+ rect: function(x, y, w, h) {
34885
+ this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z";
34886
+ },
34887
+ toString: function() {
34888
+ return this._;
34889
+ }
34890
+ };
34891
+
34892
+ /* harmony default export */ var d3_path_src_path = (src_path_path);
34893
+
34894
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/node_modules/d3-shape/src/array.js
34895
+ var src_array_slice = Array.prototype.slice;
34896
+
34897
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/node_modules/d3-shape/src/constant.js
34898
+ /* harmony default export */ var d3_shape_src_constant = (function(x) {
34899
+ return function constant() {
34900
+ return x;
34901
+ };
34902
+ });
34903
+
34904
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/node_modules/d3-shape/src/point.js
34905
+ function src_point_x(p) {
34906
+ return p[0];
34907
+ }
34908
+
34909
+ function src_point_y(p) {
34910
+ return p[1];
34911
+ }
34912
+
34913
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/node_modules/d3-shape/src/pointRadial.js
34914
+ /* harmony default export */ var src_pointRadial = (function(x, y) {
34915
+ return [(y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x)];
34916
+ });
34917
+
34918
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/node_modules/d3-shape/src/link/index.js
34919
+
34920
+
34921
+
34922
+
34923
+
34924
+
34925
+ function link_linkSource(d) {
34926
+ return d.source;
34927
+ }
34928
+
34929
+ function link_linkTarget(d) {
34930
+ return d.target;
34931
+ }
34932
+
34933
+ function src_link_link(curve) {
34934
+ var source = link_linkSource,
34935
+ target = link_linkTarget,
34936
+ x = src_point_x,
34937
+ y = src_point_y,
34938
+ context = null;
34939
+
34940
+ function link() {
34941
+ var buffer, argv = src_array_slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);
34942
+ if (!context) context = buffer = d3_path_src_path();
34943
+ curve(context, +x.apply(this, (argv[0] = s, argv)), +y.apply(this, argv), +x.apply(this, (argv[0] = t, argv)), +y.apply(this, argv));
34944
+ if (buffer) return context = null, buffer + "" || null;
34945
+ }
34946
+
34947
+ link.source = function(_) {
34948
+ return arguments.length ? (source = _, link) : source;
34949
+ };
34950
+
34951
+ link.target = function(_) {
34952
+ return arguments.length ? (target = _, link) : target;
34953
+ };
34954
+
34955
+ link.x = function(_) {
34956
+ return arguments.length ? (x = typeof _ === "function" ? _ : d3_shape_src_constant(+_), link) : x;
34957
+ };
34958
+
34959
+ link.y = function(_) {
34960
+ return arguments.length ? (y = typeof _ === "function" ? _ : d3_shape_src_constant(+_), link) : y;
34961
+ };
34962
+
34963
+ link.context = function(_) {
34964
+ return arguments.length ? ((context = _ == null ? null : _), link) : context;
34965
+ };
34966
+
34967
+ return link;
34968
+ }
34969
+
34970
+ function link_curveHorizontal(context, x0, y0, x1, y1) {
34971
+ context.moveTo(x0, y0);
34972
+ context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
34973
+ }
34974
+
34975
+ function link_curveVertical(context, x0, y0, x1, y1) {
34976
+ context.moveTo(x0, y0);
34977
+ context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);
34978
+ }
34979
+
34980
+ function link_curveRadial(context, x0, y0, x1, y1) {
34981
+ var p0 = src_pointRadial(x0, y0),
34982
+ p1 = src_pointRadial(x0, y0 = (y0 + y1) / 2),
34983
+ p2 = src_pointRadial(x1, y0),
34984
+ p3 = src_pointRadial(x1, y1);
34985
+ context.moveTo(p0[0], p0[1]);
34986
+ context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
34987
+ }
34988
+
34989
+ function link_linkHorizontal() {
34990
+ return src_link_link(link_curveHorizontal);
34991
+ }
34992
+
34993
+ function link_linkVertical() {
34994
+ return src_link_link(link_curveVertical);
34995
+ }
34996
+
34997
+ function link_linkRadial() {
34998
+ var l = src_link_link(link_curveRadial);
34999
+ l.angle = l.x, delete l.x;
35000
+ l.radius = l.y, delete l.y;
35001
+ return l;
35002
+ }
35003
+
35004
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/src/sankeyLinkHorizontal.js
35005
+
35006
+
35007
+ function horizontalSource(d) {
35008
+ return [d.source.x1, d.y0];
35009
+ }
35010
+
35011
+ function horizontalTarget(d) {
35012
+ return [d.target.x0, d.y1];
35013
+ }
35014
+
35015
+ /* harmony default export */ var sankeyLinkHorizontal = (function() {
35016
+ return link_linkHorizontal()
35017
+ .source(horizontalSource)
35018
+ .target(horizontalTarget);
35019
+ });
35020
+
35021
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-sankey/src/index.js
35022
+
35023
+
35024
+
35025
+
35026
+ // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/graphs/alluvial.js
35027
+ var alluvial_extends = (undefined && undefined.__extends) || (function () {
35028
+ var extendStatics = function (d, b) {
35029
+ extendStatics = Object.setPrototypeOf ||
35030
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
35031
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
35032
+ return extendStatics(d, b);
35033
+ };
35034
+ return function (d, b) {
35035
+ extendStatics(d, b);
35036
+ function __() { this.constructor = d; }
35037
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
35038
+ };
35039
+ })();
35040
+ // Internal imports
35041
+
35042
+
35043
+
35044
+
35045
+
35046
+ // D3 imports
35047
+
35048
+
35049
+ var alluvial_Alluvial = /** @class */ (function (_super) {
35050
+ alluvial_extends(Alluvial, _super);
35051
+ function Alluvial() {
35052
+ var _this = _super !== null && _super.apply(this, arguments) || this;
35053
+ _this.type = 'alluvial';
35054
+ _this.renderType = RenderTypes.SVG;
35055
+ return _this;
35056
+ }
35057
+ Alluvial.prototype.render = function (animate) {
35058
+ var _this = this;
35059
+ if (animate === void 0) { animate = true; }
35060
+ // svg and container widths
35061
+ var svg = this.getComponentContainer({ withinChartClip: true });
35062
+ svg.html('');
35063
+ var _a = dom_utils_DOMUtils.getSVGElementSize(svg, {
35064
+ useAttrs: true,
35065
+ }), width = _a.width, height = _a.height;
35066
+ // Because of a Firefox bug with regards to sizing & d3 packs,
35067
+ // rather than checking if height or width aren't 0,
35068
+ // we have to make sure they're not smaller than 1
35069
+ if (width < 1 || height < 1) {
35070
+ return;
35071
+ }
35072
+ var options = this.model.getOptions();
35073
+ var data = this.model.getDisplayData();
35074
+ // Set the custom node padding if provided
35075
+ var nodePadding = alluvial.minNodePadding;
35076
+ if (options.alluvial.nodePadding > alluvial.minNodePadding) {
35077
+ nodePadding = options.alluvial.nodePadding;
35078
+ }
35079
+ var sankey = Sankey()
35080
+ .nodeId(function (d) { return d.name; })
35081
+ .nodeWidth(alluvial.nodeWidth)
35082
+ // Distance nodes are apart from each other
35083
+ .nodePadding(nodePadding)
35084
+ // Size of the chart and its padding
35085
+ // Chart starts at 2 and ends at width - 2 so the outer nodes can expand from center
35086
+ // Chart starts from 30 so node categories can be displayed
35087
+ .extent([
35088
+ [2, 30],
35089
+ [width - 2, height],
35090
+ ]);
35091
+ // Construct a graph with the provided user data
35092
+ // Data must be deep cloned to ensure user passed data isn't deleted when themes change
35093
+ this.graph = sankey({
35094
+ nodes: options.alluvial.nodes.map(function (d) { return Object.assign({}, d); }),
35095
+ links: data.map(function (d) { return Object.assign({}, d); }),
35096
+ });
35097
+ // Filter out unused nodes so they are not rendered
35098
+ this.graph.nodes = this.graph.nodes.filter(function (node) { return node.value !== 0; });
35099
+ // Determine the category name placement x position
35100
+ var nodeCoordinates = {};
35101
+ this.graph.nodes.forEach(function (element) {
35102
+ var _a;
35103
+ var point = element.x0;
35104
+ // Only 1 category per x-value
35105
+ if (element.category) {
35106
+ nodeCoordinates[point] = (_a = element) === null || _a === void 0 ? void 0 : _a.category;
35107
+ }
35108
+ });
35109
+ // Add node category text
35110
+ var alluvialCategory = svg
35111
+ .append('g')
35112
+ .classed('header-arrows', true)
35113
+ .selectAll('g')
35114
+ .data(Object.keys(nodeCoordinates))
35115
+ .join('g')
35116
+ .attr('transform', function (d) {
35117
+ return "translate(" + d + ", 0)";
35118
+ });
35119
+ // Add the category text
35120
+ alluvialCategory
35121
+ .append('text')
35122
+ .attr('id', function (d, i) { return "category-" + i; })
35123
+ .style('font-size', '14px')
35124
+ .text(function (d) {
35125
+ if (nodeCoordinates[d]) {
35126
+ return nodeCoordinates[d];
35127
+ }
35128
+ return '';
35129
+ })
35130
+ .attr('y', 20)
35131
+ .attr('x', function (d, i) {
35132
+ var width = dom_utils_DOMUtils.getSVGElementSize(src_select("text#category-" + i), { useBBox: true }).width;
35133
+ // Make the text on the left on node group (except first column)
35134
+ var x = 0;
35135
+ if (d + x >= width) {
35136
+ x = -width + 4;
35137
+ }
35138
+ return x;
35139
+ });
35140
+ // Draws the links (Waves)
35141
+ svg.append('g')
35142
+ .attr('fill', 'none')
35143
+ .selectAll('g')
35144
+ .data(this.graph.links)
35145
+ .join('path')
35146
+ .classed('link', true)
35147
+ .attr('d', sankeyLinkHorizontal())
35148
+ .attr('id', function (d) { return "line-" + d.index; })
35149
+ .attr('class', function (d) {
35150
+ // Use a single color for the lines
35151
+ if (options.alluvial.monochrome) {
35152
+ return _this.model.getColorClassName({
35153
+ classNameTypes: [ColorClassNameTypes.STROKE],
35154
+ dataGroupName: 0,
35155
+ originalClassName: 'link',
35156
+ });
35157
+ }
35158
+ return _this.model.getColorClassName({
35159
+ classNameTypes: [ColorClassNameTypes.STROKE],
35160
+ dataGroupName: d.source.index,
35161
+ originalClassName: 'link',
35162
+ });
35163
+ })
35164
+ .attr('stroke-width', function (d) { return Math.max(1, d.width); })
35165
+ .style('stroke-opacity', alluvial.opacity.default)
35166
+ .attr('aria-label', function (d) {
35167
+ return d.source.name + " \u2192 " + d.target.name + " (" + d.value + (options.alluvial.units
35168
+ ? ' ' + options.alluvial.units
35169
+ : '') + ")";
35170
+ });
35171
+ // Creating the groups
35172
+ var node = svg
35173
+ .append('g')
35174
+ .selectAll('g')
35175
+ .data(this.graph.nodes)
35176
+ .enter()
35177
+ .append('g')
35178
+ .attr('id', function (d) { return "node-" + d.index; })
35179
+ .classed('node-group', true)
35180
+ .attr('transform', function (d) { return "translate(" + d.x0 + ", " + d.y0 + ")"; });
35181
+ // Creating the nodes
35182
+ node.append('rect')
35183
+ .classed('node', true)
35184
+ .attr('height', function (d) { return d.y1 - d.y0; })
35185
+ .attr('width', function (d) { return d.x1 - d.x0; })
35186
+ .attr('fill', 'black');
35187
+ // Group to hold the text & rectangle background
35188
+ var textNode = node
35189
+ .append('g')
35190
+ .attr('id', function (d) { return "node-title-" + d.index; });
35191
+ // Node title - text
35192
+ textNode
35193
+ .append('text')
35194
+ .attr('id', function (d) { return "node-text-" + d.index; })
35195
+ .attr('class', 'node-text')
35196
+ .style('font-size', '12px')
35197
+ .attr('text-anchor', 'start')
35198
+ .attr('fill', 'white')
35199
+ // Padding to text
35200
+ .attr('x', 4)
35201
+ // shift 13 pixels down to fit background container
35202
+ .attr('dy', 13)
35203
+ .text(function (d) {
35204
+ return d.name + " (" + d.value + ")";
35205
+ })
35206
+ .attr('aria-label', function (d) {
35207
+ return d.name + " (" + d.value + ")";
35208
+ });
35209
+ // Text background
35210
+ textNode
35211
+ .append('rect')
35212
+ .classed('node-text-bg', true)
35213
+ .attr('width', function (d, i) {
35214
+ // Determine rectangle width based on text width
35215
+ var width = dom_utils_DOMUtils.getSVGElementSize(src_select("text#node-text-" + i), { useBBox: true }).width;
35216
+ return width + 8;
35217
+ })
35218
+ .attr('height', 18)
35219
+ .attr('stroke-width', 2)
35220
+ .lower();
35221
+ // Position group based on text width
35222
+ textNode.attr('transform', function (d, i) {
35223
+ var width = dom_utils_DOMUtils.getSVGElementSize(src_select("text#node-text-" + i), { useBBox: true }).width;
35224
+ // Subtracting 9 since text background is 18 to center
35225
+ var y = (d.y1 - d.y0) / 2 - 9;
35226
+ // Node width
35227
+ var x = d.x1 - d.x0;
35228
+ // Display bars on the right instead of left of the node
35229
+ if (d.x1 >= width) {
35230
+ // 16 = node width (4) + text container padding (8) + distance between node and text container (4)
35231
+ x = x - (width + 16);
35232
+ }
35233
+ else {
35234
+ // Add padding to text containers
35235
+ x += 4;
35236
+ }
35237
+ return "translate(" + x + ", " + y + ")";
35238
+ });
35239
+ this.addLineEventListener();
35240
+ this.addNodeEventListener();
35241
+ };
35242
+ Alluvial.prototype.addLineEventListener = function () {
35243
+ var options = this.getOptions();
35244
+ var self = this;
35245
+ // Set delay to counter flashy behaviour
35246
+ var debouncedLineHighlight = tools_Tools.debounce(function (link, event) {
35247
+ if (event === void 0) { event = 'mouseover'; }
35248
+ var allLinks = self.parent
35249
+ .selectAll('path.link')
35250
+ .transition(self.services.transitions.getTransition('alluvial-link-mouse-highlight'));
35251
+ if (event === 'mouseout') {
35252
+ src_select(link).lower();
35253
+ allLinks.style('stroke-opacity', alluvial.opacity.default);
35254
+ }
35255
+ else {
35256
+ allLinks.style('stroke-opacity', function () {
35257
+ // highlight and raise if link is this
35258
+ if (link === this) {
35259
+ src_select(this).raise();
35260
+ return alluvial.opacity.selected;
35261
+ }
35262
+ return alluvial.opacity.unfocus;
35263
+ });
35264
+ }
35265
+ }, 33);
35266
+ this.parent
35267
+ .selectAll('path.link')
35268
+ .on('mouseover', function (event, datum) {
35269
+ var hoveredElement = src_select(this);
35270
+ debouncedLineHighlight(this, 'mouseover');
35271
+ hoveredElement.classed('link-hovered', true);
35272
+ var strokeColor = getComputedStyle(this).getPropertyValue('stroke');
35273
+ // Dispatch mouse over event
35274
+ self.services.events.dispatchEvent(Events.Alluvial.LINE_MOUSEOVER, {
35275
+ event: event,
35276
+ element: hoveredElement,
35277
+ datum: datum,
35278
+ });
35279
+ // Dispatch tooltip show event
35280
+ self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
35281
+ event: event,
35282
+ hoveredElement: hoveredElement,
35283
+ items: [
35284
+ {
35285
+ label: datum.target.name,
35286
+ value: datum.value +
35287
+ (options.alluvial.units
35288
+ ? " " + options.alluvial.units
35289
+ : ''),
35290
+ color: strokeColor,
35291
+ labelIcon: self.getRightArrowIcon(),
35292
+ },
35293
+ ],
35294
+ });
35295
+ })
35296
+ .on('mousemove', function (event, datum) {
35297
+ // Dispatch mouse move event
35298
+ self.services.events.dispatchEvent(Events.Alluvial.LINE_MOUSEMOVE, {
35299
+ event: event,
35300
+ element: src_select(this),
35301
+ datum: datum,
35302
+ });
35303
+ // Dispatch tooltip move event
35304
+ self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
35305
+ event: event,
35306
+ });
35307
+ })
35308
+ .on('click', function (event, datum) {
35309
+ // Dispatch mouse click event
35310
+ self.services.events.dispatchEvent(Events.Alluvial.LINE_CLICK, {
35311
+ event: event,
35312
+ element: src_select(this),
35313
+ datum: datum,
35314
+ });
35315
+ })
35316
+ .on('mouseout', function (event, datum) {
35317
+ var hoveredElement = src_select(this);
35318
+ debouncedLineHighlight(this, 'mouseout');
35319
+ hoveredElement.classed('link-hovered', false);
35320
+ // Dispatch mouse out event
35321
+ self.services.events.dispatchEvent(Events.Alluvial.LINE_MOUSEOUT, {
35322
+ event: event,
35323
+ element: hoveredElement,
35324
+ datum: datum,
35325
+ });
35326
+ // Dispatch hide tooltip event
35327
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
35328
+ event: event,
35329
+ hoveredElement: hoveredElement,
35330
+ });
35331
+ });
35332
+ };
35333
+ Alluvial.prototype.addNodeEventListener = function () {
35334
+ var _this = this;
35335
+ var self = this;
35336
+ // Set delay to counter flashy behaviour
35337
+ var debouncedLineHighlight = tools_Tools.debounce(function (links, event) {
35338
+ if (links === void 0) { links = []; }
35339
+ if (event === void 0) { event = 'mouseover'; }
35340
+ if (event === 'mouseout' || links.length === 0) {
35341
+ // set all links to default opacity & corret link order
35342
+ self.parent
35343
+ .selectAll('path.link')
35344
+ .classed('link-hovered', false)
35345
+ .data(_this.graph.links, function (d) { return d.index; })
35346
+ .order()
35347
+ .style('stroke-opacity', alluvial.opacity.default);
35348
+ return;
35349
+ }
35350
+ // Highlight all nodes
35351
+ var allLinks = self.parent
35352
+ .selectAll('path.link')
35353
+ .transition(self.services.transitions.getTransition('alluvial-links-mouse-highlight'));
35354
+ allLinks.style('stroke-opacity', function (d) {
35355
+ // Raise the links & increase stroke-opacity to selected
35356
+ if (links.some(function (element) { return element === d.index; })) {
35357
+ src_select(this).classed('link-hovered', true).raise();
35358
+ return alluvial.opacity.selected;
35359
+ }
35360
+ return alluvial.opacity.unfocus;
35361
+ });
35362
+ }, 66);
35363
+ self.parent
35364
+ .selectAll('.node-group')
35365
+ .on('mouseover', function (event, datum) {
35366
+ var hoveredElement = src_select(this);
35367
+ // Highlight all links that pass through node
35368
+ var paths = [];
35369
+ // Outgoing links
35370
+ self.traverse({ link: 'sourceLinks', node: 'target' }, datum, paths);
35371
+ //Incoming links
35372
+ self.traverse({ link: 'targetLinks', node: 'source' }, datum, paths);
35373
+ // Highlight all linked lines in the graph data structure
35374
+ if (paths.length) {
35375
+ // Get transformation value of node
35376
+ var nodeMatrix = tools_Tools.getTranformOffsets(hoveredElement.attr('transform'));
35377
+ // Move node to the left by 2 to grow node from the center
35378
+ hoveredElement.attr('transform', "translate(" + (nodeMatrix.x - 2) + ", " + nodeMatrix.y + ")");
35379
+ hoveredElement
35380
+ .classed('node-hovered', true)
35381
+ .selectAll('rect.node')
35382
+ .attr('width', 8);
35383
+ // Translate first column text container to the
35384
+ // right so it doesn't clash with expanding node
35385
+ if (datum.x0 - 2 === 0) {
35386
+ var titleContainer = self.parent.select("g#node-title-" + datum.index);
35387
+ var titleMatrix = tools_Tools.getTranformOffsets(titleContainer.attr('transform'));
35388
+ titleContainer.attr('transform', "translate(" + (titleMatrix.x + 4) + "," + titleMatrix.y + ")");
35389
+ }
35390
+ self.parent
35391
+ .select("text#node-text-" + datum.index)
35392
+ .style('font-weight', 'bold');
35393
+ debouncedLineHighlight(paths, 'mouseover');
35394
+ // Dispatch mouse over event
35395
+ self.services.events.dispatchEvent(Events.Alluvial.NODE_MOUSEOVER, {
35396
+ event: event,
35397
+ element: hoveredElement,
35398
+ datum: datum,
35399
+ });
35400
+ }
35401
+ })
35402
+ .on('mousemove', function (event, datum) {
35403
+ // Dispatch mouse move event
35404
+ self.services.events.dispatchEvent(Events.Alluvial.NODE_MOUSEMOVE, {
35405
+ event: event,
35406
+ element: src_select(this),
35407
+ datum: datum,
35408
+ });
35409
+ // Dispatch tooltip move event
35410
+ self.services.events.dispatchEvent(Events.Tooltip.MOVE, {
35411
+ event: event,
35412
+ });
35413
+ })
35414
+ .on('click', function (event, datum) {
35415
+ // Dispatch mouse click event
35416
+ self.services.events.dispatchEvent(Events.Alluvial.NODE_CLICK, {
35417
+ event: event,
35418
+ element: src_select(this),
35419
+ datum: datum,
35420
+ });
35421
+ })
35422
+ .on('mouseout', function (event, datum) {
35423
+ var hoveredElement = src_select(this);
35424
+ // Set the node position to initial state (unexpanded)
35425
+ var nodeMatrix = tools_Tools.getTranformOffsets(hoveredElement.attr('transform'));
35426
+ hoveredElement
35427
+ .classed('node-hovered', false)
35428
+ .attr('transform', "translate(" + (nodeMatrix.x + 2) + ", " + nodeMatrix.y + ")")
35429
+ .select('rect.node')
35430
+ .attr('width', alluvial.nodeWidth);
35431
+ // Translate text container back to initial state
35432
+ if (datum.x0 - 2 === 0) {
35433
+ var titleContainer = self.parent.select("g#node-title-" + datum.index);
35434
+ var titleMatrix = tools_Tools.getTranformOffsets(titleContainer.attr('transform'));
35435
+ titleContainer.attr('transform', "translate(" + (titleMatrix.x - 4) + "," + titleMatrix.y + ")");
35436
+ }
35437
+ self.parent
35438
+ .select("text#node-text-" + datum.index)
35439
+ .style('font-weight', 'normal');
35440
+ debouncedLineHighlight([], 'mouseout');
35441
+ // Dispatch mouse out event
35442
+ self.services.events.dispatchEvent(Events.Alluvial.NODE_MOUSEOUT, {
35443
+ event: event,
35444
+ element: hoveredElement,
35445
+ datum: datum,
35446
+ });
35447
+ // Dispatch hide tooltip event
35448
+ self.services.events.dispatchEvent(Events.Tooltip.HIDE, {
35449
+ hoveredElement: hoveredElement,
35450
+ });
35451
+ });
35452
+ };
35453
+ // Traverse graph and get all connected links to node
35454
+ Alluvial.prototype.traverse = function (direction, node, visited) {
35455
+ var _this = this;
35456
+ if (visited === void 0) { visited = []; }
35457
+ var links = node[direction.link].map(function (element) {
35458
+ visited.push(element.index);
35459
+ return element[direction.node];
35460
+ });
35461
+ // Retrieve the child nodes
35462
+ links.forEach(function (element) { return _this.traverse(direction, element, visited); });
35463
+ };
35464
+ Alluvial.prototype.getRightArrowIcon = function () {
35465
+ return "\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 32 32\">\n\t\t\t<polygon points=\"18 6 16.57 7.393 24.15 15 4 15 4 17 24.15 17 16.57 24.573 18 26 28 16 18 6\"/>\n\t\t\t<rect data-name=\"&lt;Transparent Rectangle&gt;\" style=\"fill: none;\" width=\"32\" height=\"32\"/>\n\t\t</svg>";
35466
+ };
35467
+ // Remove event listeners
35468
+ Alluvial.prototype.destroy = function () {
35469
+ this.parent
35470
+ .selectAll('path.line,.node-group')
35471
+ .on('mouseover', null)
35472
+ .on('mousemove', null)
35473
+ .on('click', null)
35474
+ .on('mouseout', null);
35475
+ };
35476
+ return Alluvial;
35477
+ }(component_Component));
35478
+
35479
+ //# sourceMappingURL=../../../src/components/graphs/alluvial.js.map
34255
35480
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/components/layout/spacer.js
34256
35481
  var spacer_extends = (undefined && undefined.__extends) || (function () {
34257
35482
  var extendStatics = function (d, b) {
@@ -34504,7 +35729,7 @@ function axis_number(scale) {
34504
35729
  return d => +scale(d);
34505
35730
  }
34506
35731
 
34507
- function center(scale, offset) {
35732
+ function axis_center(scale, offset) {
34508
35733
  offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
34509
35734
  if (scale.round()) offset = Math.round(offset);
34510
35735
  return d => +scale(d) + offset;
@@ -34533,7 +35758,7 @@ function axis_axis(orient, scale) {
34533
35758
  range = scale.range(),
34534
35759
  range0 = +range[0] + offset,
34535
35760
  range1 = +range[range.length - 1] + offset,
34536
- position = (scale.bandwidth ? center : axis_number)(scale.copy(), offset),
35761
+ position = (scale.bandwidth ? axis_center : axis_number)(scale.copy(), offset),
34537
35762
  selection = context.selection ? context.selection() : context,
34538
35763
  path = selection.selectAll(".domain").data([null]),
34539
35764
  tick = selection.selectAll(".tick").data(values, scale).order(),
@@ -37936,6 +39161,7 @@ var tee = {
37936
39161
 
37937
39162
 
37938
39163
 
39164
+
37939
39165
 
37940
39166
 
37941
39167
  // Layout
@@ -40533,6 +41759,51 @@ var wordcloud_WordCloudChart = /** @class */ (function (_super) {
40533
41759
  }(chart_Chart));
40534
41760
 
40535
41761
  //# sourceMappingURL=../../src/charts/wordcloud.js.map
41762
+ // CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/alluvial.js
41763
+ var charts_alluvial_extends = (undefined && undefined.__extends) || (function () {
41764
+ var extendStatics = function (d, b) {
41765
+ extendStatics = Object.setPrototypeOf ||
41766
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
41767
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
41768
+ return extendStatics(d, b);
41769
+ };
41770
+ return function (d, b) {
41771
+ extendStatics(d, b);
41772
+ function __() { this.constructor = d; }
41773
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41774
+ };
41775
+ })();
41776
+ // Internal Imports
41777
+
41778
+
41779
+
41780
+ // Components
41781
+
41782
+ var alluvial_AlluvialChart = /** @class */ (function (_super) {
41783
+ charts_alluvial_extends(AlluvialChart, _super);
41784
+ function AlluvialChart(holder, chartConfigs) {
41785
+ var _this = _super.call(this, holder, chartConfigs) || this;
41786
+ // Merge the default options for this chart
41787
+ // With the user provided options
41788
+ _this.model.setOptions(tools_Tools.mergeDefaultChartOptions(configuration_options.alluvialChart, chartConfigs.options));
41789
+ // Initialize data, services, components etc.
41790
+ _this.init(holder, chartConfigs);
41791
+ return _this;
41792
+ }
41793
+ AlluvialChart.prototype.getComponents = function () {
41794
+ // Specify what to render inside the graph-frame
41795
+ var graphFrameComponents = [
41796
+ new alluvial_Alluvial(this.model, this.services),
41797
+ ];
41798
+ var components = this.getChartComponents(graphFrameComponents, {
41799
+ excludeLegend: true,
41800
+ });
41801
+ return components;
41802
+ };
41803
+ return AlluvialChart;
41804
+ }(chart_Chart));
41805
+
41806
+ //# sourceMappingURL=../../src/charts/alluvial.js.map
40536
41807
  // CONCATENATED MODULE: ./node_modules/@carbon/charts/charts/index.js
40537
41808
 
40538
41809
 
@@ -40554,6 +41825,7 @@ var wordcloud_WordCloudChart = /** @class */ (function (_super) {
40554
41825
 
40555
41826
 
40556
41827
 
41828
+
40557
41829
 
40558
41830
 
40559
41831
  //# sourceMappingURL=../../src/charts/index.js.map
@@ -41719,6 +42991,52 @@ var ccv_wordcloud_chart_component = normalizeComponent(
41719
42991
  )
41720
42992
 
41721
42993
  /* harmony default export */ var ccv_wordcloud_chart = (ccv_wordcloud_chart_component.exports);
42994
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"624081f5-vue-loader-template"}!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!/home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--0-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib??vue-loader-options!./src/ccv-alluvial-chart.vue?vue&type=template&id=7afdadc2&
42995
+ var ccv_alluvial_chartvue_type_template_id_7afdadc2_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"ccv-alluvial-chart"})}
42996
+ var ccv_alluvial_chartvue_type_template_id_7afdadc2_staticRenderFns = []
42997
+
42998
+
42999
+ // CONCATENATED MODULE: ./src/ccv-alluvial-chart.vue?vue&type=template&id=7afdadc2&
43000
+
43001
+ // CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--12-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/thread-loader/dist/cjs.js!/home/runner/work/carbon-charts/carbon-charts/node_modules/@vue/cli-plugin-babel/node_modules/babel-loader/lib!/home/runner/work/carbon-charts/carbon-charts/node_modules/cache-loader/dist/cjs.js??ref--0-0!/home/runner/work/carbon-charts/carbon-charts/node_modules/vue-loader/lib??vue-loader-options!./src/ccv-alluvial-chart.vue?vue&type=script&lang=js&
43002
+ //
43003
+ //
43004
+ //
43005
+ //
43006
+
43007
+
43008
+ /* harmony default export */ var ccv_alluvial_chartvue_type_script_lang_js_ = ({
43009
+ name: 'CcvAlluvialChart',
43010
+ extends: ccv_base_chart,
43011
+ mounted: function mounted() {
43012
+ this.coreChart = new alluvial_AlluvialChart(this.$el, {
43013
+ data: this.data,
43014
+ options: this.options
43015
+ });
43016
+ }
43017
+ });
43018
+ // CONCATENATED MODULE: ./src/ccv-alluvial-chart.vue?vue&type=script&lang=js&
43019
+ /* harmony default export */ var src_ccv_alluvial_chartvue_type_script_lang_js_ = (ccv_alluvial_chartvue_type_script_lang_js_);
43020
+ // CONCATENATED MODULE: ./src/ccv-alluvial-chart.vue
43021
+
43022
+
43023
+
43024
+
43025
+
43026
+ /* normalize component */
43027
+
43028
+ var ccv_alluvial_chart_component = normalizeComponent(
43029
+ src_ccv_alluvial_chartvue_type_script_lang_js_,
43030
+ ccv_alluvial_chartvue_type_template_id_7afdadc2_render,
43031
+ ccv_alluvial_chartvue_type_template_id_7afdadc2_staticRenderFns,
43032
+ false,
43033
+ null,
43034
+ null,
43035
+ null
43036
+
43037
+ )
43038
+
43039
+ /* harmony default export */ var ccv_alluvial_chart = (ccv_alluvial_chart_component.exports);
41722
43040
  // CONCATENATED MODULE: ./src/index.js
41723
43041
 
41724
43042
 
@@ -41752,7 +43070,8 @@ var ccv_wordcloud_chart_component = normalizeComponent(
41752
43070
 
41753
43071
 
41754
43072
 
41755
- var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_chart, ccv_grouped_bar_chart, ccv_stacked_bar_chart, ccv_boxplot_chart, ccv_bubble_chart, ccv_bullet_chart, ccv_donut_chart, ccv_gauge_chart, ccv_histogram_chart, ccv_line_chart, ccv_lollipop_chart, ccv_pie_chart, ccv_scatter_chart, ccv_meter_chart, ccv_radar_chart, ccv_combo_chart, ccv_tree_chart, ccv_treemap_chart, ccv_circle_pack_chart, ccv_wordcloud_chart];
43073
+
43074
+ var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_chart, ccv_grouped_bar_chart, ccv_stacked_bar_chart, ccv_boxplot_chart, ccv_bubble_chart, ccv_bullet_chart, ccv_donut_chart, ccv_gauge_chart, ccv_histogram_chart, ccv_line_chart, ccv_lollipop_chart, ccv_pie_chart, ccv_scatter_chart, ccv_meter_chart, ccv_radar_chart, ccv_combo_chart, ccv_tree_chart, ccv_treemap_chart, ccv_circle_pack_chart, ccv_wordcloud_chart, ccv_alluvial_chart];
41756
43075
  /*
41757
43076
  Allows the module to be used as a Vue plug-in, and has an install()
41758
43077
  method (which is called when the plug-in loads) that registers all the
@@ -41851,6 +43170,7 @@ var src_components = [ccv_area_chart, ccv_stacked_area_chart, ccv_simple_bar_cha
41851
43170
  /* concated harmony reexport CcvTreemapChart */__webpack_require__.d(__webpack_exports__, "CcvTreemapChart", function() { return ccv_treemap_chart; });
41852
43171
  /* concated harmony reexport CcvCirclePackChart */__webpack_require__.d(__webpack_exports__, "CcvCirclePackChart", function() { return ccv_circle_pack_chart; });
41853
43172
  /* concated harmony reexport CcvWordCloudChart */__webpack_require__.d(__webpack_exports__, "CcvWordCloudChart", function() { return ccv_wordcloud_chart; });
43173
+ /* concated harmony reexport CcvAlluvialChart */__webpack_require__.d(__webpack_exports__, "CcvAlluvialChart", function() { return ccv_alluvial_chart; });
41854
43174
 
41855
43175
 
41856
43176
  /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (src);