@fluentui/react-charting 5.19.22 → 5.19.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.json +57 -1
  2. package/CHANGELOG.md +23 -2
  3. package/bundle-size/AreaChart.fixture.js +9 -0
  4. package/bundle-size/VerticalBarChart.fixture.js +9 -0
  5. package/dist/react-charting.d.ts +14 -1
  6. package/dist/react-charting.js +1 -1
  7. package/dist/react-charting.min.js +1 -1
  8. package/etc/react-charting.api.md +10 -1
  9. package/lib/components/GaugeChart/GaugeChart.base.d.ts +10 -3
  10. package/lib/components/GaugeChart/GaugeChart.base.js +74 -37
  11. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
  12. package/lib/components/GaugeChart/GaugeChart.types.d.ts +13 -1
  13. package/lib/components/GaugeChart/GaugeChart.types.js +8 -0
  14. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  15. package/lib/components/SankeyChart/SankeyChart.base.d.ts +25 -11
  16. package/lib/components/SankeyChart/SankeyChart.base.js +151 -86
  17. package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
  18. package/lib/version.js +1 -1
  19. package/lib/version.js.map +1 -1
  20. package/lib-amd/components/GaugeChart/GaugeChart.base.d.ts +10 -3
  21. package/lib-amd/components/GaugeChart/GaugeChart.base.js +77 -37
  22. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
  23. package/lib-amd/components/GaugeChart/GaugeChart.types.d.ts +13 -1
  24. package/lib-amd/components/GaugeChart/GaugeChart.types.js +9 -1
  25. package/lib-amd/components/GaugeChart/GaugeChart.types.js.map +1 -1
  26. package/lib-amd/components/SankeyChart/SankeyChart.base.d.ts +25 -11
  27. package/lib-amd/components/SankeyChart/SankeyChart.base.js +156 -88
  28. package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
  29. package/lib-amd/version.js +1 -1
  30. package/lib-amd/version.js.map +1 -1
  31. package/lib-commonjs/components/GaugeChart/GaugeChart.base.d.ts +10 -3
  32. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +77 -37
  33. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
  34. package/lib-commonjs/components/GaugeChart/GaugeChart.types.d.ts +13 -1
  35. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +9 -1
  36. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  37. package/lib-commonjs/components/SankeyChart/SankeyChart.base.d.ts +25 -11
  38. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +156 -88
  39. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
  40. package/lib-commonjs/version.js +1 -1
  41. package/lib-commonjs/version.js.map +1 -1
  42. package/monosize.config.mjs +11 -0
  43. package/package.json +5 -4
  44. package/src/components/GaugeChart/GaugeChart.types.ts +15 -1
@@ -1,6 +1,13 @@
1
+ import { SankeyGraph, SankeyLayout } from 'd3-sankey';
1
2
  import * as React from 'react';
2
- import { IBasestate, IChartHoverCardProps, SLink, SNode } from '../../index';
3
- import { ISankeyChartProps } from './SankeyChart.types';
3
+ import { IBasestate, SLink, SNode } from '../../types/IDataPoint';
4
+ import { IChartHoverCardProps } from '../../utilities/ChartHoverCard/ChartHoverCard.types';
5
+ import { IMargins } from '../../utilities/utilities';
6
+ import { ISankeyChartData, ISankeyChartProps } from './SankeyChart.types';
7
+ declare type NodesInColumns = {
8
+ [key: number]: SNode[];
9
+ };
10
+ declare type SankeyLayoutGenerator = SankeyLayout<SankeyGraph<{}, {}>, {}, {}>;
4
11
  export interface ISankeyChartState extends IBasestate, IChartHoverCardProps {
5
12
  containerWidth: number;
6
13
  containerHeight: number;
@@ -12,13 +19,26 @@ export interface ISankeyChartState extends IBasestate, IChartHoverCardProps {
12
19
  selectedLink?: SLink;
13
20
  shouldOverflow: boolean;
14
21
  }
22
+ /**
23
+ * This is used to group nodes by column index.
24
+ */
25
+ export declare function groupNodesByColumn(graph: ISankeyChartData): NodesInColumns;
26
+ /**
27
+ * This is used to introduce dynamic padding for cases where the number of nodes in a column is huge
28
+ * so that we maintain a node to space ratio for such columns as if we fail to do so the
29
+ * chart is devoid of nodes and only shows links.
30
+ */
31
+ export declare function adjustPadding(sankey: SankeyLayoutGenerator, height: number, nodesInColumn: NodesInColumns): void;
32
+ export declare function preRenderLayout(margins: IMargins, containerWidth: number, containerHeight: number, isRtl: boolean): {
33
+ sankey: SankeyLayoutGenerator;
34
+ height: number;
35
+ width: number;
36
+ };
15
37
  export declare class SankeyChartBase extends React.Component<ISankeyChartProps, ISankeyChartState> {
16
38
  private chartContainer;
17
39
  private _reqID;
18
40
  private _calloutId;
19
41
  private _linkId;
20
- private _nodesInColumn;
21
- private _sankey;
22
42
  private _margins;
23
43
  private _isRtl;
24
44
  private _normalizeData;
@@ -28,14 +48,7 @@ export declare class SankeyChartBase extends React.Component<ISankeyChartProps,
28
48
  componentDidUpdate(prevProps: ISankeyChartProps): void;
29
49
  componentWillUnmount(): void;
30
50
  render(): React.ReactNode;
31
- private _preRenderLayout;
32
51
  private _normalizeSankeyData;
33
- /**
34
- * This is used to introduce dynamic padding for cases where the number of nodes in a column is huge
35
- * so that we maintain a node to space ratio for such columns as if we fail to do so the
36
- * chart is devoid of nodes and only shows links.
37
- */
38
- private _adjustPadding;
39
52
  private _createLinks;
40
53
  private _createNodes;
41
54
  private _onLeave;
@@ -69,3 +82,4 @@ export declare class SankeyChartBase extends React.Component<ISankeyChartProps,
69
82
  private _hideTooltip;
70
83
  private _isChartEmpty;
71
84
  }
85
+ export {};
@@ -7,7 +7,7 @@ import { sankey as d3Sankey, sankeyJustify, sankeyRight } from 'd3-sankey';
7
7
  import { select, selectAll } from 'd3-selection';
8
8
  import { area as d3Area, curveBumpX as d3CurveBasis } from 'd3-shape';
9
9
  import * as React from 'react';
10
- import { ChartHoverCard } from '../../index';
10
+ import { ChartHoverCard } from '../../utilities/ChartHoverCard/ChartHoverCard';
11
11
  var getClassNames = classNamesFunction();
12
12
  var PADDING_PERCENTAGE = 0.3;
13
13
  var NON_SELECTED_NODE_AND_STREAM_COLOR = '#757575';
@@ -114,8 +114,8 @@ function getSelectedLinksforStreamHover(singleLink) {
114
114
  /**
115
115
  * This is used to group nodes by column index.
116
116
  */
117
- function populateNodeInColumns(graph, sankey) {
118
- sankey(graph);
117
+ // This is exported for unit tests.
118
+ export function groupNodesByColumn(graph) {
119
119
  var nodesInColumn = {};
120
120
  graph.nodes.forEach(function (node) {
121
121
  var columnId = node.layer;
@@ -131,18 +131,21 @@ function populateNodeInColumns(graph, sankey) {
131
131
  /**
132
132
  * This is used to normalize the nodes value whose value is less than 1% of the total column value.
133
133
  */
134
- function adjustOnePercentHeightNodes(nodesInColumn) {
134
+ function adjustOnePercentHeightNodes(nodesInColumn, computedNodes, originalLinks) {
135
135
  var totalColumnValue = Object.values(nodesInColumn).map(function (column) {
136
136
  return d3Sum(column, function (node) { return node.value; });
137
137
  });
138
138
  totalColumnValue.forEach(function (columnValue, index) {
139
139
  var totalPercentage = 0;
140
- nodesInColumn[index].forEach(function (node) {
141
- var nodePercentage = (node.value / columnValue) * 100;
142
- node.actualValue = node.value;
140
+ var onePercent = 0.01 * columnValue;
141
+ var columnNodes = nodesInColumn[index];
142
+ columnNodes.forEach(function (node) {
143
+ var value = computedNodes[node.nodeId];
144
+ var nodePercentage = (value / columnValue) * 100;
145
+ node.actualValue = value;
143
146
  //if the value is less than 1% then we are making it as 1% of total .
144
147
  if (nodePercentage < 1) {
145
- node.value = 0.01 * columnValue;
148
+ node.value = onePercent;
146
149
  totalPercentage = totalPercentage + 1;
147
150
  }
148
151
  else {
@@ -152,40 +155,117 @@ function adjustOnePercentHeightNodes(nodesInColumn) {
152
155
  //since we have adjusted the value to be 1% but we need to keep the sum of the percentage value under 100.
153
156
  var scalingRatio = totalPercentage !== 0 ? totalPercentage / 100 : 1;
154
157
  if (scalingRatio > 1) {
155
- nodesInColumn[index].forEach(function (node) {
156
- node.value = node.value / scalingRatio;
157
- changeColumnValue(node, node.actualValue, node.value);
158
+ // Loop through each node in that column and scale that node--and its incoming and outgoing links--by the
159
+ // scaling ratio. We need the sankey diagram to re-layout the nodes and links after we do this.
160
+ columnNodes.forEach(function (node) {
161
+ var normalized = (node.value = node.value / scalingRatio);
162
+ // Which Original Value? and Which Normalized Value is needed, here? The Node? The Link? Both?
163
+ changeColumnValue(node, computedNodes[node.nodeId], normalized, originalLinks);
158
164
  });
159
165
  }
160
166
  });
161
167
  }
162
168
  /**
163
- * This is used for normalizing each links value for reflecting the normalized node value.
169
+ * This is used for normalizing each link's value to reflect the normalized node value.
164
170
  */
165
- function changeColumnValue(node, originalValue, normalizedValue) {
166
- node.sourceLinks.forEach(function (link) {
167
- link.unnormalizedValue = link.value;
168
- var linkRatio = link.value / originalValue;
169
- link.value = normalizedValue * linkRatio;
170
- });
171
- node.targetLinks.forEach(function (link) {
172
- link.unnormalizedValue = link.value;
173
- var linkRatio = link.value / originalValue;
174
- link.value = normalizedValue * linkRatio;
175
- });
171
+ function changeColumnValue(node, originalNodeValue, normalizedNodeValue, linkValues) {
172
+ // For each link in the source and target, compute the proportion that this link contributes to the total
173
+ // then adjust the link's value to reflect its proportion of the normalized node value.
174
+ var updateLinkValue = function (link) {
175
+ var value = linkValue(linkValues, link);
176
+ link.unnormalizedValue = value;
177
+ var linkRatio = value / originalNodeValue;
178
+ link.value = Math.max(normalizedNodeValue * linkRatio, link.value);
179
+ };
180
+ node.sourceLinks.forEach(updateLinkValue);
181
+ node.targetLinks.forEach(updateLinkValue);
176
182
  }
177
183
  /**
178
184
  * This is used for calculating the node non normalized value based on link non normalized value.
185
+ * The links have the original weights. Computed nodes have the total weight of all incoming and outgoing links.
179
186
  */
180
- function populateNodeActualValue(data) {
187
+ function populateNodeActualValue(data, computedNodes, originalLinks) {
181
188
  data.links.forEach(function (link) {
182
189
  if (!link.unnormalizedValue) {
183
- link.unnormalizedValue = link.value;
190
+ link.unnormalizedValue = linkValue(originalLinks, link);
184
191
  }
185
192
  });
186
193
  data.nodes.forEach(function (node) {
187
- node.actualValue = Math.max(d3Sum(node.sourceLinks, function (link) { return link.unnormalizedValue; }), d3Sum(node.targetLinks, function (link) { return link.unnormalizedValue; }));
194
+ node.actualValue = computedNodes[node.nodeId];
195
+ });
196
+ }
197
+ /**
198
+ * This is used to introduce dynamic padding for cases where the number of nodes in a column is huge
199
+ * so that we maintain a node to space ratio for such columns as if we fail to do so the
200
+ * chart is devoid of nodes and only shows links.
201
+ */
202
+ // This is exported for unit tests
203
+ export function adjustPadding(sankey, height, nodesInColumn) {
204
+ var padding = sankey.nodePadding();
205
+ var minPadding = PADDING_PERCENTAGE * height;
206
+ Object.values(nodesInColumn).forEach(function (column) {
207
+ var totalPaddingInColumn = height - d3Sum(column, function (node) { return node.y1 - node.y0; });
208
+ if (minPadding < totalPaddingInColumn) {
209
+ // Here we are calculating the min of default and calculated padding, we will not increase the padding
210
+ // in any scenario.
211
+ padding = Math.min(padding, minPadding / (column.length - 1));
212
+ }
188
213
  });
214
+ sankey.nodePadding(padding);
215
+ }
216
+ function idFromNumberOrSNode(node) {
217
+ if (typeof node === 'number') {
218
+ return node;
219
+ }
220
+ return node.nodeId;
221
+ }
222
+ /**
223
+ * Duplicates the supplied chart data so that we do not alter the original.
224
+ * @param data The data to duplicate.
225
+ * @returns The duplicated data.
226
+ */
227
+ function duplicateData(data) {
228
+ return {
229
+ nodes: data.nodes.map(function (node) { return (__assign({}, node)); }),
230
+ links: data.links.map(function (link) { return (__assign({}, link)); }),
231
+ };
232
+ }
233
+ function valuesOfNodes(nodes) {
234
+ var result = {};
235
+ nodes.forEach(function (node) {
236
+ result[node.nodeId] = node.value;
237
+ });
238
+ return result;
239
+ }
240
+ function valuesOfLinks(links) {
241
+ var result = {};
242
+ links.forEach(function (link) {
243
+ var sourceId = idFromNumberOrSNode(link.source);
244
+ var sourceToTarget = result[sourceId];
245
+ if (!sourceToTarget) {
246
+ sourceToTarget = {};
247
+ result[sourceId] = sourceToTarget;
248
+ }
249
+ sourceToTarget[idFromNumberOrSNode(link.target)] = link.value;
250
+ });
251
+ return result;
252
+ }
253
+ function linkValue(originalLinks, link) {
254
+ return originalLinks[idFromNumberOrSNode(link.source)][idFromNumberOrSNode(link.target)];
255
+ }
256
+ // This is exported for unit tests.
257
+ export function preRenderLayout(margins, containerWidth, containerHeight, isRtl) {
258
+ var left = margins.left, right = margins.right, top = margins.top, bottom = margins.bottom;
259
+ var width = containerWidth - right;
260
+ var height = containerHeight - bottom > 0 ? containerHeight - bottom : 0;
261
+ var sankey = d3Sankey()
262
+ .nodeWidth(124)
263
+ .extent([
264
+ [left, top],
265
+ [width - 1, height - 6],
266
+ ])
267
+ .nodeAlign(isRtl ? sankeyRight : sankeyJustify);
268
+ return { sankey: sankey, height: height, width: width };
189
269
  }
190
270
  var SankeyChartBase = /** @class */ (function (_super) {
191
271
  __extends(SankeyChartBase, _super);
@@ -239,8 +319,9 @@ var SankeyChartBase = /** @class */ (function (_super) {
239
319
  _this._calloutId = getId('callout');
240
320
  _this._linkId = getId('link');
241
321
  _this._margins = { top: 36, right: 48, bottom: 32, left: 48 };
242
- _this._preRenderLayout();
243
- _this._normalizeData = memoizeFunction(function (data) { return _this._normalizeSankeyData(data); });
322
+ _this._normalizeData = memoizeFunction(function (data, containerWidth, containerHeight) {
323
+ return _this._normalizeSankeyData(data, containerWidth, containerHeight);
324
+ });
244
325
  _this._emptyChartId = getId('_SankeyChart_empty');
245
326
  return _this;
246
327
  }
@@ -267,18 +348,13 @@ var SankeyChartBase = /** @class */ (function (_super) {
267
348
  pathColor: pathColor,
268
349
  className: className,
269
350
  });
270
- // We are using the this._margins.left and this._margins.top in sankey extent while constructing the layout
271
- var _b = this._preRenderLayout(), height = _b.height, width = _b.width;
272
- var sankeyChartData = this.props.data.SankeyChartData;
273
- this._normalizeData(sankeyChartData);
274
- var nodePadding = 8;
275
- nodePadding = this._adjustPadding(this._sankey, height - 6, this._nodesInColumn);
276
- this._sankey.nodePadding(nodePadding);
277
- this._sankey(sankeyChartData);
278
- populateNodeActualValue(sankeyChartData);
279
- this._assignNodeColors();
280
- var nodeData = this._createNodes(classNames);
281
- var linkData = this._createLinks();
351
+ var _b = this._normalizeData(this.props.data.SankeyChartData, state.containerWidth, state.containerHeight), sankeyChartData = _b.data, width = _b.width, height = _b.height;
352
+ // NEXT: Move the following into _normalizeSankeyData to see if we can cache computation of
353
+ // colors, nodes, and links.
354
+ var dataNodes = sankeyChartData.nodes;
355
+ this._assignNodeColors(dataNodes); // This can probably safely move.
356
+ var nodeData = this._createNodes(classNames, dataNodes);
357
+ var linkData = this._createLinks(sankeyChartData.links);
282
358
  var calloutProps = {
283
359
  isCalloutVisible: state.isCalloutVisible,
284
360
  directionalHint: DirectionalHint.topAutoEdge,
@@ -304,50 +380,39 @@ var SankeyChartBase = /** @class */ (function (_super) {
304
380
  }
305
381
  return (React.createElement("div", { id: this._emptyChartId, role: 'alert', style: { opacity: '0' }, "aria-label": 'Graph has no data to display' }));
306
382
  };
307
- SankeyChartBase.prototype._preRenderLayout = function () {
308
- var _a = this.state, containerHeight = _a.containerHeight, containerWidth = _a.containerWidth;
309
- var _b = this._margins, left = _b.left, right = _b.right, top = _b.top, bottom = _b.bottom;
310
- var width = containerWidth - right;
311
- var height = containerHeight - bottom > 0 ? containerHeight - bottom : 0;
312
- this._sankey = d3Sankey()
313
- .nodeWidth(124)
314
- .extent([
315
- [left, top],
316
- [width - 1, height - 6],
317
- ])
318
- .nodeAlign(this._isRtl ? sankeyRight : sankeyJustify);
319
- return { height: height, width: width };
320
- };
321
- SankeyChartBase.prototype._normalizeSankeyData = function (data) {
322
- var nodesInColumn = (this._nodesInColumn = populateNodeInColumns(data, this._sankey));
323
- adjustOnePercentHeightNodes(nodesInColumn);
324
- };
325
- /**
326
- * This is used to introduce dynamic padding for cases where the number of nodes in a column is huge
327
- * so that we maintain a node to space ratio for such columns as if we fail to do so the
328
- * chart is devoid of nodes and only shows links.
329
- */
330
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
331
- SankeyChartBase.prototype._adjustPadding = function (sankey, height, nodesInColumn) {
332
- var padding = this._sankey.nodePadding();
333
- Object.values(nodesInColumn).forEach(function (column) {
334
- var minPadding = PADDING_PERCENTAGE * height;
335
- var toatlPaddingInColumn = height - d3Sum(column, function (node) { return node.y1 - node.y0; });
336
- if (minPadding < toatlPaddingInColumn) {
337
- //Here we are calculating the min of default and calculated padding, we will not increase the padding
338
- //in any scenario.
339
- padding = Math.min(padding, minPadding / (column.length - 1));
340
- }
341
- });
342
- return padding;
383
+ SankeyChartBase.prototype._normalizeSankeyData = function (data, containerWidth, containerHeight) {
384
+ var _a = preRenderLayout(this._margins, containerWidth, containerHeight, this._isRtl), sankey = _a.sankey, height = _a.height, width = _a.width;
385
+ // Clone the data before mutating it (via the SankeyLayoutGenerator) so that we don't mutate the original data.
386
+ var transformed = duplicateData(data);
387
+ sankey(transformed);
388
+ var nodesInColumn = groupNodesByColumn(transformed);
389
+ // Keep track of the original values of the links and their acccumulated values in the nodes
390
+ // Setting these in external objects so they cannot be mutated by other code.
391
+ // The IDs of nodes can be numbers or strings. But, the IDs of links are always the index into the "nodes" array.
392
+ // After the sankey layout is computed, the each link's `source` and `target` will have the ID of the node in the
393
+ // type originally specified in the Nodes array. Consequently, we get the values of those links after the sankey
394
+ // transformation.
395
+ var nodeValues = valuesOfNodes(transformed.nodes);
396
+ var linkValues = valuesOfLinks(transformed.links);
397
+ adjustOnePercentHeightNodes(nodesInColumn, nodeValues, linkValues);
398
+ adjustPadding(sankey, height - 6, nodesInColumn);
399
+ // `sankey` is called a second time, probably to re-layout the nodes with the one-percent adjusted weights.
400
+ // NOTE: The second call to `sankey` is required to allow links to be hoverable.
401
+ // Without the second call, the links are not hoverable.
402
+ sankey(transformed);
403
+ populateNodeActualValue(transformed, nodeValues, linkValues);
404
+ return {
405
+ width: width,
406
+ height: height,
407
+ data: transformed,
408
+ };
343
409
  };
344
- SankeyChartBase.prototype._createLinks = function () {
410
+ SankeyChartBase.prototype._createLinks = function (dataLinks) {
345
411
  var _this = this;
346
412
  var links = [];
347
- var sankeyChartData = this.props.data.SankeyChartData;
348
- if (sankeyChartData) {
413
+ if (dataLinks) {
349
414
  var linkId_1 = this._linkId;
350
- sankeyChartData.links.forEach(function (singleLink, index) {
415
+ dataLinks.forEach(function (singleLink, index) {
351
416
  var onMouseOut = function () {
352
417
  _this._onStreamLeave(singleLink);
353
418
  };
@@ -380,13 +445,12 @@ var SankeyChartBase = /** @class */ (function (_super) {
380
445
  }
381
446
  return links;
382
447
  };
383
- SankeyChartBase.prototype._createNodes = function (classNames) {
448
+ SankeyChartBase.prototype._createNodes = function (classNames, dataNodes) {
384
449
  var _this = this;
385
450
  var nodes = [];
386
- var sankeyChartData = this.props.data.SankeyChartData;
387
- if (sankeyChartData) {
451
+ if (dataNodes) {
388
452
  var state_1 = this.state;
389
- sankeyChartData.nodes.forEach(function (singleNode, index) {
453
+ dataNodes.forEach(function (singleNode, index) {
390
454
  var onMouseOut = function () {
391
455
  _this._onLeave(singleNode);
392
456
  };
@@ -510,7 +574,7 @@ var SankeyChartBase = /** @class */ (function (_super) {
510
574
  * This is used to assign node fillcolors and borderColor cyclically when the user doesnt
511
575
  * provide color to individual node.
512
576
  */
513
- SankeyChartBase.prototype._assignNodeColors = function () {
577
+ SankeyChartBase.prototype._assignNodeColors = function (nodes) {
514
578
  var colors;
515
579
  var borders;
516
580
  var _a = this.props, colorsForNodes = _a.colorsForNodes, borderColorsForNodes = _a.borderColorsForNodes;
@@ -523,7 +587,7 @@ var SankeyChartBase = /** @class */ (function (_super) {
523
587
  borders = DEFAULT_NODE_COLORS.map(function (color) { return color.borderColor; });
524
588
  }
525
589
  var currentIndex = 0;
526
- this.props.data.SankeyChartData.nodes.forEach(function (node) {
590
+ nodes.forEach(function (node) {
527
591
  if (!node.color && !node.borderColor) {
528
592
  node.color = colors[currentIndex];
529
593
  node.borderColor = borders[currentIndex];
@@ -582,6 +646,7 @@ var SankeyChartBase = /** @class */ (function (_super) {
582
646
  var _this = this;
583
647
  var _a = this.state, containerWidth = _a.containerWidth, containerHeight = _a.containerHeight;
584
648
  this._reqID = requestAnimationFrame(function () {
649
+ // NOTE: Calls to this method trigger a re-render.
585
650
  var container = _this.props.parentRef ? _this.props.parentRef : _this.chartContainer;
586
651
  var currentContainerWidth = container && container.getBoundingClientRect().width;
587
652
  var currentContainerHeight = container && container.getBoundingClientRect().height;