@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
|
@@ -101,13 +101,16 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
101
101
|
* @param {IXAxisParams} xAxisParams
|
|
102
102
|
*/
|
|
103
103
|
function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleType) {
|
|
104
|
-
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;
|
|
104
|
+
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;
|
|
105
105
|
var xAxisScale = createNumericScale(scaleType)
|
|
106
106
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
107
107
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
|
|
108
108
|
showRoundOffXTickValues && xAxisScale.nice();
|
|
109
109
|
var tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
|
|
110
110
|
var tickFormat = function (domainValue, _index, defaultFormat) {
|
|
111
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
112
|
+
return tickText[_index];
|
|
113
|
+
}
|
|
111
114
|
if (tickParams.tickFormat) {
|
|
112
115
|
return (0, d3_format_1.format)(tickParams.tickFormat)(domainValue);
|
|
113
116
|
}
|
|
@@ -246,7 +249,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
246
249
|
* @param {ITickParams} tickParams
|
|
247
250
|
*/
|
|
248
251
|
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
|
|
249
|
-
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;
|
|
252
|
+
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;
|
|
250
253
|
var xAxisScale = useUTC ? (0, d3_scale_1.scaleUtc)() : (0, d3_scale_1.scaleTime)();
|
|
251
254
|
xAxisScale
|
|
252
255
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
@@ -268,6 +271,9 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
268
271
|
var formatOptions = options !== null && options !== void 0 ? options : (0, chart_utilities_1.getMultiLevelDateTimeFormatOptions)(lowestFormatLevel, highestFormatLevel);
|
|
269
272
|
var formatFn = getMultiLevelD3DateFormatter(lowestFormatLevel, highestFormatLevel, locale, useUTC);
|
|
270
273
|
var tickFormat = function (domainValue, _index) {
|
|
274
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
275
|
+
return tickText[_index];
|
|
276
|
+
}
|
|
271
277
|
if (customDateTimeFormatter) {
|
|
272
278
|
return customDateTimeFormatter(domainValue);
|
|
273
279
|
}
|
|
@@ -323,13 +329,19 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
323
329
|
*/
|
|
324
330
|
function createStringXAxis(xAxisParams, tickParams, dataset, culture) {
|
|
325
331
|
var _a;
|
|
326
|
-
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;
|
|
332
|
+
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;
|
|
327
333
|
var xAxisScale = (0, d3_scale_1.scaleBand)()
|
|
328
334
|
.domain(dataset)
|
|
329
335
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue])
|
|
330
336
|
.paddingInner(typeof xAxisInnerPadding !== 'undefined' ? xAxisInnerPadding : xAxisPadding)
|
|
331
337
|
.paddingOuter(typeof xAxisOuterPadding !== 'undefined' ? xAxisOuterPadding : xAxisPadding);
|
|
332
338
|
var tickValues = (_a = tickParams.tickValues) !== null && _a !== void 0 ? _a : dataset;
|
|
339
|
+
var tickFormat = function (domainValue, _index) {
|
|
340
|
+
if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
341
|
+
return tickText[_index];
|
|
342
|
+
}
|
|
343
|
+
return domainValue;
|
|
344
|
+
};
|
|
333
345
|
if (hideTickOverlap) {
|
|
334
346
|
var nonOverlappingTickValues = [];
|
|
335
347
|
// Here, we need the width of each individual label to detect overlaps,
|
|
@@ -358,7 +370,11 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
358
370
|
nonOverlappingTickValues = nonOverlappingTickValues.reverse();
|
|
359
371
|
tickValues = nonOverlappingTickValues;
|
|
360
372
|
}
|
|
361
|
-
var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale)
|
|
373
|
+
var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale)
|
|
374
|
+
.tickSize(xAxistickSize)
|
|
375
|
+
.tickPadding(tickPadding)
|
|
376
|
+
.tickValues(tickValues)
|
|
377
|
+
.tickFormat(tickFormat);
|
|
362
378
|
if (xAxisParams.xAxisElement) {
|
|
363
379
|
(0, d3_selection_1.select)(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
364
380
|
}
|
|
@@ -426,7 +442,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
426
442
|
return dataPointsArray;
|
|
427
443
|
}
|
|
428
444
|
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
429
|
-
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;
|
|
445
|
+
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;
|
|
430
446
|
// maxOfYVal coming from horizontal bar chart with axis (Calculation done at base file)
|
|
431
447
|
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
432
448
|
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -436,7 +452,20 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
436
452
|
.range([containerHeight - margins.bottom, margins.top]);
|
|
437
453
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
438
454
|
var yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
439
|
-
|
|
455
|
+
var tickFormat = function (domainValue, index) {
|
|
456
|
+
if (tickValues && tickText && typeof tickText[index] !== 'undefined') {
|
|
457
|
+
return tickText[index];
|
|
458
|
+
}
|
|
459
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
460
|
+
return yAxisTickFormat(domainValue, index);
|
|
461
|
+
}
|
|
462
|
+
if (typeof yAxisTickFormat === 'string') {
|
|
463
|
+
return (0, d3_format_1.format)(yAxisTickFormat)(domainValue);
|
|
464
|
+
}
|
|
465
|
+
var value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
466
|
+
return defaultYAxisTickFormatter(value);
|
|
467
|
+
};
|
|
468
|
+
yAxis.tickFormat(tickFormat);
|
|
440
469
|
var customTickValues;
|
|
441
470
|
if (tickValues) {
|
|
442
471
|
customTickValues = tickValues;
|
|
@@ -454,7 +483,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
454
483
|
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
455
484
|
if (supportNegativeData === void 0) { supportNegativeData = false; }
|
|
456
485
|
if (roundedTicks === void 0) { roundedTicks = false; }
|
|
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;
|
|
486
|
+
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;
|
|
458
487
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
459
488
|
var tempVal = maxOfYVal || yMinMaxValues.endValue || 0;
|
|
460
489
|
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -502,12 +531,19 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
502
531
|
}
|
|
503
532
|
}
|
|
504
533
|
var tickFormat = function (domainValue, index, defaultFormat) {
|
|
534
|
+
if (tickValues && tickText && typeof tickText[index] !== 'undefined') {
|
|
535
|
+
return tickText[index];
|
|
536
|
+
}
|
|
537
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
538
|
+
return yAxisTickFormat(domainValue, index);
|
|
539
|
+
}
|
|
540
|
+
if (typeof yAxisTickFormat === 'string') {
|
|
541
|
+
return (0, d3_format_1.format)(yAxisTickFormat)(domainValue);
|
|
542
|
+
}
|
|
505
543
|
var value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
506
544
|
return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(value)) === '' ? '' : defaultYAxisTickFormatter(value);
|
|
507
545
|
};
|
|
508
|
-
|
|
509
|
-
? yAxis.tickFormat(yAxisTickFormat)
|
|
510
|
-
: yAxis.tickFormat(function (v, i) { return tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)); });
|
|
546
|
+
yAxis.tickFormat(function (v, i) { return tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)); });
|
|
511
547
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
512
548
|
return yAxisScale;
|
|
513
549
|
}
|
|
@@ -518,7 +554,8 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
518
554
|
* @param isRtl
|
|
519
555
|
*/
|
|
520
556
|
var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth) {
|
|
521
|
-
var
|
|
557
|
+
var _a;
|
|
558
|
+
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;
|
|
522
559
|
var yAxisPaddingValue = yAxisPadding !== null && yAxisPadding !== void 0 ? yAxisPadding : 0.5;
|
|
523
560
|
yAxisPaddingValue = yAxisPaddingValue === 1 ? 0.99 : yAxisPaddingValue;
|
|
524
561
|
var yAxisScale = (0, d3_scale_1.scaleBand)()
|
|
@@ -526,10 +563,17 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
526
563
|
.range([containerHeight - margins.bottom, margins.top])
|
|
527
564
|
.padding(yAxisPaddingValue);
|
|
528
565
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
529
|
-
var
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
566
|
+
var customTickValues = (_a = tickValues) !== null && _a !== void 0 ? _a : dataPoints;
|
|
567
|
+
var tickFormat = function (domainValue, _index) {
|
|
568
|
+
if (tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
569
|
+
return tickText[_index];
|
|
570
|
+
}
|
|
571
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
572
|
+
return yAxisTickFormat(domainValue, _index);
|
|
573
|
+
}
|
|
574
|
+
return domainValue;
|
|
575
|
+
};
|
|
576
|
+
var yAxis = axis.tickPadding(tickPadding).tickValues(customTickValues).tickFormat(tickFormat);
|
|
533
577
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
534
578
|
return yAxisScale;
|
|
535
579
|
};
|
|
@@ -541,7 +585,8 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
541
585
|
* @param isRtl
|
|
542
586
|
*/
|
|
543
587
|
var createStringYAxis = function (yAxisParams, dataPoints, isRtl, barWidth, chartType) {
|
|
544
|
-
var
|
|
588
|
+
var _a;
|
|
589
|
+
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;
|
|
545
590
|
var yAxisScale = (0, d3_scale_1.scaleBand)()
|
|
546
591
|
.domain(dataPoints)
|
|
547
592
|
.range([containerHeight - margins.bottom, margins.top])
|
|
@@ -550,13 +595,20 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
550
595
|
yAxisScale.paddingInner(1).paddingOuter(0);
|
|
551
596
|
}
|
|
552
597
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
553
|
-
var
|
|
598
|
+
var customTickValues = (_a = tickValues) !== null && _a !== void 0 ? _a : dataPoints;
|
|
599
|
+
var tickFormat = function (domainValue, _index) {
|
|
600
|
+
if (tickValues && tickText && typeof tickText[_index] !== 'undefined') {
|
|
601
|
+
return tickText[_index];
|
|
602
|
+
}
|
|
603
|
+
if (typeof yAxisTickFormat === 'function') {
|
|
604
|
+
return yAxisTickFormat(domainValue, _index);
|
|
605
|
+
}
|
|
606
|
+
return domainValue;
|
|
607
|
+
};
|
|
608
|
+
var yAxis = axis.tickPadding(tickPadding).tickValues(customTickValues).tickFormat(tickFormat).tickSize(0);
|
|
554
609
|
if (chartType === ChartTypes.VerticalStackedBarChart) {
|
|
555
610
|
axis.tickSizeInner(-(containerWidth - margins.left - margins.right));
|
|
556
611
|
}
|
|
557
|
-
if (yAxisTickFormat) {
|
|
558
|
-
yAxis.tickFormat(yAxisTickFormat);
|
|
559
|
-
}
|
|
560
612
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
561
613
|
return yAxisScale;
|
|
562
614
|
};
|