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