@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
|
@@ -2,7 +2,8 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
2
2
|
"use strict";
|
|
3
3
|
var _a;
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.getCurveFactory = exports.createMeasurementSpan = exports.copyStyle = 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 = void 0;
|
|
5
|
+
exports.getCurveFactory = exports.createMeasurementSpan = exports.copyStyle = 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;
|
|
6
|
+
exports.MIN_DOMAIN_MARGIN = 8;
|
|
6
7
|
var ChartTypes;
|
|
7
8
|
(function (ChartTypes) {
|
|
8
9
|
ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
|
|
@@ -60,7 +61,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
60
61
|
*/
|
|
61
62
|
function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
|
|
62
63
|
var _a;
|
|
63
|
-
var domainNRangeValues = xAxisParams.domainNRangeValues, _b = xAxisParams.showRoundOffXTickValues, showRoundOffXTickValues = _b === void 0 ?
|
|
64
|
+
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;
|
|
64
65
|
var xAxisScale = (0, d3_scale_1.scaleLinear)()
|
|
65
66
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
66
67
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
|
|
@@ -96,16 +97,75 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
96
97
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
97
98
|
}
|
|
98
99
|
exports.createNumericXAxis = createNumericXAxis;
|
|
99
|
-
|
|
100
|
+
/**
|
|
101
|
+
* This function returns a multilevel formatter for a given date range.
|
|
102
|
+
* It determines the appropriate date format to accommodate each tick value.
|
|
103
|
+
* The goal is to represent the date label in the smallest possible format without loss of information.
|
|
104
|
+
* The challenge here is to adhere to locale specific formats while ensuring the complete label is shown.
|
|
105
|
+
* There is an exhaustive map of all possible date/time units and their respective formats.
|
|
106
|
+
* Based on the range of formatting granularity levels, a format spanning the range is returned.
|
|
107
|
+
* @param startLevel - The starting level of the date format.
|
|
108
|
+
* @param endLevel - The ending level of the date format.
|
|
109
|
+
* @param locale - The locale object for formatting.
|
|
110
|
+
* @param useUTC
|
|
111
|
+
* @returns
|
|
112
|
+
*/
|
|
113
|
+
function getMultiLevelDateFormatter(startLevel, endLevel, locale, useUTC) {
|
|
100
114
|
var timeFormat = locale ? (useUTC ? locale.utcFormat : locale.format) : useUTC ? d3_time_format_1.utcFormat : d3_time_format_1.timeFormat;
|
|
101
|
-
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
var
|
|
106
|
-
var
|
|
107
|
-
var
|
|
108
|
-
var
|
|
115
|
+
// Refer to https://d3js.org/d3-time-format#locale_format to see explanation about each format specifier
|
|
116
|
+
var DEFAULT = '%c';
|
|
117
|
+
var MS = '.%L';
|
|
118
|
+
var MS_S = ':%S.%L';
|
|
119
|
+
var MS_S_MIN = '%M:%S.%L';
|
|
120
|
+
var MS_S_MIN_H = '%-I:%M:%S.%L %p';
|
|
121
|
+
var MS_S_MIN_H_D = '%a %d, %X';
|
|
122
|
+
var MS_S_MIN_H_D_W = '%b %d, %X';
|
|
123
|
+
var MS_S_MIN_H_D_W_M = MS_S_MIN_H_D_W;
|
|
124
|
+
var MS_S_MIN_H_D_W_M_Y = DEFAULT;
|
|
125
|
+
var S = ':%S';
|
|
126
|
+
var S_MIN = '%-I:%M:%S';
|
|
127
|
+
var S_MIN_H = '%X';
|
|
128
|
+
var S_MIN_H_D = MS_S_MIN_H_D;
|
|
129
|
+
var S_MIN_H_D_W = MS_S_MIN_H_D_W;
|
|
130
|
+
var S_MIN_H_D_W_M = MS_S_MIN_H_D_W_M;
|
|
131
|
+
var S_MIN_H_D_W_M_Y = DEFAULT;
|
|
132
|
+
var MIN = '%-I:%M %p';
|
|
133
|
+
var MIN_H = MIN;
|
|
134
|
+
var MIN_H_D = '%a %d, %-I:%M %p';
|
|
135
|
+
var MIN_H_D_W = '%b %d, %-I:%M %p';
|
|
136
|
+
var MIN_H_D_W_M = MIN_H_D_W;
|
|
137
|
+
var MIN_H_D_W_M_Y = '%x, %-I:%M %p';
|
|
138
|
+
var H = '%-I %p';
|
|
139
|
+
var H_D = '%a %d, %-I %p';
|
|
140
|
+
var H_D_W = '%b %d, %-I %p';
|
|
141
|
+
var H_D_W_M = H_D_W;
|
|
142
|
+
var H_D_W_M_Y = '%x, %-I %p';
|
|
143
|
+
var D = '%a %d';
|
|
144
|
+
var D_W = '%b %d';
|
|
145
|
+
var D_W_M = D_W;
|
|
146
|
+
var D_W_M_Y = '%x';
|
|
147
|
+
var W = D_W;
|
|
148
|
+
var W_M = W;
|
|
149
|
+
var W_M_Y = D_W_M_Y;
|
|
150
|
+
var M = '%B';
|
|
151
|
+
var M_Y = '%b %Y';
|
|
152
|
+
var Y = '%Y';
|
|
153
|
+
var MULTI_LEVEL_DATE_TIME_FORMATS = [
|
|
154
|
+
// ms, s, min, h, d, w, m, y
|
|
155
|
+
[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
|
|
156
|
+
[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
|
|
157
|
+
[DEFAULT, DEFAULT, MIN, MIN_H, MIN_H_D, MIN_H_D_W, MIN_H_D_W_M, MIN_H_D_W_M_Y], // min
|
|
158
|
+
[DEFAULT, DEFAULT, DEFAULT, H, H_D, H_D_W, H_D_W_M, H_D_W_M_Y], // h
|
|
159
|
+
[DEFAULT, DEFAULT, DEFAULT, DEFAULT, D, D_W, D_W_M, D_W_M_Y], // d
|
|
160
|
+
[DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, W, W_M, W_M_Y], // w
|
|
161
|
+
[DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, M, M_Y], // m
|
|
162
|
+
[DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, DEFAULT, Y], // y
|
|
163
|
+
];
|
|
164
|
+
var formatter = timeFormat(MULTI_LEVEL_DATE_TIME_FORMATS[startLevel][endLevel]);
|
|
165
|
+
return formatter;
|
|
166
|
+
}
|
|
167
|
+
function getDateFormatLevel(date, useUTC) {
|
|
168
|
+
var _a;
|
|
109
169
|
var timeSecond = useUTC ? d3_time_1.utcSecond : d3_time_1.timeSecond;
|
|
110
170
|
var timeMinute = useUTC ? d3_time_1.utcMinute : d3_time_1.timeMinute;
|
|
111
171
|
var timeHour = useUTC ? d3_time_1.utcHour : d3_time_1.timeHour;
|
|
@@ -113,21 +173,21 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
113
173
|
var timeMonth = useUTC ? d3_time_1.utcMonth : d3_time_1.timeMonth;
|
|
114
174
|
var timeWeek = useUTC ? d3_time_1.utcWeek : d3_time_1.timeWeek;
|
|
115
175
|
var timeYear = useUTC ? d3_time_1.utcYear : d3_time_1.timeYear;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
: timeMinute(
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
176
|
+
var formats = [
|
|
177
|
+
{ formatLevel: 0, condition: function (d) { return timeSecond(d) < d; } }, // Milliseconds
|
|
178
|
+
{ formatLevel: 1, condition: function (d) { return timeMinute(d) < d; } }, // Seconds
|
|
179
|
+
{ formatLevel: 2, condition: function (d) { return timeHour(d) < d; } }, // Minutes
|
|
180
|
+
{ formatLevel: 3, condition: function (d) { return timeDay(d) < d; } }, // Hours
|
|
181
|
+
{ formatLevel: 4, condition: function (d) { return timeMonth(d) < d && timeWeek(d) < d; } }, // Days
|
|
182
|
+
{ formatLevel: 5, condition: function (d) { return timeMonth(d) < d; } }, // Weeks
|
|
183
|
+
{ formatLevel: 6, condition: function (d) { return timeYear(d) < d; } }, // Months
|
|
184
|
+
{ formatLevel: 7, condition: function () { return true; } }, // Years (default)
|
|
185
|
+
];
|
|
186
|
+
var matchedFormat = formats.find(function (_a) {
|
|
187
|
+
var condition = _a.condition;
|
|
188
|
+
return condition(date);
|
|
189
|
+
});
|
|
190
|
+
return (_a = matchedFormat === null || matchedFormat === void 0 ? void 0 : matchedFormat.formatLevel) !== null && _a !== void 0 ? _a : 7;
|
|
131
191
|
}
|
|
132
192
|
function isPowerOf10(num) {
|
|
133
193
|
var roundedfinalYMax = handleFloatingPointPrecisionError(num);
|
|
@@ -146,12 +206,26 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
146
206
|
*/
|
|
147
207
|
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
|
|
148
208
|
var _a;
|
|
149
|
-
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
|
|
209
|
+
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;
|
|
150
210
|
var xAxisScale = useUTC ? (0, d3_scale_1.scaleUtc)() : (0, d3_scale_1.scaleTime)();
|
|
151
211
|
xAxisScale
|
|
152
212
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
153
|
-
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue])
|
|
213
|
+
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue])
|
|
214
|
+
.nice();
|
|
154
215
|
var tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
|
|
216
|
+
var lowestFormatLevel = 100;
|
|
217
|
+
var highestFormatLevel = -1;
|
|
218
|
+
var locale = timeFormatLocale ? (0, d3_time_format_1.timeFormatLocale)(timeFormatLocale) : undefined;
|
|
219
|
+
xAxisScale.ticks().forEach(function (domainValue) {
|
|
220
|
+
var formatLevel = getDateFormatLevel(domainValue, useUTC);
|
|
221
|
+
if (formatLevel > highestFormatLevel) {
|
|
222
|
+
highestFormatLevel = formatLevel;
|
|
223
|
+
}
|
|
224
|
+
if (formatLevel < lowestFormatLevel) {
|
|
225
|
+
lowestFormatLevel = formatLevel;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
var formatFn = getMultiLevelDateFormatter(lowestFormatLevel, highestFormatLevel, locale, useUTC);
|
|
155
229
|
var tickFormat = function (domainValue, _index) {
|
|
156
230
|
if (customDateTimeFormatter) {
|
|
157
231
|
return customDateTimeFormatter(domainValue);
|
|
@@ -160,8 +234,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
160
234
|
return domainValue.toLocaleString(culture, options);
|
|
161
235
|
}
|
|
162
236
|
if (timeFormatLocale) {
|
|
163
|
-
|
|
164
|
-
return multiFormat(domainValue, locale, useUTC);
|
|
237
|
+
return formatFn(domainValue);
|
|
165
238
|
}
|
|
166
239
|
if (culture === undefined && tickParams.tickFormat) {
|
|
167
240
|
if (useUTC) {
|
|
@@ -171,13 +244,12 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
171
244
|
return (0, d3_time_format_1.timeFormat)(tickParams.tickFormat)(domainValue);
|
|
172
245
|
}
|
|
173
246
|
}
|
|
174
|
-
return
|
|
247
|
+
return formatFn(domainValue);
|
|
175
248
|
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
249
|
+
var longestLabelWidth = (0, exports.calculateLongestLabelWidth)(xAxisScale.ticks().map(tickFormat), '[class^="xAxis-"] text') + 40;
|
|
250
|
+
var _d = xAxisScale.range(), start = _d[0], end = _d[1];
|
|
251
|
+
tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
252
|
+
tickCount = Math.min(tickCount, xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : tickCount);
|
|
181
253
|
var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale)
|
|
182
254
|
.tickSize(xAxistickSize)
|
|
183
255
|
.tickPadding(tickPadding)
|
|
@@ -308,13 +380,12 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
308
380
|
exports.prepareDatapoints = prepareDatapoints;
|
|
309
381
|
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
310
382
|
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;
|
|
311
|
-
// maxOfYVal coming from
|
|
383
|
+
// maxOfYVal coming from horizontal bar chart with axis (Calculation done at base file)
|
|
312
384
|
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
313
385
|
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
314
386
|
var finalYmin = yMinMaxValues.startValue < yMinValue ? Math.min(0, yMinMaxValues.startValue) : yMinValue;
|
|
315
|
-
var yDomainPadding = Math.abs(finalYmax - finalYmin) * 0.1;
|
|
316
387
|
var yAxisScale = (0, d3_scale_1.scaleLinear)()
|
|
317
|
-
.domain([finalYmin
|
|
388
|
+
.domain([finalYmin, finalYmax])
|
|
318
389
|
.range([containerHeight - margins.bottom, margins.top]);
|
|
319
390
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
320
391
|
var yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
@@ -358,10 +429,13 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
358
429
|
* @param isRtl
|
|
359
430
|
*/
|
|
360
431
|
var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth) {
|
|
361
|
-
var containerHeight = yAxisParams.containerHeight, _a = yAxisParams.tickPadding, tickPadding = _a === void 0 ? 12 : _a, margins = yAxisParams.margins, yAxisTickFormat = yAxisParams.yAxisTickFormat, yAxisElement = yAxisParams.yAxisElement;
|
|
432
|
+
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;
|
|
433
|
+
var yAxisPaddingValue = yAxisPadding !== null && yAxisPadding !== void 0 ? yAxisPadding : 0.5;
|
|
434
|
+
yAxisPaddingValue = yAxisPaddingValue === 1 ? 0.99 : yAxisPaddingValue;
|
|
362
435
|
var yAxisScale = (0, d3_scale_1.scaleBand)()
|
|
363
436
|
.domain(dataPoints)
|
|
364
|
-
.range([containerHeight - margins.bottom
|
|
437
|
+
.range([containerHeight - margins.bottom, margins.top])
|
|
438
|
+
.padding(yAxisPaddingValue);
|
|
365
439
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
366
440
|
var yAxis = axis.tickPadding(tickPadding).ticks(dataPoints);
|
|
367
441
|
if (yAxisTickFormat) {
|