@fluentui/react-charting 5.23.84 → 5.23.86
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 +67 -1
- package/CHANGELOG.md +26 -2
- package/dist/react-charting.d.ts +7 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +2 -0
- package/lib/components/CommonComponents/CartesianChart.base.js +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +2 -0
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +8 -3
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +12 -6
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +5 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +78 -16
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -2
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +53 -47
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +5 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/utilities.d.ts +1 -0
- package/lib/utilities/utilities.js +114 -40
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +2 -0
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +7 -2
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +11 -5
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +5 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +77 -16
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -2
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +53 -47
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +5 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +1 -0
- package/lib-amd/utilities/utilities.js +115 -41
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +2 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +7 -2
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +11 -5
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +5 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +77 -15
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -2
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +53 -47
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +5 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +1 -0
- package/lib-commonjs/utilities/utilities.js +116 -42
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CommonComponents/CartesianChart.types.ts +3 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
exports.getCurveFactory = exports.createMeasurementSpan = void 0;
|
|
4
|
+
exports.resolveCSSVariables = exports.areArraysEqual = exports.getSecureProps = exports.formatDate = exports.isScalePaddingDefined = exports.getScalePadding = exports.getBarWidth = exports.formatValueLimitWidth = exports.wrapTextInsideDonut = exports.rotateXAxisLabels = exports.convertToLocaleString = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.findHBCWANumericMinMaxOfY = exports.findVerticalNumericMinMaxOfY = exports.findVSBCNumericMinMaxOfY = exports.findNumericMinMaxOfY = exports.domainRageOfVerticalNumeric = exports.domainRangeOfDateForAreaLineVerticalBarChart = exports.domainRangeOfVSBCNumeric = exports.domainRangeOfXStringAxis = exports.domainRangeOfNumericForHorizontalBarChartWithAxis = exports.computeLongestBars = exports.groupChartDataByYValue = exports.domainRangeOfNumericForAreaChart = exports.getXAxisType = exports.tooltipOfXAxislabels = exports.calculateLongestLabelWidth = exports.wrapContent = exports.createYAxisLabels = exports.createWrapOfXLabels = exports.silceOrAppendToArray = exports.getUnique = exports.calloutData = exports.createStringYAxis = exports.createStringYAxisForHorizontalBarChartWithAxis = exports.createNumericYAxis = exports.createYAxisForHorizontalBarChartWithAxis = exports.prepareDatapoints = exports.createStringXAxis = exports.createDateXAxis = exports.createNumericXAxis = exports.defaultYAxisTickFormatter = exports.YAxisType = exports.XAxisTypes = exports.ChartTypes = exports.MIN_DOMAIN_MARGIN = void 0;
|
|
5
|
+
exports.getCurveFactory = exports.createMeasurementSpan = exports.copyStyle = void 0;
|
|
6
6
|
var tslib_1 = require("tslib");
|
|
7
7
|
var d3_axis_1 = require("d3-axis");
|
|
8
8
|
var d3_array_1 = require("d3-array");
|
|
@@ -14,6 +14,7 @@ var d3_time_1 = require("d3-time");
|
|
|
14
14
|
var d3_format_2 = require("d3-format");
|
|
15
15
|
var react_1 = require("@fluentui/react");
|
|
16
16
|
var d3_shape_1 = require("d3-shape");
|
|
17
|
+
exports.MIN_DOMAIN_MARGIN = 8;
|
|
17
18
|
var ChartTypes;
|
|
18
19
|
(function (ChartTypes) {
|
|
19
20
|
ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
|
|
@@ -71,7 +72,7 @@ exports.defaultYAxisTickFormatter = defaultYAxisTickFormatter;
|
|
|
71
72
|
*/
|
|
72
73
|
function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
|
|
73
74
|
var _a;
|
|
74
|
-
var domainNRangeValues = xAxisParams.domainNRangeValues, _b = xAxisParams.showRoundOffXTickValues, showRoundOffXTickValues = _b === void 0 ?
|
|
75
|
+
var domainNRangeValues = xAxisParams.domainNRangeValues, _b = xAxisParams.showRoundOffXTickValues, showRoundOffXTickValues = _b === void 0 ? true : _b, _c = xAxisParams.xAxistickSize, xAxistickSize = _c === void 0 ? 6 : _c, _d = xAxisParams.tickPadding, tickPadding = _d === void 0 ? 10 : _d, xAxisCount = xAxisParams.xAxisCount, xAxisElement = xAxisParams.xAxisElement, hideTickOverlap = xAxisParams.hideTickOverlap;
|
|
75
76
|
var xAxisScale = (0, d3_scale_1.scaleLinear)()
|
|
76
77
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
77
78
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
|
|
@@ -107,16 +108,75 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
|
|
|
107
108
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
108
109
|
}
|
|
109
110
|
exports.createNumericXAxis = createNumericXAxis;
|
|
110
|
-
|
|
111
|
+
/**
|
|
112
|
+
* This function returns a multilevel formatter for a given date range.
|
|
113
|
+
* It determines the appropriate date format to accommodate each tick value.
|
|
114
|
+
* The goal is to represent the date label in the smallest possible format without loss of information.
|
|
115
|
+
* The challenge here is to adhere to locale specific formats while ensuring the complete label is shown.
|
|
116
|
+
* There is an exhaustive map of all possible date/time units and their respective formats.
|
|
117
|
+
* Based on the range of formatting granularity levels, a format spanning the range is returned.
|
|
118
|
+
* @param startLevel - The starting level of the date format.
|
|
119
|
+
* @param endLevel - The ending level of the date format.
|
|
120
|
+
* @param locale - The locale object for formatting.
|
|
121
|
+
* @param useUTC
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
function getMultiLevelDateFormatter(startLevel, endLevel, locale, useUTC) {
|
|
111
125
|
var timeFormat = locale ? (useUTC ? locale.utcFormat : locale.format) : useUTC ? d3_time_format_1.utcFormat : d3_time_format_1.timeFormat;
|
|
112
|
-
|
|
113
|
-
var
|
|
114
|
-
var
|
|
115
|
-
var
|
|
116
|
-
var
|
|
117
|
-
var
|
|
118
|
-
var
|
|
119
|
-
var
|
|
126
|
+
// Refer to https://d3js.org/d3-time-format#locale_format to see explanation about each format specifier
|
|
127
|
+
var DEFAULT = '%c';
|
|
128
|
+
var MS = '.%L';
|
|
129
|
+
var MS_S = ':%S.%L';
|
|
130
|
+
var MS_S_MIN = '%M:%S.%L';
|
|
131
|
+
var MS_S_MIN_H = '%-I:%M:%S.%L %p';
|
|
132
|
+
var MS_S_MIN_H_D = '%a %d, %X';
|
|
133
|
+
var MS_S_MIN_H_D_W = '%b %d, %X';
|
|
134
|
+
var MS_S_MIN_H_D_W_M = MS_S_MIN_H_D_W;
|
|
135
|
+
var MS_S_MIN_H_D_W_M_Y = DEFAULT;
|
|
136
|
+
var S = ':%S';
|
|
137
|
+
var S_MIN = '%-I:%M:%S';
|
|
138
|
+
var S_MIN_H = '%X';
|
|
139
|
+
var S_MIN_H_D = MS_S_MIN_H_D;
|
|
140
|
+
var S_MIN_H_D_W = MS_S_MIN_H_D_W;
|
|
141
|
+
var S_MIN_H_D_W_M = MS_S_MIN_H_D_W_M;
|
|
142
|
+
var S_MIN_H_D_W_M_Y = DEFAULT;
|
|
143
|
+
var MIN = '%-I:%M %p';
|
|
144
|
+
var MIN_H = MIN;
|
|
145
|
+
var MIN_H_D = '%a %d, %-I:%M %p';
|
|
146
|
+
var MIN_H_D_W = '%b %d, %-I:%M %p';
|
|
147
|
+
var MIN_H_D_W_M = MIN_H_D_W;
|
|
148
|
+
var MIN_H_D_W_M_Y = '%x, %-I:%M %p';
|
|
149
|
+
var H = '%-I %p';
|
|
150
|
+
var H_D = '%a %d, %-I %p';
|
|
151
|
+
var H_D_W = '%b %d, %-I %p';
|
|
152
|
+
var H_D_W_M = H_D_W;
|
|
153
|
+
var H_D_W_M_Y = '%x, %-I %p';
|
|
154
|
+
var D = '%a %d';
|
|
155
|
+
var D_W = '%b %d';
|
|
156
|
+
var D_W_M = D_W;
|
|
157
|
+
var D_W_M_Y = '%x';
|
|
158
|
+
var W = D_W;
|
|
159
|
+
var W_M = W;
|
|
160
|
+
var W_M_Y = D_W_M_Y;
|
|
161
|
+
var M = '%B';
|
|
162
|
+
var M_Y = '%b %Y';
|
|
163
|
+
var Y = '%Y';
|
|
164
|
+
var MULTI_LEVEL_DATE_TIME_FORMATS = [
|
|
165
|
+
// ms, s, min, h, d, w, m, y
|
|
166
|
+
[MS, MS_S, MS_S_MIN, MS_S_MIN_H, MS_S_MIN_H_D, MS_S_MIN_H_D_W, MS_S_MIN_H_D_W_M, MS_S_MIN_H_D_W_M_Y], // ms
|
|
167
|
+
[DEFAULT, S, S_MIN, S_MIN_H, S_MIN_H_D, S_MIN_H_D_W, S_MIN_H_D_W_M, S_MIN_H_D_W_M_Y], // s
|
|
168
|
+
[DEFAULT, DEFAULT, MIN, MIN_H, MIN_H_D, MIN_H_D_W, MIN_H_D_W_M, MIN_H_D_W_M_Y], // min
|
|
169
|
+
[DEFAULT, DEFAULT, DEFAULT, H, H_D, H_D_W, H_D_W_M, H_D_W_M_Y], // h
|
|
170
|
+
[DEFAULT, DEFAULT, DEFAULT, DEFAULT, D, D_W, D_W_M, D_W_M_Y], // d
|
|
171
|
+
[DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, W, W_M, W_M_Y], // w
|
|
172
|
+
[DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, M, M_Y], // m
|
|
173
|
+
[DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, Y], // y
|
|
174
|
+
];
|
|
175
|
+
var formatter = timeFormat(MULTI_LEVEL_DATE_TIME_FORMATS[startLevel][endLevel]);
|
|
176
|
+
return formatter;
|
|
177
|
+
}
|
|
178
|
+
function getDateFormatLevel(date, useUTC) {
|
|
179
|
+
var _a;
|
|
120
180
|
var timeSecond = useUTC ? d3_time_1.utcSecond : d3_time_1.timeSecond;
|
|
121
181
|
var timeMinute = useUTC ? d3_time_1.utcMinute : d3_time_1.timeMinute;
|
|
122
182
|
var timeHour = useUTC ? d3_time_1.utcHour : d3_time_1.timeHour;
|
|
@@ -124,21 +184,21 @@ function multiFormat(date, locale, useUTC) {
|
|
|
124
184
|
var timeMonth = useUTC ? d3_time_1.utcMonth : d3_time_1.timeMonth;
|
|
125
185
|
var timeWeek = useUTC ? d3_time_1.utcWeek : d3_time_1.timeWeek;
|
|
126
186
|
var timeYear = useUTC ? d3_time_1.utcYear : d3_time_1.timeYear;
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
: timeMinute(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
187
|
+
var formats = [
|
|
188
|
+
{ formatLevel: 0, condition: function (d) { return timeSecond(d) < d; } }, // Milliseconds
|
|
189
|
+
{ formatLevel: 1, condition: function (d) { return timeMinute(d) < d; } }, // Seconds
|
|
190
|
+
{ formatLevel: 2, condition: function (d) { return timeHour(d) < d; } }, // Minutes
|
|
191
|
+
{ formatLevel: 3, condition: function (d) { return timeDay(d) < d; } }, // Hours
|
|
192
|
+
{ formatLevel: 4, condition: function (d) { return timeMonth(d) < d && timeWeek(d) < d; } }, // Days
|
|
193
|
+
{ formatLevel: 5, condition: function (d) { return timeMonth(d) < d; } }, // Weeks
|
|
194
|
+
{ formatLevel: 6, condition: function (d) { return timeYear(d) < d; } }, // Months
|
|
195
|
+
{ formatLevel: 7, condition: function () { return true; } }, // Years (default)
|
|
196
|
+
];
|
|
197
|
+
var matchedFormat = formats.find(function (_a) {
|
|
198
|
+
var condition = _a.condition;
|
|
199
|
+
return condition(date);
|
|
200
|
+
});
|
|
201
|
+
return (_a = matchedFormat === null || matchedFormat === void 0 ? void 0 : matchedFormat.formatLevel) !== null && _a !== void 0 ? _a : 7;
|
|
142
202
|
}
|
|
143
203
|
function isPowerOf10(num) {
|
|
144
204
|
var roundedfinalYMax = handleFloatingPointPrecisionError(num);
|
|
@@ -157,12 +217,26 @@ function handleFloatingPointPrecisionError(num) {
|
|
|
157
217
|
*/
|
|
158
218
|
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
|
|
159
219
|
var _a;
|
|
160
|
-
var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _b = xAxisParams.tickPadding, tickPadding = _b === void 0 ? 6 : _b, _c = xAxisParams.xAxistickSize, xAxistickSize = _c === void 0 ? 6 : _c, xAxisCount = xAxisParams.xAxisCount
|
|
220
|
+
var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _b = xAxisParams.tickPadding, tickPadding = _b === void 0 ? 6 : _b, _c = xAxisParams.xAxistickSize, xAxistickSize = _c === void 0 ? 6 : _c, xAxisCount = xAxisParams.xAxisCount;
|
|
161
221
|
var xAxisScale = useUTC ? (0, d3_scale_1.scaleUtc)() : (0, d3_scale_1.scaleTime)();
|
|
162
222
|
xAxisScale
|
|
163
223
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
164
|
-
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue])
|
|
224
|
+
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue])
|
|
225
|
+
.nice();
|
|
165
226
|
var tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
|
|
227
|
+
var lowestFormatLevel = 100;
|
|
228
|
+
var highestFormatLevel = -1;
|
|
229
|
+
var locale = timeFormatLocale ? (0, d3_time_format_1.timeFormatLocale)(timeFormatLocale) : undefined;
|
|
230
|
+
xAxisScale.ticks().forEach(function (domainValue) {
|
|
231
|
+
var formatLevel = getDateFormatLevel(domainValue, useUTC);
|
|
232
|
+
if (formatLevel > highestFormatLevel) {
|
|
233
|
+
highestFormatLevel = formatLevel;
|
|
234
|
+
}
|
|
235
|
+
if (formatLevel < lowestFormatLevel) {
|
|
236
|
+
lowestFormatLevel = formatLevel;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
var formatFn = getMultiLevelDateFormatter(lowestFormatLevel, highestFormatLevel, locale, useUTC);
|
|
166
240
|
var tickFormat = function (domainValue, _index) {
|
|
167
241
|
if (customDateTimeFormatter) {
|
|
168
242
|
return customDateTimeFormatter(domainValue);
|
|
@@ -171,8 +245,7 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
171
245
|
return domainValue.toLocaleString(culture, options);
|
|
172
246
|
}
|
|
173
247
|
if (timeFormatLocale) {
|
|
174
|
-
|
|
175
|
-
return multiFormat(domainValue, locale, useUTC);
|
|
248
|
+
return formatFn(domainValue);
|
|
176
249
|
}
|
|
177
250
|
if (culture === undefined && tickParams.tickFormat) {
|
|
178
251
|
if (useUTC) {
|
|
@@ -182,13 +255,12 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
182
255
|
return (0, d3_time_format_1.timeFormat)(tickParams.tickFormat)(domainValue);
|
|
183
256
|
}
|
|
184
257
|
}
|
|
185
|
-
return
|
|
258
|
+
return formatFn(domainValue);
|
|
186
259
|
};
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
}
|
|
260
|
+
var longestLabelWidth = (0, exports.calculateLongestLabelWidth)(xAxisScale.ticks().map(tickFormat), '[class^="xAxis-"] text') + 40;
|
|
261
|
+
var _d = xAxisScale.range(), start = _d[0], end = _d[1];
|
|
262
|
+
tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
263
|
+
tickCount = Math.min(tickCount, xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : tickCount);
|
|
192
264
|
var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale)
|
|
193
265
|
.tickSize(xAxistickSize)
|
|
194
266
|
.tickPadding(tickPadding)
|
|
@@ -319,13 +391,12 @@ function prepareDatapoints(maxVal, minVal, splitInto, isIntegralDataset, rounded
|
|
|
319
391
|
exports.prepareDatapoints = prepareDatapoints;
|
|
320
392
|
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
321
393
|
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;
|
|
322
|
-
// maxOfYVal coming from
|
|
394
|
+
// maxOfYVal coming from horizontal bar chart with axis (Calculation done at base file)
|
|
323
395
|
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
324
396
|
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
325
397
|
var finalYmin = yMinMaxValues.startValue < yMinValue ? Math.min(0, yMinMaxValues.startValue) : yMinValue;
|
|
326
|
-
var yDomainPadding = Math.abs(finalYmax - finalYmin) * 0.1;
|
|
327
398
|
var yAxisScale = (0, d3_scale_1.scaleLinear)()
|
|
328
|
-
.domain([finalYmin
|
|
399
|
+
.domain([finalYmin, finalYmax])
|
|
329
400
|
.range([containerHeight - margins.bottom, margins.top]);
|
|
330
401
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
331
402
|
var yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
@@ -369,10 +440,13 @@ exports.createNumericYAxis = createNumericYAxis;
|
|
|
369
440
|
* @param isRtl
|
|
370
441
|
*/
|
|
371
442
|
var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth) {
|
|
372
|
-
var containerHeight = yAxisParams.containerHeight, _a = yAxisParams.tickPadding, tickPadding = _a === void 0 ? 12 : _a, margins = yAxisParams.margins, yAxisTickFormat = yAxisParams.yAxisTickFormat, yAxisElement = yAxisParams.yAxisElement;
|
|
443
|
+
var containerHeight = yAxisParams.containerHeight, _a = yAxisParams.tickPadding, tickPadding = _a === void 0 ? 12 : _a, margins = yAxisParams.margins, yAxisTickFormat = yAxisParams.yAxisTickFormat, yAxisElement = yAxisParams.yAxisElement, yAxisPadding = yAxisParams.yAxisPadding;
|
|
444
|
+
var yAxisPaddingValue = yAxisPadding !== null && yAxisPadding !== void 0 ? yAxisPadding : 0.5;
|
|
445
|
+
yAxisPaddingValue = yAxisPaddingValue === 1 ? 0.99 : yAxisPaddingValue;
|
|
373
446
|
var yAxisScale = (0, d3_scale_1.scaleBand)()
|
|
374
447
|
.domain(dataPoints)
|
|
375
|
-
.range([containerHeight - margins.bottom
|
|
448
|
+
.range([containerHeight - margins.bottom, margins.top])
|
|
449
|
+
.padding(yAxisPaddingValue);
|
|
376
450
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
377
451
|
var yAxis = axis.tickPadding(tickPadding).ticks(dataPoints);
|
|
378
452
|
if (yAxisTickFormat) {
|