@fluentui/react-charts 0.0.0-nightly-20250603-0406.1 → 0.0.0-nightly-20250605-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 (61) hide show
  1. package/CHANGELOG.md +15 -15
  2. package/dist/index.d.ts +1 -1
  3. package/lib/components/CommonComponents/CartesianChart.js +3 -0
  4. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  5. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  6. package/lib/components/CommonComponents/ChartPopover.js +10 -10
  7. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  8. package/lib/components/DeclarativeChart/DeclarativeChart.js +7 -2
  9. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  10. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +7 -4
  11. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  12. package/lib/components/DonutChart/Arc/Arc.js +2 -2
  13. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  14. package/lib/components/DonutChart/DonutChart.js +2 -2
  15. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  16. package/lib/components/GaugeChart/GaugeChart.js +9 -9
  17. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  18. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +2 -2
  19. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  20. package/lib/components/HeatMapChart/HeatMapChart.js +3 -2
  21. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  22. package/lib/components/HorizontalBarChart/HorizontalBarChart.js +8 -8
  23. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  24. package/lib/components/VerticalBarChart/VerticalBarChart.js +2 -2
  25. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  26. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +2 -2
  27. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  28. package/lib/utilities/utilities.js +232 -53
  29. package/lib/utilities/utilities.js.map +1 -1
  30. package/lib-commonjs/components/CommonComponents/CartesianChart.js +3 -0
  31. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  32. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  33. package/lib-commonjs/components/CommonComponents/ChartPopover.js +10 -10
  34. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  35. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +6 -1
  36. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  37. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +6 -3
  38. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  39. package/lib-commonjs/components/DonutChart/Arc/Arc.js +1 -1
  40. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  41. package/lib-commonjs/components/DonutChart/DonutChart.js +2 -2
  42. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  43. package/lib-commonjs/components/GaugeChart/GaugeChart.js +8 -8
  44. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  45. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
  46. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  47. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -1
  48. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  49. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +7 -7
  50. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  51. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +1 -1
  52. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  53. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +1 -1
  54. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  55. package/lib-commonjs/utilities/utilities.js +236 -61
  56. package/lib-commonjs/utilities/utilities.js.map +1 -1
  57. package/package.json +13 -13
  58. package/lib/utilities/locale-util.js +0 -15
  59. package/lib/utilities/locale-util.js.map +0 -1
  60. package/lib-commonjs/utilities/locale-util.js +0 -25
  61. package/lib-commonjs/utilities/locale-util.js.map +0 -1
@@ -8,6 +8,7 @@ import { timeSecond as d3TimeSecond, timeMinute as d3TimeMinute, timeHour as d3T
8
8
  import { curveLinear as d3CurveLinear, curveNatural as d3CurveNatural, curveStep as d3CurveStep, curveStepAfter as d3CurveStepAfter, curveStepBefore as d3CurveStepBefore } from 'd3-shape';
9
9
  import { formatPrefix as d3FormatPrefix } from 'd3-format';
10
10
  import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
11
+ import { formatDateToLocaleString, formatToLocaleString, getMultiLevelDateTimeFormatOptions } from '@fluentui/chart-utilities';
11
12
  export var ChartTypes;
12
13
  (function(ChartTypes) {
13
14
  ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
@@ -31,6 +32,30 @@ export var YAxisType;
31
32
  YAxisType[YAxisType["DateAxis"] = 1] = "DateAxis";
32
33
  YAxisType[YAxisType["StringAxis"] = 2] = "StringAxis";
33
34
  })(YAxisType || (YAxisType = {}));
35
+ function yAxisTickFormatterInternal(value, limitWidth = false) {
36
+ // Use SI format prefix with 2 decimal places without insignificant trailing zeros
37
+ let formatter = d3FormatPrefix('.2~', value);
38
+ if (Math.abs(value) < 1) {
39
+ // Don't use SI notation for small numbers as it is less readable
40
+ formatter = d3Format('.2~g');
41
+ } else if (limitWidth && Math.abs(value) >= 1000) {
42
+ // If width is limited, use SI format prefix with 1 point precision
43
+ formatter = d3FormatPrefix('.1~', value);
44
+ }
45
+ const formattedValue = formatter(value);
46
+ // Replace 'G' with 'B' if the value is greater than 10^9 as it is a more common convention
47
+ if (Math.abs(value) >= 1e9) {
48
+ return formattedValue.replace('G', 'B');
49
+ }
50
+ return formattedValue;
51
+ }
52
+ /**
53
+ * Formatter for y axis ticks.
54
+ * @param value - The number to format.
55
+ * @returns The formatted string .
56
+ */ export function defaultYAxisTickFormatter(value) {
57
+ return yAxisTickFormatterInternal(value);
58
+ }
34
59
  /**
35
60
  * Create Numeric X axis
36
61
  * @export
@@ -51,7 +76,7 @@ export var YAxisType;
51
76
  return d3Format(tickParams.tickFormat)(domainValue);
52
77
  }
53
78
  const xAxisValue = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
54
- return convertToLocaleString(xAxisValue, culture);
79
+ return formatToLocaleString(xAxisValue, culture);
55
80
  };
56
81
  if (hideTickOverlap && typeof xAxisCount === 'undefined') {
57
82
  const longestLabelWidth = calculateLongestLabelWidth(xAxisScale.ticks().map(tickFormat), '.fui-cart__xAxis text') + 20;
@@ -75,16 +100,145 @@ export var YAxisType;
75
100
  tickValues
76
101
  };
77
102
  }
78
- function multiFormat(date, locale, useUTC) {
103
+ /**
104
+ * This function returns a multilevel formatter for a given date range.
105
+ * It determines the appropriate date format to accommodate each tick value.
106
+ * The goal is to represent the date label in the smallest possible format without loss of information.
107
+ * The challenge here is to adhere to locale specific formats while ensuring the complete label is shown.
108
+ * There is an exhaustive map of all possible date/time units and their respective formats.
109
+ * Based on the range of formatting granularity levels, a format spanning the range is returned.
110
+ * @param startLevel - The starting level of the date format.
111
+ * @param endLevel - The ending level of the date format.
112
+ * @param locale - The locale object for formatting.
113
+ * @param useUTC
114
+ * @returns
115
+ */ function getMultiLevelD3DateFormatter(startLevel, endLevel, locale, useUTC) {
79
116
  const timeFormat = locale ? useUTC ? locale.utcFormat : locale.format : useUTC ? d3UtcFormat : d3TimeFormat;
80
- const formatMillisecond = timeFormat('.%L');
81
- const formatSecond = timeFormat(':%S');
82
- const formatMinute = timeFormat('%I:%M');
83
- const formatHour = timeFormat('%I %p');
84
- const formatDay = timeFormat('%a %d');
85
- const formatWeek = timeFormat('%b %d');
86
- const formatMonth = timeFormat('%B');
87
- const formatYear = timeFormat('%Y');
117
+ // Refer to https://d3js.org/d3-time-format#locale_format to see explanation about each format specifier
118
+ const DEFAULT = '%c';
119
+ const MS = '.%L';
120
+ const MS_S = ':%S.%L';
121
+ const MS_S_MIN = '%M:%S.%L';
122
+ const MS_S_MIN_H = '%-I:%M:%S.%L %p';
123
+ const MS_S_MIN_H_D = '%a %d, %X';
124
+ const MS_S_MIN_H_D_W = '%b %d, %X';
125
+ const MS_S_MIN_H_D_W_M = MS_S_MIN_H_D_W;
126
+ const MS_S_MIN_H_D_W_M_Y = DEFAULT;
127
+ const S = ':%S';
128
+ const S_MIN = '%-I:%M:%S';
129
+ const S_MIN_H = '%X';
130
+ const S_MIN_H_D = MS_S_MIN_H_D;
131
+ const S_MIN_H_D_W = MS_S_MIN_H_D_W;
132
+ const S_MIN_H_D_W_M = MS_S_MIN_H_D_W_M;
133
+ const S_MIN_H_D_W_M_Y = DEFAULT;
134
+ const MIN = '%-I:%M %p';
135
+ const MIN_H = MIN;
136
+ const MIN_H_D = '%a %d, %-I:%M %p';
137
+ const MIN_H_D_W = '%b %d, %-I:%M %p';
138
+ const MIN_H_D_W_M = MIN_H_D_W;
139
+ const MIN_H_D_W_M_Y = '%x, %-I:%M %p';
140
+ const H = '%-I %p';
141
+ const H_D = '%a %d, %-I %p';
142
+ const H_D_W = '%b %d, %-I %p';
143
+ const H_D_W_M = H_D_W;
144
+ const H_D_W_M_Y = '%x, %-I %p';
145
+ const D = '%a %d';
146
+ const D_W = '%b %d';
147
+ const D_W_M = D_W;
148
+ const D_W_M_Y = '%x';
149
+ const W = D_W;
150
+ const W_M = W;
151
+ const W_M_Y = D_W_M_Y;
152
+ const M = '%B';
153
+ const M_Y = '%b %Y';
154
+ const Y = '%Y';
155
+ const MULTI_LEVEL_DATE_TIME_FORMATS = [
156
+ // ms, s, min, h, d, w, m, y
157
+ [
158
+ MS,
159
+ MS_S,
160
+ MS_S_MIN,
161
+ MS_S_MIN_H,
162
+ MS_S_MIN_H_D,
163
+ MS_S_MIN_H_D_W,
164
+ MS_S_MIN_H_D_W_M,
165
+ MS_S_MIN_H_D_W_M_Y
166
+ ],
167
+ [
168
+ DEFAULT,
169
+ S,
170
+ S_MIN,
171
+ S_MIN_H,
172
+ S_MIN_H_D,
173
+ S_MIN_H_D_W,
174
+ S_MIN_H_D_W_M,
175
+ S_MIN_H_D_W_M_Y
176
+ ],
177
+ [
178
+ DEFAULT,
179
+ DEFAULT,
180
+ MIN,
181
+ MIN_H,
182
+ MIN_H_D,
183
+ MIN_H_D_W,
184
+ MIN_H_D_W_M,
185
+ MIN_H_D_W_M_Y
186
+ ],
187
+ [
188
+ DEFAULT,
189
+ DEFAULT,
190
+ DEFAULT,
191
+ H,
192
+ H_D,
193
+ H_D_W,
194
+ H_D_W_M,
195
+ H_D_W_M_Y
196
+ ],
197
+ [
198
+ DEFAULT,
199
+ DEFAULT,
200
+ DEFAULT,
201
+ DEFAULT,
202
+ D,
203
+ D_W,
204
+ D_W_M,
205
+ D_W_M_Y
206
+ ],
207
+ [
208
+ DEFAULT,
209
+ DEFAULT,
210
+ DEFAULT,
211
+ DEFAULT,
212
+ DEFAULT,
213
+ W,
214
+ W_M,
215
+ W_M_Y
216
+ ],
217
+ [
218
+ DEFAULT,
219
+ DEFAULT,
220
+ DEFAULT,
221
+ DEFAULT,
222
+ DEFAULT,
223
+ DEFAULT,
224
+ M,
225
+ M_Y
226
+ ],
227
+ [
228
+ DEFAULT,
229
+ DEFAULT,
230
+ DEFAULT,
231
+ DEFAULT,
232
+ DEFAULT,
233
+ DEFAULT,
234
+ DEFAULT,
235
+ Y
236
+ ]
237
+ ];
238
+ const formatter = timeFormat(MULTI_LEVEL_DATE_TIME_FORMATS[startLevel][endLevel]);
239
+ return formatter;
240
+ }
241
+ function getDateFormatLevel(date, useUTC) {
88
242
  const timeSecond = useUTC ? d3UtcSecond : d3TimeSecond;
89
243
  const timeMinute = useUTC ? d3UtcMinute : d3TimeMinute;
90
244
  const timeHour = useUTC ? d3UtcHour : d3TimeHour;
@@ -92,7 +246,43 @@ function multiFormat(date, locale, useUTC) {
92
246
  const timeMonth = useUTC ? d3UtcMonth : d3TimeMonth;
93
247
  const timeWeek = useUTC ? d3UtcWeek : d3TimeWeek;
94
248
  const timeYear = useUTC ? d3UtcYear : d3TimeYear;
95
- return (timeSecond(date) < date ? formatMillisecond : timeMinute(date) < date ? formatSecond : timeHour(date) < date ? formatMinute : timeDay(date) < date ? formatHour : timeMonth(date) < date ? timeWeek(date) < date ? formatDay : formatWeek : timeYear(date) < date ? formatMonth : formatYear)(date);
249
+ const formats = [
250
+ {
251
+ formatLevel: 0,
252
+ condition: (d)=>timeSecond(d) < d
253
+ },
254
+ {
255
+ formatLevel: 1,
256
+ condition: (d)=>timeMinute(d) < d
257
+ },
258
+ {
259
+ formatLevel: 2,
260
+ condition: (d)=>timeHour(d) < d
261
+ },
262
+ {
263
+ formatLevel: 3,
264
+ condition: (d)=>timeDay(d) < d
265
+ },
266
+ {
267
+ formatLevel: 4,
268
+ condition: (d)=>timeMonth(d) < d && timeWeek(d) < d
269
+ },
270
+ {
271
+ formatLevel: 5,
272
+ condition: (d)=>timeMonth(d) < d
273
+ },
274
+ {
275
+ formatLevel: 6,
276
+ condition: (d)=>timeYear(d) < d
277
+ },
278
+ {
279
+ formatLevel: 7,
280
+ condition: ()=>true
281
+ }
282
+ ];
283
+ const matchedFormat = formats.find(({ condition })=>condition(date));
284
+ var _matchedFormat_formatLevel;
285
+ return (_matchedFormat_formatLevel = matchedFormat === null || matchedFormat === void 0 ? void 0 : matchedFormat.formatLevel) !== null && _matchedFormat_formatLevel !== void 0 ? _matchedFormat_formatLevel : 7;
96
286
  }
97
287
  /**
98
288
  * Creating Date x axis of the Chart
@@ -100,26 +290,37 @@ function multiFormat(date, locale, useUTC) {
100
290
  * @param {IXAxisParams} xAxisParams
101
291
  * @param {ITickParams} tickParams
102
292
  */ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
103
- const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, hideTickOverlap } = xAxisParams;
104
- const xAxisScale = useUTC ? d3ScaleUtc() : d3ScaleTime();
293
+ const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount } = xAxisParams;
294
+ const isUtcSet = useUTC === true || useUTC === 'utc';
295
+ const xAxisScale = isUtcSet ? d3ScaleUtc() : d3ScaleTime();
105
296
  xAxisScale.domain([
106
297
  domainNRangeValues.dStartValue,
107
298
  domainNRangeValues.dEndValue
108
299
  ]).range([
109
300
  domainNRangeValues.rStartValue,
110
301
  domainNRangeValues.rEndValue
111
- ]);
302
+ ]).nice();
112
303
  let tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
304
+ let lowestFormatLevel = 100;
305
+ let highestFormatLevel = -1;
306
+ const locale = timeFormatLocale ? d3TimeFormatLocale(timeFormatLocale) : undefined;
307
+ xAxisScale.ticks().forEach((domainValue)=>{
308
+ const formatLevel = getDateFormatLevel(domainValue, isUtcSet);
309
+ if (formatLevel > highestFormatLevel) {
310
+ highestFormatLevel = formatLevel;
311
+ }
312
+ if (formatLevel < lowestFormatLevel) {
313
+ lowestFormatLevel = formatLevel;
314
+ }
315
+ });
316
+ const formatOptions = options !== null && options !== void 0 ? options : getMultiLevelDateTimeFormatOptions(lowestFormatLevel, highestFormatLevel);
317
+ const formatFn = getMultiLevelD3DateFormatter(lowestFormatLevel, highestFormatLevel, locale, isUtcSet);
113
318
  const tickFormat = (domainValue, _index)=>{
114
319
  if (customDateTimeFormatter) {
115
320
  return customDateTimeFormatter(domainValue);
116
321
  }
117
- if (culture && options) {
118
- return domainValue.toLocaleString(culture, options);
119
- }
120
322
  if (timeFormatLocale) {
121
- const locale = d3TimeFormatLocale(timeFormatLocale);
122
- return multiFormat(domainValue, locale, useUTC);
323
+ return formatFn(domainValue);
123
324
  }
124
325
  if (culture === undefined && tickParams.tickFormat) {
125
326
  if (useUTC) {
@@ -128,13 +329,12 @@ function multiFormat(date, locale, useUTC) {
128
329
  return d3TimeFormat(tickParams.tickFormat)(domainValue);
129
330
  }
130
331
  }
131
- return multiFormat(domainValue, undefined, useUTC);
332
+ return formatDateToLocaleString(domainValue, culture, useUTC ? true : false, false, formatOptions);
132
333
  };
133
- if (hideTickOverlap && typeof xAxisCount === 'undefined') {
134
- const longestLabelWidth = calculateLongestLabelWidth(xAxisScale.ticks().map(tickFormat), '.fui-cart__xAxis text') + 40;
135
- const [start, end] = xAxisScale.range();
136
- tickCount = Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth));
137
- }
334
+ const longestLabelWidth = calculateLongestLabelWidth(xAxisScale.ticks().map(tickFormat), '.fui-cart__xAxis text') + 40;
335
+ const [start, end] = xAxisScale.range();
336
+ const maxPossibleTickCount = Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth));
337
+ tickCount = Math.min(maxPossibleTickCount, xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : tickCount);
138
338
  const xAxis = d3AxisBottom(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat(tickFormat);
139
339
  tickParams.tickValues ? xAxis.tickValues(tickParams.tickValues) : '';
140
340
  if (xAxisElement) {
@@ -164,7 +364,7 @@ function multiFormat(date, locale, useUTC) {
164
364
  var _tickParams_tickValues;
165
365
  let tickValues = (_tickParams_tickValues = tickParams.tickValues) !== null && _tickParams_tickValues !== void 0 ? _tickParams_tickValues : dataset;
166
366
  const tickFormat = (domainValue, _index)=>{
167
- return convertToLocaleString(domainValue, culture);
367
+ return formatToLocaleString(domainValue, culture);
168
368
  };
169
369
  if (hideTickOverlap) {
170
370
  let nonOverlappingTickValues = [];
@@ -279,7 +479,7 @@ function handleFloatingPointPrecisionError(num) {
279
479
  case 6:
280
480
  return createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth);
281
481
  default:
282
- return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale, roundedTicks);
482
+ return createNumericYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale, roundedTicks);
283
483
  }
284
484
  }
285
485
  export function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth) {
@@ -300,11 +500,11 @@ export function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axi
300
500
  ]);
301
501
  const axis = isRtl ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
302
502
  const yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
303
- yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(d3Format('.2~s'));
503
+ yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(defaultYAxisTickFormatter);
304
504
  yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
305
505
  return yAxisScale;
306
506
  }
307
- export function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false) {
507
+ export function createNumericYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false) {
308
508
  const { yMinMaxValues = {
309
509
  startValue: 0,
310
510
  endValue: 0
@@ -330,7 +530,7 @@ export function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegr
330
530
  ]);
331
531
  const axis = !isRtl && useSecondaryYScale || isRtl && !useSecondaryYScale ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
332
532
  const yAxis = axis.tickPadding(tickPadding).tickValues(domainValues).tickSizeInner(-(containerWidth - margins.left - margins.right));
333
- yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(d3Format('.2~s'));
533
+ yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(defaultYAxisTickFormatter);
334
534
  yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
335
535
  axisData.yAxisDomainValues = domainValues;
336
536
  return yAxisScale;
@@ -1214,21 +1414,6 @@ export var CustomPoints;
1214
1414
  'aria-describedby': accessibleData.ariaDescribedBy
1215
1415
  };
1216
1416
  };
1217
- export const convertToLocaleString = (data, culture)=>{
1218
- if (data === undefined || data === null || Number.isNaN(data)) {
1219
- return data;
1220
- }
1221
- culture = culture || undefined;
1222
- if (typeof data === 'number') {
1223
- return data.toLocaleString(culture);
1224
- } else if (typeof data === 'string' && !isNaN(Number(data))) {
1225
- const num = Number(data);
1226
- return num.toLocaleString(culture);
1227
- } else if (data instanceof Date) {
1228
- return data.toLocaleDateString(culture);
1229
- }
1230
- return data;
1231
- };
1232
1417
  export function rotateXAxisLabels(rotateLabelProps) {
1233
1418
  const { node, xAxis } = rotateLabelProps;
1234
1419
  if (node === null || xAxis === null) {
@@ -1286,14 +1471,8 @@ export function wrapTextInsideDonut(selectorClass, maxWidth) {
1286
1471
  idx += 1;
1287
1472
  });
1288
1473
  }
1289
- export function formatValueWithSIPrefix(value) {
1290
- let specifier;
1291
- if (value < 1000) {
1292
- specifier = '.2~'; // upto 2 decimal places without insignificant trailing zeros
1293
- } else {
1294
- specifier = '.1'; // upto 1 decimal place
1295
- }
1296
- return d3FormatPrefix(specifier, value)(value);
1474
+ export function formatScientificLimitWidth(value) {
1475
+ return yAxisTickFormatterInternal(value, true);
1297
1476
  }
1298
1477
  const DEFAULT_BAR_WIDTH = 16;
1299
1478
  const MIN_BAR_WIDTH = 1;