@fluentui/react-charting 5.23.83 → 5.23.85
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 +55 -1
- package/CHANGELOG.md +24 -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/PlotlySchemaAdapter.js +10 -5
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/Arc/Arc.js +2 -2
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.base.js +3 -3
- package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +19 -9
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.base.js +2 -2
- package/lib/components/HorizontalBarChart/HorizontalBarChart.base.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/StackedBarChart/MultiStackedBarChart.base.js +2 -2
- package/lib/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +2 -2
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +2 -2
- 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 +8 -1
- package/lib/utilities/utilities.js +151 -51
- 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/PlotlySchemaAdapter.js +10 -5
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DonutChart/Arc/Arc.js +1 -1
- package/lib-amd/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-amd/components/GaugeChart/GaugeChart.base.js +2 -2
- package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +18 -8
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.js +1 -1
- package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.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/StackedBarChart/MultiStackedBarChart.base.js +1 -1
- package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +1 -1
- 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 +8 -1
- package/lib-amd/utilities/utilities.js +154 -53
- 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/PlotlySchemaAdapter.js +10 -5
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +1 -1
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +2 -2
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +1 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +18 -8
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.js +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.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/StackedBarChart/MultiStackedBarChart.base.js +1 -1
- package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +1 -1
- 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 +8 -1
- package/lib-commonjs/utilities/utilities.js +155 -54
- 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.
|
|
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";
|
|
@@ -25,6 +26,34 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
25
26
|
YAxisType[YAxisType["DateAxis"] = 1] = "DateAxis";
|
|
26
27
|
YAxisType[YAxisType["StringAxis"] = 2] = "StringAxis";
|
|
27
28
|
})(YAxisType || (exports.YAxisType = YAxisType = {}));
|
|
29
|
+
function yAxisTickFormatterInternal(value, limitWidth) {
|
|
30
|
+
if (limitWidth === void 0) { limitWidth = false; }
|
|
31
|
+
// Use SI format prefix with 2 decimal places without insignificant trailing zeros
|
|
32
|
+
var formatter = (0, d3_format_2.formatPrefix)('.2~', value);
|
|
33
|
+
if (Math.abs(value) < 1) {
|
|
34
|
+
// Don't use SI notation for small numbers as it is less readable
|
|
35
|
+
formatter = (0, d3_format_1.format)('.2~g');
|
|
36
|
+
}
|
|
37
|
+
else if (limitWidth && Math.abs(value) >= 1000) {
|
|
38
|
+
// If width is limited, use SI format prefix with 1 point precision
|
|
39
|
+
formatter = (0, d3_format_2.formatPrefix)('.1~', value);
|
|
40
|
+
}
|
|
41
|
+
var formattedValue = formatter(value);
|
|
42
|
+
// Replace 'G' with 'B' if the value is greater than 10^9 as it is a more common convention
|
|
43
|
+
if (Math.abs(value) >= 1e9) {
|
|
44
|
+
return formattedValue.replace('G', 'B');
|
|
45
|
+
}
|
|
46
|
+
return formattedValue;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Formatter for y axis ticks.
|
|
50
|
+
* @param value - The number to format.
|
|
51
|
+
* @returns The formatted string .
|
|
52
|
+
*/
|
|
53
|
+
function defaultYAxisTickFormatter(value) {
|
|
54
|
+
return yAxisTickFormatterInternal(value);
|
|
55
|
+
}
|
|
56
|
+
exports.defaultYAxisTickFormatter = defaultYAxisTickFormatter;
|
|
28
57
|
/**
|
|
29
58
|
* Create Numeric X axis
|
|
30
59
|
* @export
|
|
@@ -32,7 +61,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
32
61
|
*/
|
|
33
62
|
function createNumericXAxis(xAxisParams, tickParams, chartType, culture) {
|
|
34
63
|
var _a;
|
|
35
|
-
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;
|
|
36
65
|
var xAxisScale = (0, d3_scale_1.scaleLinear)()
|
|
37
66
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
38
67
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
|
|
@@ -68,16 +97,75 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
68
97
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
69
98
|
}
|
|
70
99
|
exports.createNumericXAxis = createNumericXAxis;
|
|
71
|
-
|
|
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) {
|
|
72
114
|
var timeFormat = locale ? (useUTC ? locale.utcFormat : locale.format) : useUTC ? d3_time_format_1.utcFormat : d3_time_format_1.timeFormat;
|
|
73
|
-
|
|
74
|
-
var
|
|
75
|
-
var
|
|
76
|
-
var
|
|
77
|
-
var
|
|
78
|
-
var
|
|
79
|
-
var
|
|
80
|
-
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;
|
|
81
169
|
var timeSecond = useUTC ? d3_time_1.utcSecond : d3_time_1.timeSecond;
|
|
82
170
|
var timeMinute = useUTC ? d3_time_1.utcMinute : d3_time_1.timeMinute;
|
|
83
171
|
var timeHour = useUTC ? d3_time_1.utcHour : d3_time_1.timeHour;
|
|
@@ -85,21 +173,21 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
85
173
|
var timeMonth = useUTC ? d3_time_1.utcMonth : d3_time_1.timeMonth;
|
|
86
174
|
var timeWeek = useUTC ? d3_time_1.utcWeek : d3_time_1.timeWeek;
|
|
87
175
|
var timeYear = useUTC ? d3_time_1.utcYear : d3_time_1.timeYear;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
: timeMinute(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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;
|
|
103
191
|
}
|
|
104
192
|
function isPowerOf10(num) {
|
|
105
193
|
var roundedfinalYMax = handleFloatingPointPrecisionError(num);
|
|
@@ -118,12 +206,26 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
118
206
|
*/
|
|
119
207
|
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
|
|
120
208
|
var _a;
|
|
121
|
-
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;
|
|
122
210
|
var xAxisScale = useUTC ? (0, d3_scale_1.scaleUtc)() : (0, d3_scale_1.scaleTime)();
|
|
123
211
|
xAxisScale
|
|
124
212
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
125
|
-
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue])
|
|
213
|
+
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue])
|
|
214
|
+
.nice();
|
|
126
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);
|
|
127
229
|
var tickFormat = function (domainValue, _index) {
|
|
128
230
|
if (customDateTimeFormatter) {
|
|
129
231
|
return customDateTimeFormatter(domainValue);
|
|
@@ -132,8 +234,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
132
234
|
return domainValue.toLocaleString(culture, options);
|
|
133
235
|
}
|
|
134
236
|
if (timeFormatLocale) {
|
|
135
|
-
|
|
136
|
-
return multiFormat(domainValue, locale, useUTC);
|
|
237
|
+
return formatFn(domainValue);
|
|
137
238
|
}
|
|
138
239
|
if (culture === undefined && tickParams.tickFormat) {
|
|
139
240
|
if (useUTC) {
|
|
@@ -143,13 +244,12 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
143
244
|
return (0, d3_time_format_1.timeFormat)(tickParams.tickFormat)(domainValue);
|
|
144
245
|
}
|
|
145
246
|
}
|
|
146
|
-
return
|
|
247
|
+
return formatFn(domainValue);
|
|
147
248
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
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);
|
|
153
253
|
var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale)
|
|
154
254
|
.tickSize(xAxistickSize)
|
|
155
255
|
.tickPadding(tickPadding)
|
|
@@ -280,17 +380,16 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
280
380
|
exports.prepareDatapoints = prepareDatapoints;
|
|
281
381
|
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
282
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;
|
|
283
|
-
// maxOfYVal coming from
|
|
383
|
+
// maxOfYVal coming from horizontal bar chart with axis (Calculation done at base file)
|
|
284
384
|
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
285
385
|
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
286
386
|
var finalYmin = yMinMaxValues.startValue < yMinValue ? Math.min(0, yMinMaxValues.startValue) : yMinValue;
|
|
287
|
-
var yDomainPadding = Math.abs(finalYmax - finalYmin) * 0.1;
|
|
288
387
|
var yAxisScale = (0, d3_scale_1.scaleLinear)()
|
|
289
|
-
.domain([finalYmin
|
|
388
|
+
.domain([finalYmin, finalYmax])
|
|
290
389
|
.range([containerHeight - margins.bottom, margins.top]);
|
|
291
390
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
292
391
|
var yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
293
|
-
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(
|
|
392
|
+
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(defaultYAxisTickFormatter);
|
|
294
393
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
295
394
|
return yAxisScale;
|
|
296
395
|
}
|
|
@@ -317,7 +416,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
317
416
|
.tickPadding(tickPadding)
|
|
318
417
|
.tickValues(domainValues)
|
|
319
418
|
.tickSizeInner(-(containerWidth - margins.left - margins.right));
|
|
320
|
-
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(
|
|
419
|
+
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(defaultYAxisTickFormatter);
|
|
321
420
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
322
421
|
axisData.yAxisDomainValues = domainValues;
|
|
323
422
|
return yAxisScale;
|
|
@@ -330,10 +429,13 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
330
429
|
* @param isRtl
|
|
331
430
|
*/
|
|
332
431
|
var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth) {
|
|
333
|
-
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;
|
|
334
435
|
var yAxisScale = (0, d3_scale_1.scaleBand)()
|
|
335
436
|
.domain(dataPoints)
|
|
336
|
-
.range([containerHeight - margins.bottom
|
|
437
|
+
.range([containerHeight - margins.bottom, margins.top])
|
|
438
|
+
.padding(yAxisPaddingValue);
|
|
337
439
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
338
440
|
var yAxis = axis.tickPadding(tickPadding).ticks(dataPoints);
|
|
339
441
|
if (yAxisTickFormat) {
|
|
@@ -1068,10 +1170,16 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1068
1170
|
}
|
|
1069
1171
|
culture = culture || undefined;
|
|
1070
1172
|
if (typeof data === 'number') {
|
|
1173
|
+
if (Math.abs(data) < 10000) {
|
|
1174
|
+
return data.toString();
|
|
1175
|
+
}
|
|
1071
1176
|
return data.toLocaleString(culture);
|
|
1072
1177
|
}
|
|
1073
1178
|
else if (typeof data === 'string' && !window.isNaN(Number(data))) {
|
|
1074
1179
|
var num = Number(data);
|
|
1180
|
+
if (Math.abs(num) < 10000) {
|
|
1181
|
+
return num.toString();
|
|
1182
|
+
}
|
|
1075
1183
|
return num.toLocaleString(culture);
|
|
1076
1184
|
}
|
|
1077
1185
|
else if (data instanceof Date) {
|
|
@@ -1157,17 +1265,10 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1157
1265
|
});
|
|
1158
1266
|
}
|
|
1159
1267
|
exports.wrapTextInsideDonut = wrapTextInsideDonut;
|
|
1160
|
-
function
|
|
1161
|
-
|
|
1162
|
-
if (value < 1000) {
|
|
1163
|
-
specifier = '.2~'; // upto 2 decimal places without insignificant trailing zeros
|
|
1164
|
-
}
|
|
1165
|
-
else {
|
|
1166
|
-
specifier = '.1'; // upto 1 decimal place
|
|
1167
|
-
}
|
|
1168
|
-
return (0, d3_format_2.formatPrefix)(specifier, value)(value);
|
|
1268
|
+
function formatValueLimitWidth(value) {
|
|
1269
|
+
return yAxisTickFormatterInternal(value, true);
|
|
1169
1270
|
}
|
|
1170
|
-
exports.
|
|
1271
|
+
exports.formatValueLimitWidth = formatValueLimitWidth;
|
|
1171
1272
|
var DEFAULT_BAR_WIDTH = 16;
|
|
1172
1273
|
var MIN_BAR_WIDTH = 1;
|
|
1173
1274
|
var getBarWidth = function (barWidthProp, maxBarWidthProp, adjustedValue, modeProp) {
|