@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
|
@@ -113,13 +113,16 @@ function defaultYAxisTickFormatter(value) {
|
|
|
113
113
|
* @param {IXAxisParams} xAxisParams
|
|
114
114
|
*/
|
|
115
115
|
function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleType) {
|
|
116
|
-
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;
|
|
116
|
+
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;
|
|
117
117
|
var xAxisScale = createNumericScale(scaleType)
|
|
118
118
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
119
119
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
|
|
120
120
|
showRoundOffXTickValues && xAxisScale.nice();
|
|
121
121
|
var tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
|
|
122
122
|
var tickFormat = function (domainValue, _index, defaultFormat) {
|
|
123
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
124
|
+
return tickText[_index];
|
|
125
|
+
}
|
|
123
126
|
if (tickParams.tickFormat) {
|
|
124
127
|
return (0, d3_format_1.format)(tickParams.tickFormat)(domainValue);
|
|
125
128
|
}
|
|
@@ -258,7 +261,7 @@ function isPowerOf10(num) {
|
|
|
258
261
|
* @param {ITickParams} tickParams
|
|
259
262
|
*/
|
|
260
263
|
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
|
|
261
|
-
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;
|
|
264
|
+
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;
|
|
262
265
|
var xAxisScale = useUTC ? (0, d3_scale_1.scaleUtc)() : (0, d3_scale_1.scaleTime)();
|
|
263
266
|
xAxisScale
|
|
264
267
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
@@ -280,6 +283,9 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
280
283
|
var formatOptions = options !== null && options !== void 0 ? options : (0, chart_utilities_1.getMultiLevelDateTimeFormatOptions)(lowestFormatLevel, highestFormatLevel);
|
|
281
284
|
var formatFn = getMultiLevelD3DateFormatter(lowestFormatLevel, highestFormatLevel, locale, useUTC);
|
|
282
285
|
var tickFormat = function (domainValue, _index) {
|
|
286
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
287
|
+
return tickText[_index];
|
|
288
|
+
}
|
|
283
289
|
if (customDateTimeFormatter) {
|
|
284
290
|
return customDateTimeFormatter(domainValue);
|
|
285
291
|
}
|
|
@@ -335,13 +341,19 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
335
341
|
*/
|
|
336
342
|
function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
|
|
337
343
|
var _a;
|
|
338
|
-
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;
|
|
344
|
+
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;
|
|
339
345
|
var xAxisScale = (0, d3_scale_1.scaleBand)()
|
|
340
346
|
.domain(dataset)
|
|
341
347
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue])
|
|
342
348
|
.paddingInner(typeof xAxisInnerPadding !== 'undefined' ? xAxisInnerPadding : xAxisPadding)
|
|
343
349
|
.paddingOuter(typeof xAxisOuterPadding !== 'undefined' ? xAxisOuterPadding : xAxisPadding);
|
|
344
350
|
var tickValues = (_a = tickParams.tickValues) !== null && _a !== void 0 ? _a : dataset;
|
|
351
|
+
var tickFormat = function (domainValue, _index) {
|
|
352
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
353
|
+
return tickText[_index];
|
|
354
|
+
}
|
|
355
|
+
return domainValue;
|
|
356
|
+
};
|
|
345
357
|
if (hideTickOverlap) {
|
|
346
358
|
var nonOverlappingTickValues = [];
|
|
347
359
|
// Here, we need the width of each individual label to detect overlaps,
|
|
@@ -370,7 +382,11 @@ function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
|
|
|
370
382
|
nonOverlappingTickValues = nonOverlappingTickValues.reverse();
|
|
371
383
|
tickValues = nonOverlappingTickValues;
|
|
372
384
|
}
|
|
373
|
-
var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale)
|
|
385
|
+
var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale)
|
|
386
|
+
.tickSize(xAxistickSize)
|
|
387
|
+
.tickPadding(tickPadding)
|
|
388
|
+
.tickValues(tickValues)
|
|
389
|
+
.tickFormat(tickFormat);
|
|
374
390
|
if (xAxisParams.xAxisElement) {
|
|
375
391
|
(0, d3_selection_1.select)(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
376
392
|
}
|
|
@@ -438,7 +454,7 @@ function prepareDatapoints(maxVal, minVal, splitInto, isIntegralDataset, rounded
|
|
|
438
454
|
return dataPointsArray;
|
|
439
455
|
}
|
|
440
456
|
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
441
|
-
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;
|
|
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, 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;
|
|
442
458
|
// maxOfYVal coming from horizontal bar chart with axis (Calculation done at base file)
|
|
443
459
|
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
444
460
|
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -448,7 +464,20 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
|
448
464
|
.range([containerHeight - margins.bottom, margins.top]);
|
|
449
465
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
450
466
|
var yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
451
|
-
|
|
467
|
+
var tickFormat = function (domainValue, index) {
|
|
468
|
+
if (tickValues && tickText && typeof tickText[index] !== 'undefined') {
|
|
469
|
+
return tickText[index];
|
|
470
|
+
}
|
|
471
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
472
|
+
return yAxisTickFormat(domainValue, index);
|
|
473
|
+
}
|
|
474
|
+
if (typeof yAxisTickFormat === 'string') {
|
|
475
|
+
return (0, d3_format_1.format)(yAxisTickFormat)(domainValue);
|
|
476
|
+
}
|
|
477
|
+
var value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
478
|
+
return defaultYAxisTickFormatter(value);
|
|
479
|
+
};
|
|
480
|
+
yAxis.tickFormat(tickFormat);
|
|
452
481
|
var customTickValues;
|
|
453
482
|
if (tickValues) {
|
|
454
483
|
customTickValues = tickValues;
|
|
@@ -466,7 +495,7 @@ function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, use
|
|
|
466
495
|
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
467
496
|
if (supportNegativeData === void 0) { supportNegativeData = false; }
|
|
468
497
|
if (roundedTicks === void 0) { roundedTicks = false; }
|
|
469
|
-
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;
|
|
498
|
+
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;
|
|
470
499
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
471
500
|
var tempVal = maxOfYVal || yMinMaxValues.endValue || 0;
|
|
472
501
|
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -514,12 +543,19 @@ function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, use
|
|
|
514
543
|
}
|
|
515
544
|
}
|
|
516
545
|
var tickFormat = function (domainValue, index, defaultFormat) {
|
|
546
|
+
if (tickValues && tickText && typeof tickText[index] !== 'undefined') {
|
|
547
|
+
return tickText[index];
|
|
548
|
+
}
|
|
549
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
550
|
+
return yAxisTickFormat(domainValue, index);
|
|
551
|
+
}
|
|
552
|
+
if (typeof yAxisTickFormat === 'string') {
|
|
553
|
+
return (0, d3_format_1.format)(yAxisTickFormat)(domainValue);
|
|
554
|
+
}
|
|
517
555
|
var value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
518
556
|
return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(value)) === '' ? '' : defaultYAxisTickFormatter(value);
|
|
519
557
|
};
|
|
520
|
-
|
|
521
|
-
? yAxis.tickFormat(yAxisTickFormat)
|
|
522
|
-
: yAxis.tickFormat(function (v, i) { return tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)); });
|
|
558
|
+
yAxis.tickFormat(function (v, i) { return tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)); });
|
|
523
559
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
524
560
|
return yAxisScale;
|
|
525
561
|
}
|
|
@@ -530,7 +566,8 @@ function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, use
|
|
|
530
566
|
* @param isRtl
|
|
531
567
|
*/
|
|
532
568
|
var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth) {
|
|
533
|
-
var
|
|
569
|
+
var _a;
|
|
570
|
+
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;
|
|
534
571
|
var yAxisPaddingValue = yAxisPadding !== null && yAxisPadding !== void 0 ? yAxisPadding : 0.5;
|
|
535
572
|
yAxisPaddingValue = yAxisPaddingValue === 1 ? 0.99 : yAxisPaddingValue;
|
|
536
573
|
var yAxisScale = (0, d3_scale_1.scaleBand)()
|
|
@@ -538,10 +575,17 @@ var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, data
|
|
|
538
575
|
.range([containerHeight - margins.bottom, margins.top])
|
|
539
576
|
.padding(yAxisPaddingValue);
|
|
540
577
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
541
|
-
var
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
578
|
+
var customTickValues = (_a = tickValues) !== null && _a !== void 0 ? _a : dataPoints;
|
|
579
|
+
var tickFormat = function (domainValue, _index) {
|
|
580
|
+
if (tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
581
|
+
return tickText[_index];
|
|
582
|
+
}
|
|
583
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
584
|
+
return yAxisTickFormat(domainValue, _index);
|
|
585
|
+
}
|
|
586
|
+
return domainValue;
|
|
587
|
+
};
|
|
588
|
+
var yAxis = axis.tickPadding(tickPadding).tickValues(customTickValues).tickFormat(tickFormat);
|
|
545
589
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
546
590
|
return yAxisScale;
|
|
547
591
|
};
|
|
@@ -553,7 +597,8 @@ exports.createStringYAxisForHorizontalBarChartWithAxis = createStringYAxisForHor
|
|
|
553
597
|
* @param isRtl
|
|
554
598
|
*/
|
|
555
599
|
var createStringYAxis = function (yAxisParams, dataPoints, isRtl, barWidth, chartType) {
|
|
556
|
-
var
|
|
600
|
+
var _a;
|
|
601
|
+
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;
|
|
557
602
|
var yAxisScale = (0, d3_scale_1.scaleBand)()
|
|
558
603
|
.domain(dataPoints)
|
|
559
604
|
.range([containerHeight - margins.bottom, margins.top])
|
|
@@ -562,13 +607,20 @@ var createStringYAxis = function (yAxisParams, dataPoints, isRtl, barWidth, char
|
|
|
562
607
|
yAxisScale.paddingInner(1).paddingOuter(0);
|
|
563
608
|
}
|
|
564
609
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
565
|
-
var
|
|
610
|
+
var customTickValues = (_a = tickValues) !== null && _a !== void 0 ? _a : dataPoints;
|
|
611
|
+
var tickFormat = function (domainValue, _index) {
|
|
612
|
+
if (tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
613
|
+
return tickText[_index];
|
|
614
|
+
}
|
|
615
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
616
|
+
return yAxisTickFormat(domainValue, _index);
|
|
617
|
+
}
|
|
618
|
+
return domainValue;
|
|
619
|
+
};
|
|
620
|
+
var yAxis = axis.tickPadding(tickPadding).tickValues(customTickValues).tickFormat(tickFormat).tickSize(0);
|
|
566
621
|
if (chartType === ChartTypes.VerticalStackedBarChart) {
|
|
567
622
|
axis.tickSizeInner(-(containerWidth - margins.left - margins.right));
|
|
568
623
|
}
|
|
569
|
-
if (yAxisTickFormat) {
|
|
570
|
-
yAxis.tickFormat(yAxisTickFormat);
|
|
571
|
-
}
|
|
572
624
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
573
625
|
return yAxisScale;
|
|
574
626
|
};
|