@fluentui/react-charting 5.21.14 → 5.21.16
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 +39 -1
- package/CHANGELOG.md +20 -2
- package/dist/react-charting.d.ts +81 -0
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +13 -0
- package/lib/components/AreaChart/AreaChart.base.d.ts +2 -0
- package/lib/components/AreaChart/AreaChart.base.js +21 -5
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.js +9 -9
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +29 -2
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +15 -2
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.base.d.ts +2 -0
- package/lib/components/HeatMapChart/HeatMapChart.base.js +15 -2
- package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +1 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +12 -2
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/LineChart/LineChart.base.d.ts +1 -0
- package/lib/components/LineChart/LineChart.base.js +21 -7
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +1 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +27 -9
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +29 -7
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/utilities/utilities.d.ts +7 -42
- package/lib/utilities/utilities.js +36 -143
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/lib-amd/components/AreaChart/AreaChart.base.d.ts +2 -0
- package/lib-amd/components/AreaChart/AreaChart.base.js +20 -4
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +8 -8
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +29 -2
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +14 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.d.ts +2 -0
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +14 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +1 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +11 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/LineChart/LineChart.base.d.ts +1 -0
- package/lib-amd/components/LineChart/LineChart.base.js +20 -6
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +1 -0
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +25 -7
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -0
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +27 -5
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +7 -42
- package/lib-amd/utilities/utilities.js +37 -147
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-amd/version.js +1 -1
- package/lib-amd/version.js.map +1 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +2 -0
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +20 -4
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +8 -8
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +29 -2
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +14 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.d.ts +2 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +14 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +1 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +11 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.base.d.ts +1 -0
- package/lib-commonjs/components/LineChart/LineChart.base.js +20 -6
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +1 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +25 -7
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +27 -5
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +7 -42
- package/lib-commonjs/utilities/utilities.js +37 -147
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/version.js +1 -1
- package/lib-commonjs/version.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CommonComponents/CartesianChart.types.ts +71 -2
|
@@ -2,7 +2,7 @@ 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.isScalePaddingDefined = exports.getScalePadding = exports.getBarWidth = exports.formatValueWithSIPrefix = exports.wrapTextInsideDonut = exports.rotateXAxisLabels = exports.convertToLocaleString = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.
|
|
5
|
+
exports.formatDate = exports.isScalePaddingDefined = exports.getScalePadding = exports.getBarWidth = exports.formatValueWithSIPrefix = 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.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.YAxisType = exports.XAxisTypes = exports.ChartTypes = void 0;
|
|
6
6
|
var ChartTypes;
|
|
7
7
|
(function (ChartTypes) {
|
|
8
8
|
ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
|
|
@@ -54,8 +54,8 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
54
54
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
55
55
|
}
|
|
56
56
|
exports.createNumericXAxis = createNumericXAxis;
|
|
57
|
-
function multiFormat(date, locale) {
|
|
58
|
-
var timeFormat = locale ? locale.format : d3_time_format_1.timeFormat;
|
|
57
|
+
function multiFormat(date, locale, useUTC) {
|
|
58
|
+
var timeFormat = locale ? (useUTC ? locale.utcFormat : locale.format) : useUTC ? d3_time_format_1.utcFormat : d3_time_format_1.timeFormat;
|
|
59
59
|
var formatMillisecond = timeFormat('.%L');
|
|
60
60
|
var formatSecond = timeFormat(':%S');
|
|
61
61
|
var formatMinute = timeFormat('%I:%M');
|
|
@@ -64,19 +64,26 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
64
64
|
var formatWeek = timeFormat('%b %d');
|
|
65
65
|
var formatMonth = timeFormat('%B');
|
|
66
66
|
var formatYear = timeFormat('%Y');
|
|
67
|
-
|
|
67
|
+
var timeSecond = useUTC ? d3_time_1.utcSecond : d3_time_1.timeSecond;
|
|
68
|
+
var timeMinute = useUTC ? d3_time_1.utcMinute : d3_time_1.timeMinute;
|
|
69
|
+
var timeHour = useUTC ? d3_time_1.utcHour : d3_time_1.timeHour;
|
|
70
|
+
var timeDay = useUTC ? d3_time_1.utcDay : d3_time_1.timeDay;
|
|
71
|
+
var timeMonth = useUTC ? d3_time_1.utcMonth : d3_time_1.timeMonth;
|
|
72
|
+
var timeWeek = useUTC ? d3_time_1.utcWeek : d3_time_1.timeWeek;
|
|
73
|
+
var timeYear = useUTC ? d3_time_1.utcYear : d3_time_1.timeYear;
|
|
74
|
+
return (timeSecond(date) < date
|
|
68
75
|
? formatMillisecond
|
|
69
|
-
:
|
|
76
|
+
: timeMinute(date) < date
|
|
70
77
|
? formatSecond
|
|
71
|
-
:
|
|
78
|
+
: timeHour(date) < date
|
|
72
79
|
? formatMinute
|
|
73
|
-
:
|
|
80
|
+
: timeDay(date) < date
|
|
74
81
|
? formatHour
|
|
75
|
-
:
|
|
76
|
-
?
|
|
82
|
+
: timeMonth(date) < date
|
|
83
|
+
? timeWeek(date) < date
|
|
77
84
|
? formatDay
|
|
78
85
|
: formatWeek
|
|
79
|
-
:
|
|
86
|
+
: timeYear(date) < date
|
|
80
87
|
? formatMonth
|
|
81
88
|
: formatYear)(date);
|
|
82
89
|
}
|
|
@@ -86,10 +93,11 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
86
93
|
* @param {IXAxisParams} xAxisParams
|
|
87
94
|
* @param {ITickParams} tickParams
|
|
88
95
|
*/
|
|
89
|
-
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter) {
|
|
96
|
+
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
|
|
90
97
|
var _a;
|
|
91
98
|
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, _d = xAxisParams.xAxisCount, xAxisCount = _d === void 0 ? 6 : _d;
|
|
92
|
-
var xAxisScale = (0, d3_scale_1.scaleUtc)()
|
|
99
|
+
var xAxisScale = useUTC ? (0, d3_scale_1.scaleUtc)() : (0, d3_scale_1.scaleTime)();
|
|
100
|
+
xAxisScale
|
|
93
101
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
94
102
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
|
|
95
103
|
var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(xAxisCount);
|
|
@@ -106,12 +114,14 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
106
114
|
else if (timeFormatLocale) {
|
|
107
115
|
var locale_1 = (0, d3_time_format_1.timeFormatLocale)(timeFormatLocale);
|
|
108
116
|
xAxis.tickFormat(function (domainValue, _index) {
|
|
109
|
-
return multiFormat(domainValue, locale_1);
|
|
117
|
+
return multiFormat(domainValue, locale_1, useUTC);
|
|
110
118
|
});
|
|
111
119
|
}
|
|
112
120
|
tickParams.tickValues ? xAxis.tickValues(tickParams.tickValues) : '';
|
|
113
121
|
if (culture === undefined) {
|
|
114
|
-
tickParams.tickFormat
|
|
122
|
+
tickParams.tickFormat
|
|
123
|
+
? xAxis.tickFormat(useUTC ? (0, d3_time_format_1.utcFormat)(tickParams.tickFormat) : (0, d3_time_format_1.timeFormat)(tickParams.tickFormat))
|
|
124
|
+
: '';
|
|
115
125
|
}
|
|
116
126
|
if (xAxisElement) {
|
|
117
127
|
(0, d3_selection_1.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
@@ -119,7 +129,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
119
129
|
var tickValues = ((_a = tickParams.tickValues) !== null && _a !== void 0 ? _a : xAxisScale.ticks(xAxisCount)).map(function (val, idx) {
|
|
120
130
|
var tickFormat = xAxis.tickFormat();
|
|
121
131
|
// val is a Date object. So when the tick format is not set, format val as a string to calculate its width
|
|
122
|
-
return tickFormat ? tickFormat(val, idx) : multiFormat(val);
|
|
132
|
+
return tickFormat ? tickFormat(val, idx) : multiFormat(val, undefined, useUTC);
|
|
123
133
|
});
|
|
124
134
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
125
135
|
}
|
|
@@ -176,23 +186,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
176
186
|
return dataPointsArray;
|
|
177
187
|
}
|
|
178
188
|
exports.prepareDatapoints = prepareDatapoints;
|
|
179
|
-
|
|
180
|
-
* Creating Numeric Y axis of the chart
|
|
181
|
-
* @export
|
|
182
|
-
* @param {IYAxisParams} yAxisParams
|
|
183
|
-
* @param {boolean} isRtl
|
|
184
|
-
*/
|
|
185
|
-
function createYAxis(yAxisParams, isRtl, axisData, chartType, barWidth, isIntegralDataset, useSecondaryYScale) {
|
|
186
|
-
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
187
|
-
switch (chartType) {
|
|
188
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
189
|
-
return createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth);
|
|
190
|
-
default:
|
|
191
|
-
return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
exports.createYAxis = createYAxis;
|
|
195
|
-
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth) {
|
|
189
|
+
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
196
190
|
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;
|
|
197
191
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
198
192
|
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
@@ -208,7 +202,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
208
202
|
return yAxisScale;
|
|
209
203
|
}
|
|
210
204
|
exports.createYAxisForHorizontalBarChartWithAxis = createYAxisForHorizontalBarChartWithAxis;
|
|
211
|
-
function
|
|
205
|
+
function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale) {
|
|
212
206
|
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
213
207
|
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;
|
|
214
208
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
@@ -229,23 +223,14 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
229
223
|
axisData.yAxisDomainValues = domainValues;
|
|
230
224
|
return yAxisScale;
|
|
231
225
|
}
|
|
232
|
-
exports.
|
|
233
|
-
var createStringYAxis = function (yAxisParams, dataPoints, isRtl, chartType, barWidth, culture) {
|
|
234
|
-
switch (chartType) {
|
|
235
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
236
|
-
return (0, exports.createStringYAxisForHorizontalBarChartWithAxis)(yAxisParams, dataPoints, isRtl, barWidth, culture);
|
|
237
|
-
default:
|
|
238
|
-
return (0, exports.createStringYAxisForOtherCharts)(yAxisParams, dataPoints, isRtl);
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
exports.createStringYAxis = createStringYAxis;
|
|
226
|
+
exports.createNumericYAxis = createNumericYAxis;
|
|
242
227
|
/**
|
|
243
228
|
* Creating String Y axis of the chart for Horizontal Bar Chart With Axis
|
|
244
229
|
* @param yAxisParams
|
|
245
230
|
* @param dataPoints
|
|
246
231
|
* @param isRtl
|
|
247
232
|
*/
|
|
248
|
-
var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth
|
|
233
|
+
var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth) {
|
|
249
234
|
var containerHeight = yAxisParams.containerHeight, _a = yAxisParams.tickPadding, tickPadding = _a === void 0 ? 12 : _a, margins = yAxisParams.margins, yAxisTickFormat = yAxisParams.yAxisTickFormat, yAxisElement = yAxisParams.yAxisElement;
|
|
250
235
|
var yAxisScale = (0, d3_scale_1.scaleBand)()
|
|
251
236
|
.domain(dataPoints)
|
|
@@ -265,7 +250,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
265
250
|
* @param dataPoints
|
|
266
251
|
* @param isRtl
|
|
267
252
|
*/
|
|
268
|
-
var
|
|
253
|
+
var createStringYAxis = function (yAxisParams, dataPoints, isRtl) {
|
|
269
254
|
var containerHeight = yAxisParams.containerHeight, _a = yAxisParams.tickPadding, tickPadding = _a === void 0 ? 12 : _a, margins = yAxisParams.margins, yAxisTickFormat = yAxisParams.yAxisTickFormat, yAxisElement = yAxisParams.yAxisElement, _b = yAxisParams.yAxisPadding, yAxisPadding = _b === void 0 ? 0 : _b;
|
|
270
255
|
var yAxisScale = (0, d3_scale_1.scaleBand)()
|
|
271
256
|
.domain(dataPoints)
|
|
@@ -279,7 +264,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
279
264
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
280
265
|
return yAxisScale;
|
|
281
266
|
};
|
|
282
|
-
exports.
|
|
267
|
+
exports.createStringYAxis = createStringYAxis;
|
|
283
268
|
/**
|
|
284
269
|
* For area chart and line chart, while displaying stackCallout, Need to form a callout data object.
|
|
285
270
|
* This methos creates an object for those 2 charts.
|
|
@@ -472,7 +457,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
472
457
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
473
458
|
function createYAxisLabels(node,
|
|
474
459
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
475
|
-
yAxis, noOfCharsToTruncate, truncateLabel,
|
|
460
|
+
yAxis, noOfCharsToTruncate, truncateLabel, isRtl) {
|
|
476
461
|
if (node === null) {
|
|
477
462
|
return;
|
|
478
463
|
}
|
|
@@ -774,71 +759,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
774
759
|
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rMin, rEndValue: rMax };
|
|
775
760
|
}
|
|
776
761
|
exports.domainRageOfVerticalNumeric = domainRageOfVerticalNumeric;
|
|
777
|
-
/**
|
|
778
|
-
* For creating X axis, need to calculate x axis domain and range values from given points.
|
|
779
|
-
* This may vary based on chart type and type of x axis
|
|
780
|
-
* So, this method will define which method need to call based on chart type and axis type.
|
|
781
|
-
* @export
|
|
782
|
-
* @param {*} points
|
|
783
|
-
* @param {IMargins} margins
|
|
784
|
-
* @param {number} width
|
|
785
|
-
* @param {ChartTypes} chartType
|
|
786
|
-
* @param {boolean} isRTL
|
|
787
|
-
* @param {XAxisTypes} xAxisType
|
|
788
|
-
* @param {number} [barWidth]
|
|
789
|
-
* @returns {IDomainNRange}
|
|
790
|
-
*/
|
|
791
|
-
function getDomainNRangeValues(
|
|
792
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
793
|
-
points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
794
|
-
var domainNRangeValue;
|
|
795
|
-
if (xAxisType === XAxisTypes.NumericAxis) {
|
|
796
|
-
switch (chartType) {
|
|
797
|
-
case ChartTypes.AreaChart:
|
|
798
|
-
case ChartTypes.LineChart:
|
|
799
|
-
domainNRangeValue = domainRangeOfNumericForAreaChart(points, margins, width, isRTL);
|
|
800
|
-
break;
|
|
801
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
802
|
-
domainNRangeValue = domainRangeOfVSBCNumeric(points, margins, width, isRTL, barWidth);
|
|
803
|
-
break;
|
|
804
|
-
case ChartTypes.VerticalBarChart:
|
|
805
|
-
domainNRangeValue = domainRageOfVerticalNumeric(points, margins, width, isRTL, barWidth);
|
|
806
|
-
break;
|
|
807
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
808
|
-
domainNRangeValue = domainRangeOfNumericForHorizontalBarChartWithAxis(points, margins, width, isRTL, shiftX);
|
|
809
|
-
break;
|
|
810
|
-
default:
|
|
811
|
-
domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
else if (xAxisType === XAxisTypes.DateAxis) {
|
|
815
|
-
switch (chartType) {
|
|
816
|
-
case ChartTypes.AreaChart:
|
|
817
|
-
case ChartTypes.LineChart:
|
|
818
|
-
case ChartTypes.VerticalBarChart:
|
|
819
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
820
|
-
domainNRangeValue = domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
821
|
-
break;
|
|
822
|
-
default:
|
|
823
|
-
domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
else {
|
|
827
|
-
// String Axis type
|
|
828
|
-
switch (chartType) {
|
|
829
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
830
|
-
case ChartTypes.GroupedVerticalBarChart:
|
|
831
|
-
case ChartTypes.VerticalBarChart:
|
|
832
|
-
case ChartTypes.HeatMapChart:
|
|
833
|
-
domainNRangeValue = domainRangeOfXStringAxis(margins, width, isRTL);
|
|
834
|
-
break;
|
|
835
|
-
default:
|
|
836
|
-
domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
return domainNRangeValue;
|
|
840
|
-
}
|
|
841
|
-
exports.getDomainNRangeValues = getDomainNRangeValues;
|
|
842
762
|
/**
|
|
843
763
|
* Calculating start and ending values of the Area chart and LineChart
|
|
844
764
|
* @export
|
|
@@ -921,41 +841,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
921
841
|
return { startValue: 0, endValue: 0 };
|
|
922
842
|
}
|
|
923
843
|
exports.findHBCWANumericMinMaxOfY = findHBCWANumericMinMaxOfY;
|
|
924
|
-
/**
|
|
925
|
-
* For creating Y axis, need to calculate y axis domain values from given points. This may vary based on chart type.
|
|
926
|
-
* So, this method will define which method need to call based on chart type to find out min and max values(For Domain).
|
|
927
|
-
* For grouped vertical bar chart, Calculating yMax value in the base file and sending as MaxOfYVal to cartesian.
|
|
928
|
-
* @export
|
|
929
|
-
* @param {*} points
|
|
930
|
-
* @param {ChartTypes} chartType
|
|
931
|
-
* @returns {{ startValue: number; endValue: number }}
|
|
932
|
-
*/
|
|
933
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
934
|
-
function getMinMaxOfYAxis(
|
|
935
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
936
|
-
points, chartType, yAxisType) {
|
|
937
|
-
if (yAxisType === void 0) { yAxisType = YAxisType.NumericAxis; }
|
|
938
|
-
var minMaxValues;
|
|
939
|
-
switch (chartType) {
|
|
940
|
-
case ChartTypes.AreaChart:
|
|
941
|
-
case ChartTypes.LineChart:
|
|
942
|
-
minMaxValues = findNumericMinMaxOfY(points);
|
|
943
|
-
break;
|
|
944
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
945
|
-
minMaxValues = findVSBCNumericMinMaxOfY(points);
|
|
946
|
-
break;
|
|
947
|
-
case ChartTypes.VerticalBarChart:
|
|
948
|
-
minMaxValues = findVerticalNumericMinMaxOfY(points);
|
|
949
|
-
break;
|
|
950
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
951
|
-
minMaxValues = findHBCWANumericMinMaxOfY(points, yAxisType);
|
|
952
|
-
break;
|
|
953
|
-
default:
|
|
954
|
-
minMaxValues = { startValue: 0, endValue: 0 };
|
|
955
|
-
}
|
|
956
|
-
return minMaxValues;
|
|
957
|
-
}
|
|
958
|
-
exports.getMinMaxOfYAxis = getMinMaxOfYAxis;
|
|
959
844
|
/**
|
|
960
845
|
* @param p string or number or Date
|
|
961
846
|
*
|
|
@@ -1191,5 +1076,10 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1191
1076
|
return typeof prop === 'number' || typeof shorthandProp === 'number';
|
|
1192
1077
|
};
|
|
1193
1078
|
exports.isScalePaddingDefined = isScalePaddingDefined;
|
|
1079
|
+
var formatDate = function (date, useUTC) {
|
|
1080
|
+
var timeFormat = useUTC ? d3_time_format_1.utcFormat : d3_time_format_1.timeFormat;
|
|
1081
|
+
return timeFormat('%-e %b %Y, %H:%M')(date) + (useUTC ? ' GMT' : '');
|
|
1082
|
+
};
|
|
1083
|
+
exports.formatDate = formatDate;
|
|
1194
1084
|
});
|
|
1195
1085
|
//# sourceMappingURL=utilities.js.map
|