@fluentui/react-charts 0.0.0-nightly-20250827-0407.1 → 0.0.0-nightly-20250829-0406.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +15 -15
  2. package/dist/index.d.ts +27 -2
  3. package/lib/components/AreaChart/AreaChart.js +3 -3
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/CommonComponents/CartesianChart.js +4 -4
  6. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  7. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  8. package/lib/components/DeclarativeChart/DeclarativeChart.js +1 -1
  9. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  10. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  11. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +59 -13
  12. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  13. package/lib/components/FunnelChart/funnelGeometry.js.map +1 -1
  14. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  15. package/lib/components/LineChart/LineChart.js +195 -250
  16. package/lib/components/LineChart/LineChart.js.map +1 -1
  17. package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  18. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  19. package/lib/components/ScatterChart/ScatterChart.js +30 -54
  20. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  21. package/lib/components/VerticalBarChart/VerticalBarChart.js +2 -2
  22. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  23. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +2 -2
  24. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  25. package/lib/types/DataPoint.js +6 -1
  26. package/lib/types/DataPoint.js.map +1 -1
  27. package/lib/utilities/Common.styles.raw.js.map +1 -1
  28. package/lib/utilities/image-export-utils.js.map +1 -1
  29. package/lib/utilities/scatterpolar-utils.js +7 -18
  30. package/lib/utilities/scatterpolar-utils.js.map +1 -1
  31. package/lib/utilities/utilities.js +130 -127
  32. package/lib/utilities/utilities.js.map +1 -1
  33. package/lib/utilities/vbc-utils.js.map +1 -1
  34. package/lib-commonjs/components/AreaChart/AreaChart.js +2 -2
  35. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  36. package/lib-commonjs/components/CommonComponents/CartesianChart.js +4 -4
  37. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  38. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  39. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +1 -1
  40. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  41. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  42. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +58 -12
  43. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  44. package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -1
  45. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  46. package/lib-commonjs/components/LineChart/LineChart.js +193 -248
  47. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  48. package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  49. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  50. package/lib-commonjs/components/ScatterChart/ScatterChart.js +28 -52
  51. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  52. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +1 -1
  53. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  54. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +1 -1
  55. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  56. package/lib-commonjs/types/DataPoint.js +6 -1
  57. package/lib-commonjs/types/DataPoint.js.map +1 -1
  58. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  59. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  60. package/lib-commonjs/utilities/scatterpolar-utils.js +7 -18
  61. package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -1
  62. package/lib-commonjs/utilities/utilities.js +142 -118
  63. package/lib-commonjs/utilities/utilities.js.map +1 -1
  64. package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
  65. package/package.json +12 -12
@@ -90,21 +90,15 @@ _export(exports, {
90
90
  defaultYAxisTickFormatter: function() {
91
91
  return defaultYAxisTickFormatter;
92
92
  },
93
- domainRangeOfDateForAreaLineVerticalBarChart: function() {
94
- return domainRangeOfDateForAreaLineVerticalBarChart;
93
+ domainRangeOfDateForAreaLineScatterVerticalBarCharts: function() {
94
+ return domainRangeOfDateForAreaLineScatterVerticalBarCharts;
95
95
  },
96
- domainRangeOfDateForScatterChart: function() {
97
- return domainRangeOfDateForScatterChart;
98
- },
99
- domainRangeOfNumericForAreaChart: function() {
100
- return domainRangeOfNumericForAreaChart;
96
+ domainRangeOfNumericForAreaLineScatterCharts: function() {
97
+ return domainRangeOfNumericForAreaLineScatterCharts;
101
98
  },
102
99
  domainRangeOfNumericForHorizontalBarChartWithAxis: function() {
103
100
  return domainRangeOfNumericForHorizontalBarChartWithAxis;
104
101
  },
105
- domainRangeOfNumericForScatterChart: function() {
106
- return domainRangeOfNumericForScatterChart;
107
- },
108
102
  domainRangeOfVSBCNumeric: function() {
109
103
  return domainRangeOfVSBCNumeric;
110
104
  },
@@ -150,9 +144,18 @@ _export(exports, {
150
144
  getDateFormatLevel: function() {
151
145
  return getDateFormatLevel;
152
146
  },
147
+ getDomainPaddingForMarkers: function() {
148
+ return getDomainPaddingForMarkers;
149
+ },
150
+ getRangeForScatterMarkerSize: function() {
151
+ return getRangeForScatterMarkerSize;
152
+ },
153
153
  getScalePadding: function() {
154
154
  return getScalePadding;
155
155
  },
156
+ getScatterXDomainExtent: function() {
157
+ return getScatterXDomainExtent;
158
+ },
156
159
  getSecureProps: function() {
157
160
  return getSecureProps;
158
161
  },
@@ -168,6 +171,9 @@ _export(exports, {
168
171
  groupChartDataByYValue: function() {
169
172
  return groupChartDataByYValue;
170
173
  },
174
+ isPlottable: function() {
175
+ return isPlottable;
176
+ },
171
177
  isScalePaddingDefined: function() {
172
178
  return isScalePaddingDefined;
173
179
  },
@@ -177,6 +183,9 @@ _export(exports, {
177
183
  isTextMode: function() {
178
184
  return isTextMode;
179
185
  },
186
+ isValidDomainValue: function() {
187
+ return isValidDomainValue;
188
+ },
180
189
  pointTypes: function() {
181
190
  return pointTypes;
182
191
  },
@@ -267,9 +276,9 @@ function yAxisTickFormatterInternal(value, limitWidth = false) {
267
276
  function defaultYAxisTickFormatter(value) {
268
277
  return yAxisTickFormatterInternal(value);
269
278
  }
270
- function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
279
+ function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleType) {
271
280
  const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap, calcMaxLabelWidth } = xAxisParams;
272
- const xAxisScale = (0, _d3scale.scaleLinear)().domain([
281
+ const xAxisScale = createNumericScale(scaleType).domain([
273
282
  domainNRangeValues.dStartValue,
274
283
  domainNRangeValues.dEndValue
275
284
  ]).range([
@@ -278,19 +287,19 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
278
287
  ]);
279
288
  showRoundOffXTickValues && xAxisScale.nice();
280
289
  let tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
281
- const tickFormat = (domainValue, _index)=>{
290
+ const tickFormat = (domainValue, _index, defaultFormat)=>{
282
291
  if (tickParams.tickFormat) {
283
292
  return (0, _d3format.format)(tickParams.tickFormat)(domainValue);
284
293
  }
285
294
  const xAxisValue = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
286
- return (0, _chartutilities.formatToLocaleString)(xAxisValue, culture);
295
+ return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(xAxisValue)) === '' ? '' : (0, _chartutilities.formatToLocaleString)(xAxisValue, culture);
287
296
  };
288
297
  if (hideTickOverlap && typeof xAxisCount === 'undefined') {
289
- const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 20;
298
+ const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map((v, i)=>tickFormat(v, i))) + 20;
290
299
  const [start, end] = xAxisScale.range();
291
300
  tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
292
301
  }
293
- const xAxis = (0, _d3axis.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat(tickFormat);
302
+ const xAxis = (0, _d3axis.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat((v, i)=>tickFormat(v, i, xAxisScale.tickFormat(tickCount)));
294
303
  if ([
295
304
  6,
296
305
  8
@@ -685,7 +694,7 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
685
694
  yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
686
695
  return yAxisScale;
687
696
  }
688
- function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false) {
697
+ function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false, scaleType) {
689
698
  const { yMinMaxValues = {
690
699
  startValue: 0,
691
700
  endValue: 0
@@ -702,16 +711,38 @@ function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, cha
702
711
  yMin = yMin - yPadding;
703
712
  yMax = yMax + yPadding;
704
713
  }
705
- const yAxisScale = (0, _d3scale.scaleLinear)().domain([
714
+ let scaleDomain = [
706
715
  domainValues[0],
707
- yMax
708
- ]).range([
716
+ domainValues[domainValues.length - 1]
717
+ ];
718
+ if (scaleType === 'log') {
719
+ let domainStart = yMinMaxValues.startValue;
720
+ let domainEnd = yMinMaxValues.endValue;
721
+ if (yMinValue > 0) {
722
+ domainStart = Math.min(domainStart, yMinValue);
723
+ }
724
+ if (yMaxValue > 0) {
725
+ domainEnd = Math.max(domainEnd, yMaxValue);
726
+ }
727
+ scaleDomain = [
728
+ domainStart,
729
+ domainEnd
730
+ ];
731
+ }
732
+ const yAxisScale = createNumericScale(scaleType).domain(scaleDomain).range([
709
733
  containerHeight - margins.bottom,
710
734
  margins.top + (eventAnnotationProps ? eventLabelHeight : 0)
711
735
  ]);
712
736
  const axis = !isRtl && useSecondaryYScale || isRtl && !useSecondaryYScale ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
713
- const yAxis = axis.tickPadding(tickPadding).tickValues(domainValues).tickSizeInner(-(containerWidth - margins.left - margins.right));
714
- yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(defaultYAxisTickFormatter);
737
+ const yAxis = axis.tickPadding(tickPadding).tickSizeInner(-(containerWidth - margins.left - margins.right));
738
+ if (scaleType !== 'log') {
739
+ yAxis.tickValues(domainValues);
740
+ }
741
+ const tickFormat = (domainValue, index, defaultFormat)=>{
742
+ const value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
743
+ return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(value)) === '' ? '' : defaultYAxisTickFormatter(value);
744
+ };
745
+ yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat((v, i)=>tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)));
715
746
  yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
716
747
  axisData.yAxisDomainValues = domainValues;
717
748
  return yAxisScale;
@@ -975,43 +1006,14 @@ function getXAxisType(points) {
975
1006
  }
976
1007
  return isXAxisDateType;
977
1008
  }
978
- function domainRangeOfNumericForAreaChart(points, margins, width, isRTL) {
1009
+ function domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, scaleType, hasMarkersMode) {
979
1010
  const isScatterPolar = isScatterPolarSeries(points);
980
- const xMin = (0, _d3array.min)(points, (point)=>{
981
- return (0, _d3array.min)(point.data, (item)=>item.x);
982
- });
983
- const xMax = (0, _d3array.max)(points, (point)=>{
984
- return (0, _d3array.max)(point.data, (item)=>{
985
- return item.x;
986
- });
987
- });
988
- const rStartValue = margins.left;
989
- const rEndValue = width - margins.right;
990
- return isRTL ? {
991
- dStartValue: isScatterPolar ? 1 : xMax,
992
- dEndValue: isScatterPolar ? -1 : xMin,
993
- rStartValue,
994
- rEndValue
995
- } : {
996
- dStartValue: isScatterPolar ? -1 : xMin,
997
- dEndValue: isScatterPolar ? 1 : xMax,
998
- rStartValue,
999
- rEndValue
1000
- };
1001
- }
1002
- function domainRangeOfNumericForScatterChart(points, margins, width, isRTL) {
1003
- const isScatterPolar = isScatterPolarSeries(points);
1004
- let xMin = (0, _d3array.min)(points, (point)=>{
1005
- return (0, _d3array.min)(point.data, (item)=>item.x);
1006
- });
1007
- let xMax = (0, _d3array.max)(points, (point)=>{
1008
- return (0, _d3array.max)(point.data, (item)=>{
1009
- return item.x;
1010
- });
1011
- });
1012
- const xPadding = (xMax - xMin) * 0.1;
1013
- xMin = xMin - xPadding;
1014
- xMax = xMax + xPadding;
1011
+ let [xMin, xMax] = getScatterXDomainExtent(points, scaleType);
1012
+ if (hasMarkersMode) {
1013
+ const xPadding = getDomainPaddingForMarkers(xMin, xMax, scaleType);
1014
+ xMin = xMin - xPadding.start;
1015
+ xMax = xMax + xPadding.end;
1016
+ }
1015
1017
  const rStartValue = margins.left;
1016
1018
  const rEndValue = width - margins.right;
1017
1019
  return isRTL ? {
@@ -1101,22 +1103,15 @@ function domainRangeOfVSBCNumeric(points, margins, width, isRTL, barWidth) {
1101
1103
  rEndValue: rMin
1102
1104
  };
1103
1105
  }
1104
- function domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues = [], chartType, barWidth) {
1106
+ function domainRangeOfDateForAreaLineScatterVerticalBarCharts(points, margins, width, isRTL, tickValues = [], chartType, barWidth, hasMarkersMode) {
1105
1107
  let sDate;
1106
1108
  let lDate;
1107
- if (chartType === 0 || chartType === 1) {
1108
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1109
- sDate = (0, _d3array.min)(points, (point)=>{
1110
- return (0, _d3array.min)(point.data, (item)=>{
1111
- return item.x;
1112
- });
1113
- });
1114
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1115
- lDate = (0, _d3array.max)(points, (point)=>{
1116
- return (0, _d3array.max)(point.data, (item)=>{
1117
- return item.x;
1118
- });
1119
- });
1109
+ if ([
1110
+ 0,
1111
+ 1,
1112
+ 7
1113
+ ].includes(chartType)) {
1114
+ [sDate, lDate] = getScatterXDomainExtent(points);
1120
1115
  // Need to draw graph with given small and large date
1121
1116
  // (Which Involves customization of date axis tick values)
1122
1117
  // That may be Either from given graph data or from prop 'tickValues' date values.
@@ -1134,6 +1129,11 @@ function domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, is
1134
1129
  sDate = (0, _d3array.min)(points, (point)=>point.x);
1135
1130
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1136
1131
  lDate = (0, _d3array.max)(points, (point)=>point.x);
1132
+ if (hasMarkersMode || chartType === 7) {
1133
+ const xPadding = getDomainPaddingForMarkers(sDate.getTime(), lDate.getTime());
1134
+ sDate = new Date(sDate.getTime() - xPadding.start);
1135
+ lDate = new Date(lDate.getTime() + xPadding.end);
1136
+ }
1137
1137
  }
1138
1138
  const rStartValue = margins.left;
1139
1139
  const rEndValue = width - margins.right;
@@ -1149,50 +1149,6 @@ function domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, is
1149
1149
  rEndValue
1150
1150
  };
1151
1151
  }
1152
- function domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues = []) {
1153
- let sDate;
1154
- let lDate;
1155
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1156
- sDate = (0, _d3array.min)(points, (point)=>{
1157
- return (0, _d3array.min)(point.data, (item)=>{
1158
- return item.x;
1159
- });
1160
- });
1161
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1162
- lDate = (0, _d3array.max)(points, (point)=>{
1163
- return (0, _d3array.max)(point.data, (item)=>{
1164
- return item.x;
1165
- });
1166
- });
1167
- const xPadding = (lDate.getTime() - sDate.getTime()) * 0.1;
1168
- sDate = new Date(sDate.getTime() - xPadding);
1169
- lDate = new Date(lDate.getTime() + xPadding);
1170
- // Need to draw graph with given small and large date
1171
- // (Which Involves customization of date axis tick values)
1172
- // That may be Either from given graph data or from prop 'tickValues' date values.
1173
- // So, Finding smallest and largest dates
1174
- sDate = (0, _d3array.min)([
1175
- ...tickValues,
1176
- sDate
1177
- ]);
1178
- lDate = (0, _d3array.max)([
1179
- ...tickValues,
1180
- lDate
1181
- ]);
1182
- const rStartValue = margins.left;
1183
- const rEndValue = width - margins.right;
1184
- return isRTL ? {
1185
- dStartValue: lDate,
1186
- dEndValue: sDate,
1187
- rStartValue,
1188
- rEndValue
1189
- } : {
1190
- dStartValue: sDate,
1191
- dEndValue: lDate,
1192
- rStartValue,
1193
- rEndValue
1194
- };
1195
- }
1196
1152
  function domainRangeOfVerticalNumeric(points, margins, containerWidth, isRTL, barWidth) {
1197
1153
  const xMax = (0, _d3array.max)(points, (point)=>point.x);
1198
1154
  const xMin = (0, _d3array.min)(points, (point)=>point.x);
@@ -1210,12 +1166,14 @@ function domainRangeOfVerticalNumeric(points, margins, containerWidth, isRTL, ba
1210
1166
  rEndValue: rMax
1211
1167
  };
1212
1168
  }
1213
- function findNumericMinMaxOfY(points, yAxisType, useSecondaryYScale) {
1169
+ function findNumericMinMaxOfY(points, yAxisType, useSecondaryYScale, scaleType) {
1214
1170
  const values = [];
1215
1171
  points.forEach((point)=>{
1216
1172
  if (!useSecondaryYScale === !point.useSecondaryYScale) {
1217
1173
  point.data.forEach((data)=>{
1218
- values.push(data.y);
1174
+ if (isValidDomainValue(data.y, scaleType)) {
1175
+ values.push(data.y);
1176
+ }
1219
1177
  });
1220
1178
  }
1221
1179
  });
@@ -1605,3 +1563,69 @@ function isTextMode(points) {
1605
1563
  return typeof ((_item_lineOptions = item.lineOptions) === null || _item_lineOptions === void 0 ? void 0 : _item_lineOptions.mode) === 'string' && item.lineOptions.mode === 'text';
1606
1564
  });
1607
1565
  }
1566
+ // TODO: Refactor to encapsulate the complete numeric scale creation logic here, including setting domain and range.
1567
+ const createNumericScale = (scaleType)=>{
1568
+ if (scaleType === 'log') {
1569
+ return (0, _d3scale.scaleLog)();
1570
+ } else {
1571
+ return (0, _d3scale.scaleLinear)();
1572
+ }
1573
+ };
1574
+ const getDomainPaddingForMarkers = (minVal, maxVal, scaleType)=>{
1575
+ if (scaleType === 'log') {
1576
+ return {
1577
+ start: minVal * 0.5,
1578
+ end: maxVal
1579
+ };
1580
+ }
1581
+ const defaultPadding = (maxVal - minVal) * 0.1;
1582
+ return {
1583
+ start: defaultPadding,
1584
+ end: defaultPadding
1585
+ };
1586
+ };
1587
+ const isValidDomainValue = (value, scaleType)=>{
1588
+ return typeof value !== 'number' || scaleType !== 'log' || value > 0;
1589
+ };
1590
+ const isPlottable = (x, y)=>{
1591
+ return !(0, _chartutilities.isInvalidValue)(x) && !(0, _chartutilities.isInvalidValue)(y);
1592
+ };
1593
+ const getScatterXDomainExtent = (points, scaleType)=>{
1594
+ const isValidDataPointForScale = (item)=>isValidDomainValue(item.x, scaleType);
1595
+ const xMin = (0, _d3array.min)(points, (point)=>{
1596
+ return (0, _d3array.min)(point.data.filter(isValidDataPointForScale), (item)=>item.x);
1597
+ });
1598
+ const xMax = (0, _d3array.max)(points, (point)=>{
1599
+ return (0, _d3array.max)(point.data.filter(isValidDataPointForScale), (item)=>{
1600
+ return item.x;
1601
+ });
1602
+ });
1603
+ return [
1604
+ xMin,
1605
+ xMax
1606
+ ];
1607
+ };
1608
+ const getRangeForScatterMarkerSize = ({ data, xScale, yScalePrimary, yScaleSecondary, useSecondaryYScale, xScaleType, yScaleType: primaryYScaleType, secondaryYScaleType })=>{
1609
+ // Note: This function is executed after the scale is created, so the actual padding can be
1610
+ // obtained by calculating the difference between the respective minimums or maximums of the
1611
+ // scale domain and the data. However, doing so often causes the marker size to scale up
1612
+ // unnecessarily when the scale uses a wider domain than required (due to the use of D3's nice
1613
+ // function or our own tick value calculations).
1614
+ // A better approach could be to treat the marker size as a fixed pixel value and adjust the
1615
+ // scale domain with sufficient padding to accommodate the maximum marker size—instead of doing
1616
+ // it the other way around (i.e., adjusting the scale domain first with padding and then scaling
1617
+ // the markers to fit inside the plot area).
1618
+ const [xMin, xMax] = getScatterXDomainExtent(data, xScaleType);
1619
+ const xPadding = getDomainPaddingForMarkers(+xMin, +xMax, xScaleType);
1620
+ const scaleXMin = xMin instanceof Date ? new Date(+xMin - xPadding.start) : xMin - xPadding.start;
1621
+ const scaleXMax = xMax instanceof Date ? new Date(+xMax + xPadding.end) : xMax + xPadding.end;
1622
+ const extraXPixels = Math.min(Math.abs(xScale(xMin) - xScale(scaleXMin)), Math.abs(xScale(scaleXMax) - xScale(xMax)));
1623
+ const yScaleType = useSecondaryYScale ? secondaryYScaleType : primaryYScaleType;
1624
+ const { startValue: yMin, endValue: yMax } = findNumericMinMaxOfY(data, undefined, useSecondaryYScale, yScaleType);
1625
+ const yPadding = getDomainPaddingForMarkers(yMin, yMax, yScaleType);
1626
+ const scaleYMin = yMin - yPadding.start;
1627
+ const scaleYMax = yMax + yPadding.end;
1628
+ const yScale = useSecondaryYScale ? yScaleSecondary : yScalePrimary;
1629
+ const extraYPixels = Math.min(Math.abs(yScale(scaleYMin) - yScale(yMin)), Math.abs(yScale(yMax) - yScale(scaleYMax)));
1630
+ return Math.min(extraXPixels, extraYPixels);
1631
+ };