@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
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.
|
|
4
|
+
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;
|
|
5
5
|
var tslib_1 = require("tslib");
|
|
6
6
|
var d3_axis_1 = require("d3-axis");
|
|
7
7
|
var d3_array_1 = require("d3-array");
|
|
@@ -62,8 +62,8 @@ function createNumericXAxis(xAxisParams, chartType, culture) {
|
|
|
62
62
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
63
63
|
}
|
|
64
64
|
exports.createNumericXAxis = createNumericXAxis;
|
|
65
|
-
function multiFormat(date, locale) {
|
|
66
|
-
var timeFormat = locale ? locale.format : d3_time_format_1.timeFormat;
|
|
65
|
+
function multiFormat(date, locale, useUTC) {
|
|
66
|
+
var timeFormat = locale ? (useUTC ? locale.utcFormat : locale.format) : useUTC ? d3_time_format_1.utcFormat : d3_time_format_1.timeFormat;
|
|
67
67
|
var formatMillisecond = timeFormat('.%L');
|
|
68
68
|
var formatSecond = timeFormat(':%S');
|
|
69
69
|
var formatMinute = timeFormat('%I:%M');
|
|
@@ -72,19 +72,26 @@ function multiFormat(date, locale) {
|
|
|
72
72
|
var formatWeek = timeFormat('%b %d');
|
|
73
73
|
var formatMonth = timeFormat('%B');
|
|
74
74
|
var formatYear = timeFormat('%Y');
|
|
75
|
-
|
|
75
|
+
var timeSecond = useUTC ? d3_time_1.utcSecond : d3_time_1.timeSecond;
|
|
76
|
+
var timeMinute = useUTC ? d3_time_1.utcMinute : d3_time_1.timeMinute;
|
|
77
|
+
var timeHour = useUTC ? d3_time_1.utcHour : d3_time_1.timeHour;
|
|
78
|
+
var timeDay = useUTC ? d3_time_1.utcDay : d3_time_1.timeDay;
|
|
79
|
+
var timeMonth = useUTC ? d3_time_1.utcMonth : d3_time_1.timeMonth;
|
|
80
|
+
var timeWeek = useUTC ? d3_time_1.utcWeek : d3_time_1.timeWeek;
|
|
81
|
+
var timeYear = useUTC ? d3_time_1.utcYear : d3_time_1.timeYear;
|
|
82
|
+
return (timeSecond(date) < date
|
|
76
83
|
? formatMillisecond
|
|
77
|
-
:
|
|
84
|
+
: timeMinute(date) < date
|
|
78
85
|
? formatSecond
|
|
79
|
-
:
|
|
86
|
+
: timeHour(date) < date
|
|
80
87
|
? formatMinute
|
|
81
|
-
:
|
|
88
|
+
: timeDay(date) < date
|
|
82
89
|
? formatHour
|
|
83
|
-
:
|
|
84
|
-
?
|
|
90
|
+
: timeMonth(date) < date
|
|
91
|
+
? timeWeek(date) < date
|
|
85
92
|
? formatDay
|
|
86
93
|
: formatWeek
|
|
87
|
-
:
|
|
94
|
+
: timeYear(date) < date
|
|
88
95
|
? formatMonth
|
|
89
96
|
: formatYear)(date);
|
|
90
97
|
}
|
|
@@ -94,10 +101,11 @@ function multiFormat(date, locale) {
|
|
|
94
101
|
* @param {IXAxisParams} xAxisParams
|
|
95
102
|
* @param {ITickParams} tickParams
|
|
96
103
|
*/
|
|
97
|
-
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter) {
|
|
104
|
+
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
|
|
98
105
|
var _a;
|
|
99
106
|
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;
|
|
100
|
-
var xAxisScale = (0, d3_scale_1.scaleUtc)()
|
|
107
|
+
var xAxisScale = useUTC ? (0, d3_scale_1.scaleUtc)() : (0, d3_scale_1.scaleTime)();
|
|
108
|
+
xAxisScale
|
|
101
109
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
102
110
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
|
|
103
111
|
var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(xAxisCount);
|
|
@@ -114,12 +122,14 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
114
122
|
else if (timeFormatLocale) {
|
|
115
123
|
var locale_1 = (0, d3_time_format_1.timeFormatLocale)(timeFormatLocale);
|
|
116
124
|
xAxis.tickFormat(function (domainValue, _index) {
|
|
117
|
-
return multiFormat(domainValue, locale_1);
|
|
125
|
+
return multiFormat(domainValue, locale_1, useUTC);
|
|
118
126
|
});
|
|
119
127
|
}
|
|
120
128
|
tickParams.tickValues ? xAxis.tickValues(tickParams.tickValues) : '';
|
|
121
129
|
if (culture === undefined) {
|
|
122
|
-
tickParams.tickFormat
|
|
130
|
+
tickParams.tickFormat
|
|
131
|
+
? xAxis.tickFormat(useUTC ? (0, d3_time_format_1.utcFormat)(tickParams.tickFormat) : (0, d3_time_format_1.timeFormat)(tickParams.tickFormat))
|
|
132
|
+
: '';
|
|
123
133
|
}
|
|
124
134
|
if (xAxisElement) {
|
|
125
135
|
(0, d3_selection_1.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
@@ -127,7 +137,7 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
127
137
|
var tickValues = ((_a = tickParams.tickValues) !== null && _a !== void 0 ? _a : xAxisScale.ticks(xAxisCount)).map(function (val, idx) {
|
|
128
138
|
var tickFormat = xAxis.tickFormat();
|
|
129
139
|
// val is a Date object. So when the tick format is not set, format val as a string to calculate its width
|
|
130
|
-
return tickFormat ? tickFormat(val, idx) : multiFormat(val);
|
|
140
|
+
return tickFormat ? tickFormat(val, idx) : multiFormat(val, undefined, useUTC);
|
|
131
141
|
});
|
|
132
142
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
133
143
|
}
|
|
@@ -184,23 +194,7 @@ function prepareDatapoints(maxVal, minVal, splitInto, isIntegralDataset) {
|
|
|
184
194
|
return dataPointsArray;
|
|
185
195
|
}
|
|
186
196
|
exports.prepareDatapoints = prepareDatapoints;
|
|
187
|
-
|
|
188
|
-
* Creating Numeric Y axis of the chart
|
|
189
|
-
* @export
|
|
190
|
-
* @param {IYAxisParams} yAxisParams
|
|
191
|
-
* @param {boolean} isRtl
|
|
192
|
-
*/
|
|
193
|
-
function createYAxis(yAxisParams, isRtl, axisData, chartType, barWidth, isIntegralDataset, useSecondaryYScale) {
|
|
194
|
-
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
195
|
-
switch (chartType) {
|
|
196
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
197
|
-
return createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth);
|
|
198
|
-
default:
|
|
199
|
-
return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
exports.createYAxis = createYAxis;
|
|
203
|
-
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth) {
|
|
197
|
+
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
204
198
|
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;
|
|
205
199
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
206
200
|
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
@@ -216,7 +210,7 @@ function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData,
|
|
|
216
210
|
return yAxisScale;
|
|
217
211
|
}
|
|
218
212
|
exports.createYAxisForHorizontalBarChartWithAxis = createYAxisForHorizontalBarChartWithAxis;
|
|
219
|
-
function
|
|
213
|
+
function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale) {
|
|
220
214
|
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
221
215
|
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;
|
|
222
216
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
@@ -237,23 +231,14 @@ function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDatas
|
|
|
237
231
|
axisData.yAxisDomainValues = domainValues;
|
|
238
232
|
return yAxisScale;
|
|
239
233
|
}
|
|
240
|
-
exports.
|
|
241
|
-
var createStringYAxis = function (yAxisParams, dataPoints, isRtl, chartType, barWidth, culture) {
|
|
242
|
-
switch (chartType) {
|
|
243
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
244
|
-
return (0, exports.createStringYAxisForHorizontalBarChartWithAxis)(yAxisParams, dataPoints, isRtl, barWidth, culture);
|
|
245
|
-
default:
|
|
246
|
-
return (0, exports.createStringYAxisForOtherCharts)(yAxisParams, dataPoints, isRtl);
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
exports.createStringYAxis = createStringYAxis;
|
|
234
|
+
exports.createNumericYAxis = createNumericYAxis;
|
|
250
235
|
/**
|
|
251
236
|
* Creating String Y axis of the chart for Horizontal Bar Chart With Axis
|
|
252
237
|
* @param yAxisParams
|
|
253
238
|
* @param dataPoints
|
|
254
239
|
* @param isRtl
|
|
255
240
|
*/
|
|
256
|
-
var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth
|
|
241
|
+
var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth) {
|
|
257
242
|
var containerHeight = yAxisParams.containerHeight, _a = yAxisParams.tickPadding, tickPadding = _a === void 0 ? 12 : _a, margins = yAxisParams.margins, yAxisTickFormat = yAxisParams.yAxisTickFormat, yAxisElement = yAxisParams.yAxisElement;
|
|
258
243
|
var yAxisScale = (0, d3_scale_1.scaleBand)()
|
|
259
244
|
.domain(dataPoints)
|
|
@@ -273,7 +258,7 @@ exports.createStringYAxisForHorizontalBarChartWithAxis = createStringYAxisForHor
|
|
|
273
258
|
* @param dataPoints
|
|
274
259
|
* @param isRtl
|
|
275
260
|
*/
|
|
276
|
-
var
|
|
261
|
+
var createStringYAxis = function (yAxisParams, dataPoints, isRtl) {
|
|
277
262
|
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;
|
|
278
263
|
var yAxisScale = (0, d3_scale_1.scaleBand)()
|
|
279
264
|
.domain(dataPoints)
|
|
@@ -287,7 +272,7 @@ var createStringYAxisForOtherCharts = function (yAxisParams, dataPoints, isRtl)
|
|
|
287
272
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text') : '';
|
|
288
273
|
return yAxisScale;
|
|
289
274
|
};
|
|
290
|
-
exports.
|
|
275
|
+
exports.createStringYAxis = createStringYAxis;
|
|
291
276
|
/**
|
|
292
277
|
* For area chart and line chart, while displaying stackCallout, Need to form a callout data object.
|
|
293
278
|
* This methos creates an object for those 2 charts.
|
|
@@ -480,7 +465,7 @@ exports.createWrapOfXLabels = createWrapOfXLabels;
|
|
|
480
465
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
481
466
|
function createYAxisLabels(node,
|
|
482
467
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
483
|
-
yAxis, noOfCharsToTruncate, truncateLabel,
|
|
468
|
+
yAxis, noOfCharsToTruncate, truncateLabel, isRtl) {
|
|
484
469
|
if (node === null) {
|
|
485
470
|
return;
|
|
486
471
|
}
|
|
@@ -782,71 +767,6 @@ function domainRageOfVerticalNumeric(points, margins, containerWidth, isRTL, bar
|
|
|
782
767
|
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rMin, rEndValue: rMax };
|
|
783
768
|
}
|
|
784
769
|
exports.domainRageOfVerticalNumeric = domainRageOfVerticalNumeric;
|
|
785
|
-
/**
|
|
786
|
-
* For creating X axis, need to calculate x axis domain and range values from given points.
|
|
787
|
-
* This may vary based on chart type and type of x axis
|
|
788
|
-
* So, this method will define which method need to call based on chart type and axis type.
|
|
789
|
-
* @export
|
|
790
|
-
* @param {*} points
|
|
791
|
-
* @param {IMargins} margins
|
|
792
|
-
* @param {number} width
|
|
793
|
-
* @param {ChartTypes} chartType
|
|
794
|
-
* @param {boolean} isRTL
|
|
795
|
-
* @param {XAxisTypes} xAxisType
|
|
796
|
-
* @param {number} [barWidth]
|
|
797
|
-
* @returns {IDomainNRange}
|
|
798
|
-
*/
|
|
799
|
-
function getDomainNRangeValues(
|
|
800
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
801
|
-
points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
802
|
-
var domainNRangeValue;
|
|
803
|
-
if (xAxisType === XAxisTypes.NumericAxis) {
|
|
804
|
-
switch (chartType) {
|
|
805
|
-
case ChartTypes.AreaChart:
|
|
806
|
-
case ChartTypes.LineChart:
|
|
807
|
-
domainNRangeValue = domainRangeOfNumericForAreaChart(points, margins, width, isRTL);
|
|
808
|
-
break;
|
|
809
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
810
|
-
domainNRangeValue = domainRangeOfVSBCNumeric(points, margins, width, isRTL, barWidth);
|
|
811
|
-
break;
|
|
812
|
-
case ChartTypes.VerticalBarChart:
|
|
813
|
-
domainNRangeValue = domainRageOfVerticalNumeric(points, margins, width, isRTL, barWidth);
|
|
814
|
-
break;
|
|
815
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
816
|
-
domainNRangeValue = domainRangeOfNumericForHorizontalBarChartWithAxis(points, margins, width, isRTL, shiftX);
|
|
817
|
-
break;
|
|
818
|
-
default:
|
|
819
|
-
domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
else if (xAxisType === XAxisTypes.DateAxis) {
|
|
823
|
-
switch (chartType) {
|
|
824
|
-
case ChartTypes.AreaChart:
|
|
825
|
-
case ChartTypes.LineChart:
|
|
826
|
-
case ChartTypes.VerticalBarChart:
|
|
827
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
828
|
-
domainNRangeValue = domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
829
|
-
break;
|
|
830
|
-
default:
|
|
831
|
-
domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
else {
|
|
835
|
-
// String Axis type
|
|
836
|
-
switch (chartType) {
|
|
837
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
838
|
-
case ChartTypes.GroupedVerticalBarChart:
|
|
839
|
-
case ChartTypes.VerticalBarChart:
|
|
840
|
-
case ChartTypes.HeatMapChart:
|
|
841
|
-
domainNRangeValue = domainRangeOfXStringAxis(margins, width, isRTL);
|
|
842
|
-
break;
|
|
843
|
-
default:
|
|
844
|
-
domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
return domainNRangeValue;
|
|
848
|
-
}
|
|
849
|
-
exports.getDomainNRangeValues = getDomainNRangeValues;
|
|
850
770
|
/**
|
|
851
771
|
* Calculating start and ending values of the Area chart and LineChart
|
|
852
772
|
* @export
|
|
@@ -929,41 +849,6 @@ function findHBCWANumericMinMaxOfY(points, yAxisType) {
|
|
|
929
849
|
return { startValue: 0, endValue: 0 };
|
|
930
850
|
}
|
|
931
851
|
exports.findHBCWANumericMinMaxOfY = findHBCWANumericMinMaxOfY;
|
|
932
|
-
/**
|
|
933
|
-
* For creating Y axis, need to calculate y axis domain values from given points. This may vary based on chart type.
|
|
934
|
-
* So, this method will define which method need to call based on chart type to find out min and max values(For Domain).
|
|
935
|
-
* For grouped vertical bar chart, Calculating yMax value in the base file and sending as MaxOfYVal to cartesian.
|
|
936
|
-
* @export
|
|
937
|
-
* @param {*} points
|
|
938
|
-
* @param {ChartTypes} chartType
|
|
939
|
-
* @returns {{ startValue: number; endValue: number }}
|
|
940
|
-
*/
|
|
941
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
942
|
-
function getMinMaxOfYAxis(
|
|
943
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
944
|
-
points, chartType, yAxisType) {
|
|
945
|
-
if (yAxisType === void 0) { yAxisType = YAxisType.NumericAxis; }
|
|
946
|
-
var minMaxValues;
|
|
947
|
-
switch (chartType) {
|
|
948
|
-
case ChartTypes.AreaChart:
|
|
949
|
-
case ChartTypes.LineChart:
|
|
950
|
-
minMaxValues = findNumericMinMaxOfY(points);
|
|
951
|
-
break;
|
|
952
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
953
|
-
minMaxValues = findVSBCNumericMinMaxOfY(points);
|
|
954
|
-
break;
|
|
955
|
-
case ChartTypes.VerticalBarChart:
|
|
956
|
-
minMaxValues = findVerticalNumericMinMaxOfY(points);
|
|
957
|
-
break;
|
|
958
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
959
|
-
minMaxValues = findHBCWANumericMinMaxOfY(points, yAxisType);
|
|
960
|
-
break;
|
|
961
|
-
default:
|
|
962
|
-
minMaxValues = { startValue: 0, endValue: 0 };
|
|
963
|
-
}
|
|
964
|
-
return minMaxValues;
|
|
965
|
-
}
|
|
966
|
-
exports.getMinMaxOfYAxis = getMinMaxOfYAxis;
|
|
967
852
|
/**
|
|
968
853
|
* @param p string or number or Date
|
|
969
854
|
*
|
|
@@ -1199,4 +1084,9 @@ var isScalePaddingDefined = function (prop, shorthandProp) {
|
|
|
1199
1084
|
return typeof prop === 'number' || typeof shorthandProp === 'number';
|
|
1200
1085
|
};
|
|
1201
1086
|
exports.isScalePaddingDefined = isScalePaddingDefined;
|
|
1087
|
+
var formatDate = function (date, useUTC) {
|
|
1088
|
+
var timeFormat = useUTC ? d3_time_format_1.utcFormat : d3_time_format_1.timeFormat;
|
|
1089
|
+
return timeFormat('%-e %b %Y, %H:%M')(date) + (useUTC ? ' GMT' : '');
|
|
1090
|
+
};
|
|
1091
|
+
exports.formatDate = formatDate;
|
|
1202
1092
|
//# sourceMappingURL=utilities.js.map
|