@fluentui/react-charts 9.0.5 → 9.0.7

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 (81) hide show
  1. package/CHANGELOG.md +37 -7
  2. package/dist/index.d.ts +1 -1
  3. package/lib/components/CommonComponents/CartesianChart.js +4 -1
  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 +8 -3
  9. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  10. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +7 -13
  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/GaugeChart/useGaugeChartStyles.styles.js +18 -17
  19. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  20. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +3 -3
  21. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  22. package/lib/components/HeatMapChart/HeatMapChart.js +3 -2
  23. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  24. package/lib/components/HorizontalBarChart/HorizontalBarChart.js +8 -8
  25. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  26. package/lib/components/LineChart/LineChart.js +4 -4
  27. package/lib/components/LineChart/LineChart.js.map +1 -1
  28. package/lib/components/ScatterChart/ScatterChart.js +1 -1
  29. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  30. package/lib/components/Sparkline/useSparklineStyles.styles.js +2 -12
  31. package/lib/components/Sparkline/useSparklineStyles.styles.js.map +1 -1
  32. package/lib/components/VerticalBarChart/VerticalBarChart.js +2 -2
  33. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  34. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +2 -2
  35. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  36. package/lib/utilities/SVGTooltipText.js +5 -10
  37. package/lib/utilities/SVGTooltipText.js.map +1 -1
  38. package/lib/utilities/utilities.js +232 -53
  39. package/lib/utilities/utilities.js.map +1 -1
  40. package/lib-commonjs/components/CommonComponents/CartesianChart.js +4 -1
  41. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  42. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  43. package/lib-commonjs/components/CommonComponents/ChartPopover.js +10 -10
  44. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  45. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +7 -2
  46. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  47. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +6 -15
  48. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  49. package/lib-commonjs/components/DonutChart/Arc/Arc.js +1 -1
  50. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  51. package/lib-commonjs/components/DonutChart/DonutChart.js +2 -2
  52. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  53. package/lib-commonjs/components/GaugeChart/GaugeChart.js +8 -8
  54. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  55. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +18 -17
  56. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
  57. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +2 -2
  58. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  59. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -1
  60. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  61. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +7 -7
  62. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  63. package/lib-commonjs/components/LineChart/LineChart.js +4 -4
  64. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  65. package/lib-commonjs/components/ScatterChart/ScatterChart.js +1 -1
  66. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  67. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +3 -24
  68. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +1 -1
  69. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +1 -1
  70. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  71. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +1 -1
  72. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  73. package/lib-commonjs/utilities/SVGTooltipText.js +5 -10
  74. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  75. package/lib-commonjs/utilities/utilities.js +236 -61
  76. package/lib-commonjs/utilities/utilities.js.map +1 -1
  77. package/package.json +9 -9
  78. package/lib/utilities/locale-util.js +0 -15
  79. package/lib/utilities/locale-util.js.map +0 -1
  80. package/lib-commonjs/utilities/locale-util.js +0 -25
  81. package/lib-commonjs/utilities/locale-util.js.map +0 -1
@@ -42,15 +42,15 @@ _export(exports, {
42
42
  calloutData: function() {
43
43
  return calloutData;
44
44
  },
45
- convertToLocaleString: function() {
46
- return convertToLocaleString;
47
- },
48
45
  createDateXAxis: function() {
49
46
  return createDateXAxis;
50
47
  },
51
48
  createNumericXAxis: function() {
52
49
  return createNumericXAxis;
53
50
  },
51
+ createNumericYAxisForOtherCharts: function() {
52
+ return createNumericYAxisForOtherCharts;
53
+ },
54
54
  createStringXAxis: function() {
55
55
  return createStringXAxis;
56
56
  },
@@ -72,12 +72,12 @@ _export(exports, {
72
72
  createYAxisForHorizontalBarChartWithAxis: function() {
73
73
  return createYAxisForHorizontalBarChartWithAxis;
74
74
  },
75
- createYAxisForOtherCharts: function() {
76
- return createYAxisForOtherCharts;
77
- },
78
75
  createYAxisLabels: function() {
79
76
  return createYAxisLabels;
80
77
  },
78
+ defaultYAxisTickFormatter: function() {
79
+ return defaultYAxisTickFormatter;
80
+ },
81
81
  domainRageOfVerticalNumeric: function() {
82
82
  return domainRageOfVerticalNumeric;
83
83
  },
@@ -123,8 +123,8 @@ _export(exports, {
123
123
  formatDate: function() {
124
124
  return formatDate;
125
125
  },
126
- formatValueWithSIPrefix: function() {
127
- return formatValueWithSIPrefix;
126
+ formatScientificLimitWidth: function() {
127
+ return formatScientificLimitWidth;
128
128
  },
129
129
  getAccessibleDataObject: function() {
130
130
  return getAccessibleDataObject;
@@ -196,6 +196,7 @@ const _d3timeformat = require("d3-time-format");
196
196
  const _d3time = require("d3-time");
197
197
  const _d3shape = require("d3-shape");
198
198
  const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
199
+ const _chartutilities = require("@fluentui/chart-utilities");
199
200
  var ChartTypes;
200
201
  (function(ChartTypes) {
201
202
  ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
@@ -219,6 +220,26 @@ var YAxisType;
219
220
  YAxisType[YAxisType["DateAxis"] = 1] = "DateAxis";
220
221
  YAxisType[YAxisType["StringAxis"] = 2] = "StringAxis";
221
222
  })(YAxisType || (YAxisType = {}));
223
+ function yAxisTickFormatterInternal(value, limitWidth = false) {
224
+ // Use SI format prefix with 2 decimal places without insignificant trailing zeros
225
+ let formatter = (0, _d3format.formatPrefix)('.2~', value);
226
+ if (Math.abs(value) < 1) {
227
+ // Don't use SI notation for small numbers as it is less readable
228
+ formatter = (0, _d3format.format)('.2~g');
229
+ } else if (limitWidth && Math.abs(value) >= 1000) {
230
+ // If width is limited, use SI format prefix with 1 point precision
231
+ formatter = (0, _d3format.formatPrefix)('.1~', value);
232
+ }
233
+ const formattedValue = formatter(value);
234
+ // Replace 'G' with 'B' if the value is greater than 10^9 as it is a more common convention
235
+ if (Math.abs(value) >= 1e9) {
236
+ return formattedValue.replace('G', 'B');
237
+ }
238
+ return formattedValue;
239
+ }
240
+ function defaultYAxisTickFormatter(value) {
241
+ return yAxisTickFormatterInternal(value);
242
+ }
222
243
  function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
223
244
  const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap } = xAxisParams;
224
245
  const xAxisScale = (0, _d3scale.scaleLinear)().domain([
@@ -235,7 +256,7 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
235
256
  return (0, _d3format.format)(tickParams.tickFormat)(domainValue);
236
257
  }
237
258
  const xAxisValue = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
238
- return convertToLocaleString(xAxisValue, culture);
259
+ return (0, _chartutilities.formatToLocaleString)(xAxisValue, culture);
239
260
  };
240
261
  if (hideTickOverlap && typeof xAxisCount === 'undefined') {
241
262
  const longestLabelWidth = calculateLongestLabelWidth(xAxisScale.ticks().map(tickFormat), '.fui-cart__xAxis text') + 20;
@@ -259,16 +280,145 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
259
280
  tickValues
260
281
  };
261
282
  }
262
- function multiFormat(date, locale, useUTC) {
283
+ /**
284
+ * This function returns a multilevel formatter for a given date range.
285
+ * It determines the appropriate date format to accommodate each tick value.
286
+ * The goal is to represent the date label in the smallest possible format without loss of information.
287
+ * The challenge here is to adhere to locale specific formats while ensuring the complete label is shown.
288
+ * There is an exhaustive map of all possible date/time units and their respective formats.
289
+ * Based on the range of formatting granularity levels, a format spanning the range is returned.
290
+ * @param startLevel - The starting level of the date format.
291
+ * @param endLevel - The ending level of the date format.
292
+ * @param locale - The locale object for formatting.
293
+ * @param useUTC
294
+ * @returns
295
+ */ function getMultiLevelD3DateFormatter(startLevel, endLevel, locale, useUTC) {
263
296
  const timeFormat = locale ? useUTC ? locale.utcFormat : locale.format : useUTC ? _d3timeformat.utcFormat : _d3timeformat.timeFormat;
264
- const formatMillisecond = timeFormat('.%L');
265
- const formatSecond = timeFormat(':%S');
266
- const formatMinute = timeFormat('%I:%M');
267
- const formatHour = timeFormat('%I %p');
268
- const formatDay = timeFormat('%a %d');
269
- const formatWeek = timeFormat('%b %d');
270
- const formatMonth = timeFormat('%B');
271
- const formatYear = timeFormat('%Y');
297
+ // Refer to https://d3js.org/d3-time-format#locale_format to see explanation about each format specifier
298
+ const DEFAULT = '%c';
299
+ const MS = '.%L';
300
+ const MS_S = ':%S.%L';
301
+ const MS_S_MIN = '%M:%S.%L';
302
+ const MS_S_MIN_H = '%-I:%M:%S.%L %p';
303
+ const MS_S_MIN_H_D = '%a %d, %X';
304
+ const MS_S_MIN_H_D_W = '%b %d, %X';
305
+ const MS_S_MIN_H_D_W_M = MS_S_MIN_H_D_W;
306
+ const MS_S_MIN_H_D_W_M_Y = DEFAULT;
307
+ const S = ':%S';
308
+ const S_MIN = '%-I:%M:%S';
309
+ const S_MIN_H = '%X';
310
+ const S_MIN_H_D = MS_S_MIN_H_D;
311
+ const S_MIN_H_D_W = MS_S_MIN_H_D_W;
312
+ const S_MIN_H_D_W_M = MS_S_MIN_H_D_W_M;
313
+ const S_MIN_H_D_W_M_Y = DEFAULT;
314
+ const MIN = '%-I:%M %p';
315
+ const MIN_H = MIN;
316
+ const MIN_H_D = '%a %d, %-I:%M %p';
317
+ const MIN_H_D_W = '%b %d, %-I:%M %p';
318
+ const MIN_H_D_W_M = MIN_H_D_W;
319
+ const MIN_H_D_W_M_Y = '%x, %-I:%M %p';
320
+ const H = '%-I %p';
321
+ const H_D = '%a %d, %-I %p';
322
+ const H_D_W = '%b %d, %-I %p';
323
+ const H_D_W_M = H_D_W;
324
+ const H_D_W_M_Y = '%x, %-I %p';
325
+ const D = '%a %d';
326
+ const D_W = '%b %d';
327
+ const D_W_M = D_W;
328
+ const D_W_M_Y = '%x';
329
+ const W = D_W;
330
+ const W_M = W;
331
+ const W_M_Y = D_W_M_Y;
332
+ const M = '%B';
333
+ const M_Y = '%b %Y';
334
+ const Y = '%Y';
335
+ const MULTI_LEVEL_DATE_TIME_FORMATS = [
336
+ // ms, s, min, h, d, w, m, y
337
+ [
338
+ MS,
339
+ MS_S,
340
+ MS_S_MIN,
341
+ MS_S_MIN_H,
342
+ MS_S_MIN_H_D,
343
+ MS_S_MIN_H_D_W,
344
+ MS_S_MIN_H_D_W_M,
345
+ MS_S_MIN_H_D_W_M_Y
346
+ ],
347
+ [
348
+ DEFAULT,
349
+ S,
350
+ S_MIN,
351
+ S_MIN_H,
352
+ S_MIN_H_D,
353
+ S_MIN_H_D_W,
354
+ S_MIN_H_D_W_M,
355
+ S_MIN_H_D_W_M_Y
356
+ ],
357
+ [
358
+ DEFAULT,
359
+ DEFAULT,
360
+ MIN,
361
+ MIN_H,
362
+ MIN_H_D,
363
+ MIN_H_D_W,
364
+ MIN_H_D_W_M,
365
+ MIN_H_D_W_M_Y
366
+ ],
367
+ [
368
+ DEFAULT,
369
+ DEFAULT,
370
+ DEFAULT,
371
+ H,
372
+ H_D,
373
+ H_D_W,
374
+ H_D_W_M,
375
+ H_D_W_M_Y
376
+ ],
377
+ [
378
+ DEFAULT,
379
+ DEFAULT,
380
+ DEFAULT,
381
+ DEFAULT,
382
+ D,
383
+ D_W,
384
+ D_W_M,
385
+ D_W_M_Y
386
+ ],
387
+ [
388
+ DEFAULT,
389
+ DEFAULT,
390
+ DEFAULT,
391
+ DEFAULT,
392
+ DEFAULT,
393
+ W,
394
+ W_M,
395
+ W_M_Y
396
+ ],
397
+ [
398
+ DEFAULT,
399
+ DEFAULT,
400
+ DEFAULT,
401
+ DEFAULT,
402
+ DEFAULT,
403
+ DEFAULT,
404
+ M,
405
+ M_Y
406
+ ],
407
+ [
408
+ DEFAULT,
409
+ DEFAULT,
410
+ DEFAULT,
411
+ DEFAULT,
412
+ DEFAULT,
413
+ DEFAULT,
414
+ DEFAULT,
415
+ Y
416
+ ]
417
+ ];
418
+ const formatter = timeFormat(MULTI_LEVEL_DATE_TIME_FORMATS[startLevel][endLevel]);
419
+ return formatter;
420
+ }
421
+ function getDateFormatLevel(date, useUTC) {
272
422
  const timeSecond = useUTC ? _d3time.utcSecond : _d3time.timeSecond;
273
423
  const timeMinute = useUTC ? _d3time.utcMinute : _d3time.timeMinute;
274
424
  const timeHour = useUTC ? _d3time.utcHour : _d3time.timeHour;
@@ -276,29 +426,76 @@ function multiFormat(date, locale, useUTC) {
276
426
  const timeMonth = useUTC ? _d3time.utcMonth : _d3time.timeMonth;
277
427
  const timeWeek = useUTC ? _d3time.utcWeek : _d3time.timeWeek;
278
428
  const timeYear = useUTC ? _d3time.utcYear : _d3time.timeYear;
279
- 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);
429
+ const formats = [
430
+ {
431
+ formatLevel: 0,
432
+ condition: (d)=>timeSecond(d) < d
433
+ },
434
+ {
435
+ formatLevel: 1,
436
+ condition: (d)=>timeMinute(d) < d
437
+ },
438
+ {
439
+ formatLevel: 2,
440
+ condition: (d)=>timeHour(d) < d
441
+ },
442
+ {
443
+ formatLevel: 3,
444
+ condition: (d)=>timeDay(d) < d
445
+ },
446
+ {
447
+ formatLevel: 4,
448
+ condition: (d)=>timeMonth(d) < d && timeWeek(d) < d
449
+ },
450
+ {
451
+ formatLevel: 5,
452
+ condition: (d)=>timeMonth(d) < d
453
+ },
454
+ {
455
+ formatLevel: 6,
456
+ condition: (d)=>timeYear(d) < d
457
+ },
458
+ {
459
+ formatLevel: 7,
460
+ condition: ()=>true
461
+ }
462
+ ];
463
+ const matchedFormat = formats.find(({ condition })=>condition(date));
464
+ var _matchedFormat_formatLevel;
465
+ return (_matchedFormat_formatLevel = matchedFormat === null || matchedFormat === void 0 ? void 0 : matchedFormat.formatLevel) !== null && _matchedFormat_formatLevel !== void 0 ? _matchedFormat_formatLevel : 7;
280
466
  }
281
467
  function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
282
- const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, hideTickOverlap } = xAxisParams;
283
- const xAxisScale = useUTC ? (0, _d3scale.scaleUtc)() : (0, _d3scale.scaleTime)();
468
+ const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount } = xAxisParams;
469
+ const isUtcSet = useUTC === true || useUTC === 'utc';
470
+ const xAxisScale = isUtcSet ? (0, _d3scale.scaleUtc)() : (0, _d3scale.scaleTime)();
284
471
  xAxisScale.domain([
285
472
  domainNRangeValues.dStartValue,
286
473
  domainNRangeValues.dEndValue
287
474
  ]).range([
288
475
  domainNRangeValues.rStartValue,
289
476
  domainNRangeValues.rEndValue
290
- ]);
477
+ ]).nice();
291
478
  let tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
479
+ let lowestFormatLevel = 100;
480
+ let highestFormatLevel = -1;
481
+ const locale = timeFormatLocale ? (0, _d3timeformat.timeFormatLocale)(timeFormatLocale) : undefined;
482
+ xAxisScale.ticks().forEach((domainValue)=>{
483
+ const formatLevel = getDateFormatLevel(domainValue, isUtcSet);
484
+ if (formatLevel > highestFormatLevel) {
485
+ highestFormatLevel = formatLevel;
486
+ }
487
+ if (formatLevel < lowestFormatLevel) {
488
+ lowestFormatLevel = formatLevel;
489
+ }
490
+ });
491
+ const formatOptions = options !== null && options !== void 0 ? options : (0, _chartutilities.getMultiLevelDateTimeFormatOptions)(lowestFormatLevel, highestFormatLevel);
492
+ const formatFn = getMultiLevelD3DateFormatter(lowestFormatLevel, highestFormatLevel, locale, isUtcSet);
292
493
  const tickFormat = (domainValue, _index)=>{
293
494
  if (customDateTimeFormatter) {
294
495
  return customDateTimeFormatter(domainValue);
295
496
  }
296
- if (culture && options) {
297
- return domainValue.toLocaleString(culture, options);
298
- }
299
497
  if (timeFormatLocale) {
300
- const locale = (0, _d3timeformat.timeFormatLocale)(timeFormatLocale);
301
- return multiFormat(domainValue, locale, useUTC);
498
+ return formatFn(domainValue);
302
499
  }
303
500
  if (culture === undefined && tickParams.tickFormat) {
304
501
  if (useUTC) {
@@ -307,13 +504,12 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
307
504
  return (0, _d3timeformat.timeFormat)(tickParams.tickFormat)(domainValue);
308
505
  }
309
506
  }
310
- return multiFormat(domainValue, undefined, useUTC);
507
+ return (0, _chartutilities.formatDateToLocaleString)(domainValue, culture, useUTC ? true : false, false, formatOptions);
311
508
  };
312
- if (hideTickOverlap && typeof xAxisCount === 'undefined') {
313
- const longestLabelWidth = calculateLongestLabelWidth(xAxisScale.ticks().map(tickFormat), '.fui-cart__xAxis text') + 40;
314
- const [start, end] = xAxisScale.range();
315
- tickCount = Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth));
316
- }
509
+ const longestLabelWidth = calculateLongestLabelWidth(xAxisScale.ticks().map(tickFormat), '.fui-cart__xAxis text') + 40;
510
+ const [start, end] = xAxisScale.range();
511
+ const maxPossibleTickCount = Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth));
512
+ tickCount = Math.min(maxPossibleTickCount, xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : tickCount);
317
513
  const xAxis = (0, _d3axis.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat(tickFormat);
318
514
  tickParams.tickValues ? xAxis.tickValues(tickParams.tickValues) : '';
319
515
  if (xAxisElement) {
@@ -335,7 +531,7 @@ function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
335
531
  var _tickParams_tickValues;
336
532
  let tickValues = (_tickParams_tickValues = tickParams.tickValues) !== null && _tickParams_tickValues !== void 0 ? _tickParams_tickValues : dataset;
337
533
  const tickFormat = (domainValue, _index)=>{
338
- return convertToLocaleString(domainValue, culture);
534
+ return (0, _chartutilities.formatToLocaleString)(domainValue, culture);
339
535
  };
340
536
  if (hideTickOverlap) {
341
537
  let nonOverlappingTickValues = [];
@@ -437,7 +633,7 @@ function createYAxis(yAxisParams, isRtl, axisData, chartType, barWidth, isIntegr
437
633
  case 6:
438
634
  return createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth);
439
635
  default:
440
- return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale, roundedTicks);
636
+ return createNumericYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale, roundedTicks);
441
637
  }
442
638
  }
443
639
  function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth) {
@@ -458,11 +654,11 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData,
458
654
  ]);
459
655
  const axis = isRtl ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
460
656
  const yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
461
- yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat((0, _d3format.format)('.2~s'));
657
+ yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(defaultYAxisTickFormatter);
462
658
  yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
463
659
  return yAxisScale;
464
660
  }
465
- function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false) {
661
+ function createNumericYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false) {
466
662
  const { yMinMaxValues = {
467
663
  startValue: 0,
468
664
  endValue: 0
@@ -488,7 +684,7 @@ function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDatas
488
684
  ]);
489
685
  const axis = !isRtl && useSecondaryYScale || isRtl && !useSecondaryYScale ? (0, _d3axis.axisRight)(yAxisScale) : (0, _d3axis.axisLeft)(yAxisScale);
490
686
  const yAxis = axis.tickPadding(tickPadding).tickValues(domainValues).tickSizeInner(-(containerWidth - margins.left - margins.right));
491
- yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat((0, _d3format.format)('.2~s'));
687
+ yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(defaultYAxisTickFormatter);
492
688
  yAxisElement ? (0, _d3selection.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
493
689
  axisData.yAxisDomainValues = domainValues;
494
690
  return yAxisScale;
@@ -1195,21 +1391,6 @@ const getAccessibleDataObject = (accessibleData, role = 'text', isDataFocusable
1195
1391
  'aria-describedby': accessibleData.ariaDescribedBy
1196
1392
  };
1197
1393
  };
1198
- const convertToLocaleString = (data, culture)=>{
1199
- if (data === undefined || data === null || Number.isNaN(data)) {
1200
- return data;
1201
- }
1202
- culture = culture || undefined;
1203
- if (typeof data === 'number') {
1204
- return data.toLocaleString(culture);
1205
- } else if (typeof data === 'string' && !isNaN(Number(data))) {
1206
- const num = Number(data);
1207
- return num.toLocaleString(culture);
1208
- } else if (data instanceof Date) {
1209
- return data.toLocaleDateString(culture);
1210
- }
1211
- return data;
1212
- };
1213
1394
  function rotateXAxisLabels(rotateLabelProps) {
1214
1395
  const { node, xAxis } = rotateLabelProps;
1215
1396
  if (node === null || xAxis === null) {
@@ -1267,14 +1448,8 @@ function wrapTextInsideDonut(selectorClass, maxWidth) {
1267
1448
  idx += 1;
1268
1449
  });
1269
1450
  }
1270
- function formatValueWithSIPrefix(value) {
1271
- let specifier;
1272
- if (value < 1000) {
1273
- specifier = '.2~'; // upto 2 decimal places without insignificant trailing zeros
1274
- } else {
1275
- specifier = '.1'; // upto 1 decimal place
1276
- }
1277
- return (0, _d3format.formatPrefix)(specifier, value)(value);
1451
+ function formatScientificLimitWidth(value) {
1452
+ return yAxisTickFormatterInternal(value, true);
1278
1453
  }
1279
1454
  const DEFAULT_BAR_WIDTH = 16;
1280
1455
  const MIN_BAR_WIDTH = 1;