@fluentui/react-charting 5.24.39 → 5.25.0
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.
- package/CHANGELOG.json +60 -1
- package/CHANGELOG.md +21 -2
- package/dist/react-charting.d.ts +127 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +74 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +343 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +111 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +2 -0
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.base.js +38 -46
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js +9 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +17 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/index.d.ts +2 -0
- package/lib/components/CommonComponents/index.js +2 -0
- package/lib/components/CommonComponents/index.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types/IChartAnnotation.d.ts +99 -0
- package/lib/types/IChartAnnotation.js +2 -0
- package/lib/types/IChartAnnotation.js.map +1 -0
- package/lib/types/IDataPoint.d.ts +4 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/index.js.map +1 -1
- package/lib/utilities/image-export-utils.js +55 -0
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/utilities.js +72 -20
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js +344 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +119 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +5 -0
- package/lib-amd/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +38 -47
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js +9 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +17 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/CommonComponents/index.d.ts +2 -0
- package/lib-amd/components/CommonComponents/index.js +3 -1
- package/lib-amd/components/CommonComponents/index.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/index.d.ts +1 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IChartAnnotation.d.ts +99 -0
- package/lib-amd/types/IChartAnnotation.js +5 -0
- package/lib-amd/types/IChartAnnotation.js.map +1 -0
- package/lib-amd/types/IDataPoint.d.ts +4 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/types/index.d.ts +1 -0
- package/lib-amd/types/index.js +2 -1
- package/lib-amd/types/index.js.map +1 -1
- package/lib-amd/utilities/image-export-utils.js +55 -0
- package/lib-amd/utilities/image-export-utils.js.map +1 -1
- package/lib-amd/utilities/utilities.js +72 -20
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.d.ts +3 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +346 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.d.ts +28 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js +118 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.d.ts +52 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +3 -0
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +38 -46
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +9 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +17 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/index.d.ts +2 -0
- package/lib-commonjs/components/CommonComponents/index.js +2 -0
- package/lib-commonjs/components/CommonComponents/index.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +641 -76
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IChartAnnotation.d.ts +99 -0
- package/lib-commonjs/types/IChartAnnotation.js +3 -0
- package/lib-commonjs/types/IChartAnnotation.js.map +1 -0
- package/lib-commonjs/types/IDataPoint.d.ts +4 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/types/index.d.ts +1 -0
- package/lib-commonjs/types/index.js +1 -0
- package/lib-commonjs/types/index.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js +55 -0
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +72 -20
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +9 -9
- package/src/components/CommonComponents/Annotations/ChartAnnotationLayer.types.ts +58 -0
- package/src/components/CommonComponents/CartesianChart.types.ts +21 -0
|
@@ -72,13 +72,16 @@ export function defaultYAxisTickFormatter(value) {
|
|
|
72
72
|
* @param {IXAxisParams} xAxisParams
|
|
73
73
|
*/
|
|
74
74
|
export function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleType) {
|
|
75
|
-
var domainNRangeValues = xAxisParams.domainNRangeValues, _a = xAxisParams.showRoundOffXTickValues, showRoundOffXTickValues = _a === void 0 ? true : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, _c = xAxisParams.tickPadding, tickPadding = _c === void 0 ? 10 : _c, xAxisCount = xAxisParams.xAxisCount, xAxisElement = xAxisParams.xAxisElement, hideTickOverlap = xAxisParams.hideTickOverlap, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickStep = xAxisParams.tickStep, tick0 = xAxisParams.tick0;
|
|
75
|
+
var domainNRangeValues = xAxisParams.domainNRangeValues, _a = xAxisParams.showRoundOffXTickValues, showRoundOffXTickValues = _a === void 0 ? true : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, _c = xAxisParams.tickPadding, tickPadding = _c === void 0 ? 10 : _c, xAxisCount = xAxisParams.xAxisCount, xAxisElement = xAxisParams.xAxisElement, hideTickOverlap = xAxisParams.hideTickOverlap, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickStep = xAxisParams.tickStep, tick0 = xAxisParams.tick0, tickText = xAxisParams.tickText;
|
|
76
76
|
var xAxisScale = createNumericScale(scaleType)
|
|
77
77
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
78
78
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
|
|
79
79
|
showRoundOffXTickValues && xAxisScale.nice();
|
|
80
80
|
var tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
|
|
81
81
|
var tickFormat = function (domainValue, _index, defaultFormat) {
|
|
82
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
83
|
+
return tickText[_index];
|
|
84
|
+
}
|
|
82
85
|
if (tickParams.tickFormat) {
|
|
83
86
|
return d3Format(tickParams.tickFormat)(domainValue);
|
|
84
87
|
}
|
|
@@ -217,7 +220,7 @@ function isPowerOf10(num) {
|
|
|
217
220
|
* @param {ITickParams} tickParams
|
|
218
221
|
*/
|
|
219
222
|
export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
|
|
220
|
-
var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _a = xAxisParams.tickPadding, tickPadding = _a === void 0 ? 6 : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, xAxisCount = xAxisParams.xAxisCount, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickStep = xAxisParams.tickStep, tick0 = xAxisParams.tick0;
|
|
223
|
+
var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _a = xAxisParams.tickPadding, tickPadding = _a === void 0 ? 6 : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, xAxisCount = xAxisParams.xAxisCount, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickStep = xAxisParams.tickStep, tick0 = xAxisParams.tick0, tickText = xAxisParams.tickText;
|
|
221
224
|
var xAxisScale = useUTC ? d3ScaleUtc() : d3ScaleTime();
|
|
222
225
|
xAxisScale
|
|
223
226
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
@@ -239,6 +242,9 @@ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeF
|
|
|
239
242
|
var formatOptions = options !== null && options !== void 0 ? options : getMultiLevelDateTimeFormatOptions(lowestFormatLevel, highestFormatLevel);
|
|
240
243
|
var formatFn = getMultiLevelD3DateFormatter(lowestFormatLevel, highestFormatLevel, locale, useUTC);
|
|
241
244
|
var tickFormat = function (domainValue, _index) {
|
|
245
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
246
|
+
return tickText[_index];
|
|
247
|
+
}
|
|
242
248
|
if (customDateTimeFormatter) {
|
|
243
249
|
return customDateTimeFormatter(domainValue);
|
|
244
250
|
}
|
|
@@ -294,13 +300,19 @@ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeF
|
|
|
294
300
|
*/
|
|
295
301
|
export function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
|
|
296
302
|
var _a;
|
|
297
|
-
var domainNRangeValues = xAxisParams.domainNRangeValues, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, _c = xAxisParams.tickPadding, tickPadding = _c === void 0 ? 10 : _c, _d = xAxisParams.xAxisPadding, xAxisPadding = _d === void 0 ? 0.1 : _d, xAxisInnerPadding = xAxisParams.xAxisInnerPadding, xAxisOuterPadding = xAxisParams.xAxisOuterPadding, containerWidth = xAxisParams.containerWidth, hideTickOverlap = xAxisParams.hideTickOverlap, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth;
|
|
303
|
+
var domainNRangeValues = xAxisParams.domainNRangeValues, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, _c = xAxisParams.tickPadding, tickPadding = _c === void 0 ? 10 : _c, _d = xAxisParams.xAxisPadding, xAxisPadding = _d === void 0 ? 0.1 : _d, xAxisInnerPadding = xAxisParams.xAxisInnerPadding, xAxisOuterPadding = xAxisParams.xAxisOuterPadding, containerWidth = xAxisParams.containerWidth, hideTickOverlap = xAxisParams.hideTickOverlap, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickText = xAxisParams.tickText;
|
|
298
304
|
var xAxisScale = d3ScaleBand()
|
|
299
305
|
.domain(dataset)
|
|
300
306
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue])
|
|
301
307
|
.paddingInner(typeof xAxisInnerPadding !== 'undefined' ? xAxisInnerPadding : xAxisPadding)
|
|
302
308
|
.paddingOuter(typeof xAxisOuterPadding !== 'undefined' ? xAxisOuterPadding : xAxisPadding);
|
|
303
309
|
var tickValues = (_a = tickParams.tickValues) !== null && _a !== void 0 ? _a : dataset;
|
|
310
|
+
var tickFormat = function (domainValue, _index) {
|
|
311
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
312
|
+
return tickText[_index];
|
|
313
|
+
}
|
|
314
|
+
return domainValue;
|
|
315
|
+
};
|
|
304
316
|
if (hideTickOverlap) {
|
|
305
317
|
var nonOverlappingTickValues = [];
|
|
306
318
|
// Here, we need the width of each individual label to detect overlaps,
|
|
@@ -329,7 +341,11 @@ export function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
|
|
|
329
341
|
nonOverlappingTickValues = nonOverlappingTickValues.reverse();
|
|
330
342
|
tickValues = nonOverlappingTickValues;
|
|
331
343
|
}
|
|
332
|
-
var xAxis = d3AxisBottom(xAxisScale)
|
|
344
|
+
var xAxis = d3AxisBottom(xAxisScale)
|
|
345
|
+
.tickSize(xAxistickSize)
|
|
346
|
+
.tickPadding(tickPadding)
|
|
347
|
+
.tickValues(tickValues)
|
|
348
|
+
.tickFormat(tickFormat);
|
|
333
349
|
if (xAxisParams.xAxisElement) {
|
|
334
350
|
d3Select(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
335
351
|
}
|
|
@@ -397,7 +413,7 @@ export function prepareDatapoints(maxVal, minVal, splitInto, isIntegralDataset,
|
|
|
397
413
|
return dataPointsArray;
|
|
398
414
|
}
|
|
399
415
|
export function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
400
|
-
var _a = yAxisParams.yMinMaxValues, yMinMaxValues = _a === void 0 ? { startValue: 0, endValue: 0 } : _a, _b = yAxisParams.yAxisElement, yAxisElement = _b === void 0 ? null : _b, _c = yAxisParams.yMaxValue, yMaxValue = _c === void 0 ? 0 : _c, _d = yAxisParams.yMinValue, yMinValue = _d === void 0 ? 0 : _d, containerHeight = yAxisParams.containerHeight, margins = yAxisParams.margins, _e = yAxisParams.tickPadding, tickPadding = _e === void 0 ? 12 : _e, _f = yAxisParams.maxOfYVal, maxOfYVal = _f === void 0 ? 0 : _f, yAxisTickFormat = yAxisParams.yAxisTickFormat, _g = yAxisParams.yAxisTickCount, yAxisTickCount = _g === void 0 ? 4 : _g, tickValues = yAxisParams.tickValues, tickStep = yAxisParams.tickStep, tick0 = yAxisParams.tick0;
|
|
416
|
+
var _a = yAxisParams.yMinMaxValues, yMinMaxValues = _a === void 0 ? { startValue: 0, endValue: 0 } : _a, _b = yAxisParams.yAxisElement, yAxisElement = _b === void 0 ? null : _b, _c = yAxisParams.yMaxValue, yMaxValue = _c === void 0 ? 0 : _c, _d = yAxisParams.yMinValue, yMinValue = _d === void 0 ? 0 : _d, containerHeight = yAxisParams.containerHeight, margins = yAxisParams.margins, _e = yAxisParams.tickPadding, tickPadding = _e === void 0 ? 12 : _e, _f = yAxisParams.maxOfYVal, maxOfYVal = _f === void 0 ? 0 : _f, yAxisTickFormat = yAxisParams.yAxisTickFormat, _g = yAxisParams.yAxisTickCount, yAxisTickCount = _g === void 0 ? 4 : _g, tickValues = yAxisParams.tickValues, tickStep = yAxisParams.tickStep, tick0 = yAxisParams.tick0, tickText = yAxisParams.tickText;
|
|
401
417
|
// maxOfYVal coming from horizontal bar chart with axis (Calculation done at base file)
|
|
402
418
|
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
403
419
|
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -407,7 +423,20 @@ export function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
|
407
423
|
.range([containerHeight - margins.bottom, margins.top]);
|
|
408
424
|
var axis = isRtl ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
|
|
409
425
|
var yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
410
|
-
|
|
426
|
+
var tickFormat = function (domainValue, index) {
|
|
427
|
+
if (tickValues && tickText && typeof tickText[index] !== 'undefined') {
|
|
428
|
+
return tickText[index];
|
|
429
|
+
}
|
|
430
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
431
|
+
return yAxisTickFormat(domainValue, index);
|
|
432
|
+
}
|
|
433
|
+
if (typeof yAxisTickFormat === 'string') {
|
|
434
|
+
return d3Format(yAxisTickFormat)(domainValue);
|
|
435
|
+
}
|
|
436
|
+
var value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
437
|
+
return defaultYAxisTickFormatter(value);
|
|
438
|
+
};
|
|
439
|
+
yAxis.tickFormat(tickFormat);
|
|
411
440
|
var customTickValues;
|
|
412
441
|
if (tickValues) {
|
|
413
442
|
customTickValues = tickValues;
|
|
@@ -425,7 +454,7 @@ export function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDatas
|
|
|
425
454
|
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
426
455
|
if (supportNegativeData === void 0) { supportNegativeData = false; }
|
|
427
456
|
if (roundedTicks === void 0) { roundedTicks = false; }
|
|
428
|
-
var _a = yAxisParams.yMinMaxValues, yMinMaxValues = _a === void 0 ? { startValue: 0, endValue: 0 } : _a, _b = yAxisParams.yAxisElement, yAxisElement = _b === void 0 ? null : _b, _c = yAxisParams.yMaxValue, yMaxValue = _c === void 0 ? 0 : _c, _d = yAxisParams.yMinValue, yMinValue = _d === void 0 ? 0 : _d, containerHeight = yAxisParams.containerHeight, containerWidth = yAxisParams.containerWidth, margins = yAxisParams.margins, _e = yAxisParams.tickPadding, tickPadding = _e === void 0 ? 12 : _e, _f = yAxisParams.maxOfYVal, maxOfYVal = _f === void 0 ? 0 : _f, yAxisTickFormat = yAxisParams.yAxisTickFormat, _g = yAxisParams.yAxisTickCount, yAxisTickCount = _g === void 0 ? 4 : _g, eventAnnotationProps = yAxisParams.eventAnnotationProps, eventLabelHeight = yAxisParams.eventLabelHeight, tickValues = yAxisParams.tickValues, tickStep = yAxisParams.tickStep, tick0 = yAxisParams.tick0;
|
|
457
|
+
var _a = yAxisParams.yMinMaxValues, yMinMaxValues = _a === void 0 ? { startValue: 0, endValue: 0 } : _a, _b = yAxisParams.yAxisElement, yAxisElement = _b === void 0 ? null : _b, _c = yAxisParams.yMaxValue, yMaxValue = _c === void 0 ? 0 : _c, _d = yAxisParams.yMinValue, yMinValue = _d === void 0 ? 0 : _d, containerHeight = yAxisParams.containerHeight, containerWidth = yAxisParams.containerWidth, margins = yAxisParams.margins, _e = yAxisParams.tickPadding, tickPadding = _e === void 0 ? 12 : _e, _f = yAxisParams.maxOfYVal, maxOfYVal = _f === void 0 ? 0 : _f, yAxisTickFormat = yAxisParams.yAxisTickFormat, _g = yAxisParams.yAxisTickCount, yAxisTickCount = _g === void 0 ? 4 : _g, eventAnnotationProps = yAxisParams.eventAnnotationProps, eventLabelHeight = yAxisParams.eventLabelHeight, tickValues = yAxisParams.tickValues, tickStep = yAxisParams.tickStep, tick0 = yAxisParams.tick0, tickText = yAxisParams.tickText;
|
|
429
458
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
430
459
|
var tempVal = maxOfYVal || yMinMaxValues.endValue || 0;
|
|
431
460
|
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -473,12 +502,19 @@ export function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDatas
|
|
|
473
502
|
}
|
|
474
503
|
}
|
|
475
504
|
var tickFormat = function (domainValue, index, defaultFormat) {
|
|
505
|
+
if (tickValues && tickText && typeof tickText[index] !== 'undefined') {
|
|
506
|
+
return tickText[index];
|
|
507
|
+
}
|
|
508
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
509
|
+
return yAxisTickFormat(domainValue, index);
|
|
510
|
+
}
|
|
511
|
+
if (typeof yAxisTickFormat === 'string') {
|
|
512
|
+
return d3Format(yAxisTickFormat)(domainValue);
|
|
513
|
+
}
|
|
476
514
|
var value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
477
515
|
return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(value)) === '' ? '' : defaultYAxisTickFormatter(value);
|
|
478
516
|
};
|
|
479
|
-
|
|
480
|
-
? yAxis.tickFormat(yAxisTickFormat)
|
|
481
|
-
: yAxis.tickFormat(function (v, i) { return tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)); });
|
|
517
|
+
yAxis.tickFormat(function (v, i) { return tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)); });
|
|
482
518
|
yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
483
519
|
return yAxisScale;
|
|
484
520
|
}
|
|
@@ -489,7 +525,8 @@ export function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDatas
|
|
|
489
525
|
* @param isRtl
|
|
490
526
|
*/
|
|
491
527
|
export var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth) {
|
|
492
|
-
var
|
|
528
|
+
var _a;
|
|
529
|
+
var containerHeight = yAxisParams.containerHeight, _b = yAxisParams.tickPadding, tickPadding = _b === void 0 ? 12 : _b, margins = yAxisParams.margins, yAxisTickFormat = yAxisParams.yAxisTickFormat, yAxisElement = yAxisParams.yAxisElement, yAxisPadding = yAxisParams.yAxisPadding, tickValues = yAxisParams.tickValues, tickText = yAxisParams.tickText;
|
|
493
530
|
var yAxisPaddingValue = yAxisPadding !== null && yAxisPadding !== void 0 ? yAxisPadding : 0.5;
|
|
494
531
|
yAxisPaddingValue = yAxisPaddingValue === 1 ? 0.99 : yAxisPaddingValue;
|
|
495
532
|
var yAxisScale = d3ScaleBand()
|
|
@@ -497,10 +534,17 @@ export var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParam
|
|
|
497
534
|
.range([containerHeight - margins.bottom, margins.top])
|
|
498
535
|
.padding(yAxisPaddingValue);
|
|
499
536
|
var axis = isRtl ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
|
|
500
|
-
var
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
537
|
+
var customTickValues = (_a = tickValues) !== null && _a !== void 0 ? _a : dataPoints;
|
|
538
|
+
var tickFormat = function (domainValue, _index) {
|
|
539
|
+
if (tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
540
|
+
return tickText[_index];
|
|
541
|
+
}
|
|
542
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
543
|
+
return yAxisTickFormat(domainValue, _index);
|
|
544
|
+
}
|
|
545
|
+
return domainValue;
|
|
546
|
+
};
|
|
547
|
+
var yAxis = axis.tickPadding(tickPadding).tickValues(customTickValues).tickFormat(tickFormat);
|
|
504
548
|
yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
505
549
|
return yAxisScale;
|
|
506
550
|
};
|
|
@@ -511,7 +555,8 @@ export var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParam
|
|
|
511
555
|
* @param isRtl
|
|
512
556
|
*/
|
|
513
557
|
export var createStringYAxis = function (yAxisParams, dataPoints, isRtl, barWidth, chartType) {
|
|
514
|
-
var
|
|
558
|
+
var _a;
|
|
559
|
+
var containerHeight = yAxisParams.containerHeight, _b = yAxisParams.tickPadding, tickPadding = _b === void 0 ? 12 : _b, margins = yAxisParams.margins, yAxisTickFormat = yAxisParams.yAxisTickFormat, yAxisElement = yAxisParams.yAxisElement, _c = yAxisParams.yAxisPadding, yAxisPadding = _c === void 0 ? 0 : _c, containerWidth = yAxisParams.containerWidth, tickValues = yAxisParams.tickValues, tickText = yAxisParams.tickText;
|
|
515
560
|
var yAxisScale = d3ScaleBand()
|
|
516
561
|
.domain(dataPoints)
|
|
517
562
|
.range([containerHeight - margins.bottom, margins.top])
|
|
@@ -520,13 +565,20 @@ export var createStringYAxis = function (yAxisParams, dataPoints, isRtl, barWidt
|
|
|
520
565
|
yAxisScale.paddingInner(1).paddingOuter(0);
|
|
521
566
|
}
|
|
522
567
|
var axis = isRtl ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
|
|
523
|
-
var
|
|
568
|
+
var customTickValues = (_a = tickValues) !== null && _a !== void 0 ? _a : dataPoints;
|
|
569
|
+
var tickFormat = function (domainValue, _index) {
|
|
570
|
+
if (tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
571
|
+
return tickText[_index];
|
|
572
|
+
}
|
|
573
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
574
|
+
return yAxisTickFormat(domainValue, _index);
|
|
575
|
+
}
|
|
576
|
+
return domainValue;
|
|
577
|
+
};
|
|
578
|
+
var yAxis = axis.tickPadding(tickPadding).tickValues(customTickValues).tickFormat(tickFormat).tickSize(0);
|
|
524
579
|
if (chartType === ChartTypes.VerticalStackedBarChart) {
|
|
525
580
|
axis.tickSizeInner(-(containerWidth - margins.left - margins.right));
|
|
526
581
|
}
|
|
527
|
-
if (yAxisTickFormat) {
|
|
528
|
-
yAxis.tickFormat(yAxisTickFormat);
|
|
529
|
-
}
|
|
530
582
|
yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
531
583
|
return yAxisScale;
|
|
532
584
|
};
|