@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,11 +2,11 @@ var _a;
|
|
|
2
2
|
import { __assign, __spreadArray } from "tslib";
|
|
3
3
|
import { axisRight as d3AxisRight, axisBottom as d3AxisBottom, axisLeft as d3AxisLeft } from 'd3-axis';
|
|
4
4
|
import { max as d3Max, min as d3Min } from 'd3-array';
|
|
5
|
-
import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3ScaleUtc } from 'd3-scale';
|
|
5
|
+
import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3ScaleUtc, scaleTime as d3ScaleTime, } from 'd3-scale';
|
|
6
6
|
import { select as d3Select, selectAll as d3SelectAll } from 'd3-selection';
|
|
7
7
|
import { format as d3Format } from 'd3-format';
|
|
8
|
-
import { timeFormat as d3TimeFormat, timeFormatLocale as d3TimeFormatLocale, } from 'd3-time-format';
|
|
9
|
-
import { timeSecond as d3TimeSecond, timeMinute as d3TimeMinute, timeHour as d3TimeHour, timeDay as d3TimeDay, timeMonth as d3TimeMonth, timeWeek as d3TimeWeek, timeYear as d3TimeYear, } from 'd3-time';
|
|
8
|
+
import { timeFormat as d3TimeFormat, timeFormatLocale as d3TimeFormatLocale, utcFormat as d3UtcFormat, } from 'd3-time-format';
|
|
9
|
+
import { timeSecond as d3TimeSecond, timeMinute as d3TimeMinute, timeHour as d3TimeHour, timeDay as d3TimeDay, timeMonth as d3TimeMonth, timeWeek as d3TimeWeek, timeYear as d3TimeYear, utcSecond as d3UtcSecond, utcMinute as d3UtcMinute, utcHour as d3UtcHour, utcDay as d3UtcDay, utcMonth as d3UtcMonth, utcWeek as d3UtcWeek, utcYear as d3UtcYear, } from 'd3-time';
|
|
10
10
|
import { formatPrefix as d3FormatPrefix } from 'd3-format';
|
|
11
11
|
export var ChartTypes;
|
|
12
12
|
(function (ChartTypes) {
|
|
@@ -58,8 +58,8 @@ export function createNumericXAxis(xAxisParams, chartType, culture) {
|
|
|
58
58
|
var tickValues = xAxisScale.ticks(xAxisCount).map(xAxis.tickFormat());
|
|
59
59
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
60
60
|
}
|
|
61
|
-
function multiFormat(date, locale) {
|
|
62
|
-
var timeFormat = locale ? locale.format : d3TimeFormat;
|
|
61
|
+
function multiFormat(date, locale, useUTC) {
|
|
62
|
+
var timeFormat = locale ? (useUTC ? locale.utcFormat : locale.format) : useUTC ? d3UtcFormat : d3TimeFormat;
|
|
63
63
|
var formatMillisecond = timeFormat('.%L');
|
|
64
64
|
var formatSecond = timeFormat(':%S');
|
|
65
65
|
var formatMinute = timeFormat('%I:%M');
|
|
@@ -68,19 +68,26 @@ function multiFormat(date, locale) {
|
|
|
68
68
|
var formatWeek = timeFormat('%b %d');
|
|
69
69
|
var formatMonth = timeFormat('%B');
|
|
70
70
|
var formatYear = timeFormat('%Y');
|
|
71
|
-
|
|
71
|
+
var timeSecond = useUTC ? d3UtcSecond : d3TimeSecond;
|
|
72
|
+
var timeMinute = useUTC ? d3UtcMinute : d3TimeMinute;
|
|
73
|
+
var timeHour = useUTC ? d3UtcHour : d3TimeHour;
|
|
74
|
+
var timeDay = useUTC ? d3UtcDay : d3TimeDay;
|
|
75
|
+
var timeMonth = useUTC ? d3UtcMonth : d3TimeMonth;
|
|
76
|
+
var timeWeek = useUTC ? d3UtcWeek : d3TimeWeek;
|
|
77
|
+
var timeYear = useUTC ? d3UtcYear : d3TimeYear;
|
|
78
|
+
return (timeSecond(date) < date
|
|
72
79
|
? formatMillisecond
|
|
73
|
-
:
|
|
80
|
+
: timeMinute(date) < date
|
|
74
81
|
? formatSecond
|
|
75
|
-
:
|
|
82
|
+
: timeHour(date) < date
|
|
76
83
|
? formatMinute
|
|
77
|
-
:
|
|
84
|
+
: timeDay(date) < date
|
|
78
85
|
? formatHour
|
|
79
|
-
:
|
|
80
|
-
?
|
|
86
|
+
: timeMonth(date) < date
|
|
87
|
+
? timeWeek(date) < date
|
|
81
88
|
? formatDay
|
|
82
89
|
: formatWeek
|
|
83
|
-
:
|
|
90
|
+
: timeYear(date) < date
|
|
84
91
|
? formatMonth
|
|
85
92
|
: formatYear)(date);
|
|
86
93
|
}
|
|
@@ -90,10 +97,11 @@ function multiFormat(date, locale) {
|
|
|
90
97
|
* @param {IXAxisParams} xAxisParams
|
|
91
98
|
* @param {ITickParams} tickParams
|
|
92
99
|
*/
|
|
93
|
-
export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter) {
|
|
100
|
+
export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
|
|
94
101
|
var _a;
|
|
95
102
|
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;
|
|
96
|
-
var xAxisScale = d3ScaleUtc()
|
|
103
|
+
var xAxisScale = useUTC ? d3ScaleUtc() : d3ScaleTime();
|
|
104
|
+
xAxisScale
|
|
97
105
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
98
106
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
|
|
99
107
|
var xAxis = d3AxisBottom(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(xAxisCount);
|
|
@@ -110,12 +118,14 @@ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeF
|
|
|
110
118
|
else if (timeFormatLocale) {
|
|
111
119
|
var locale_1 = d3TimeFormatLocale(timeFormatLocale);
|
|
112
120
|
xAxis.tickFormat(function (domainValue, _index) {
|
|
113
|
-
return multiFormat(domainValue, locale_1);
|
|
121
|
+
return multiFormat(domainValue, locale_1, useUTC);
|
|
114
122
|
});
|
|
115
123
|
}
|
|
116
124
|
tickParams.tickValues ? xAxis.tickValues(tickParams.tickValues) : '';
|
|
117
125
|
if (culture === undefined) {
|
|
118
|
-
tickParams.tickFormat
|
|
126
|
+
tickParams.tickFormat
|
|
127
|
+
? xAxis.tickFormat(useUTC ? d3UtcFormat(tickParams.tickFormat) : d3TimeFormat(tickParams.tickFormat))
|
|
128
|
+
: '';
|
|
119
129
|
}
|
|
120
130
|
if (xAxisElement) {
|
|
121
131
|
d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
@@ -123,7 +133,7 @@ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeF
|
|
|
123
133
|
var tickValues = ((_a = tickParams.tickValues) !== null && _a !== void 0 ? _a : xAxisScale.ticks(xAxisCount)).map(function (val, idx) {
|
|
124
134
|
var tickFormat = xAxis.tickFormat();
|
|
125
135
|
// val is a Date object. So when the tick format is not set, format val as a string to calculate its width
|
|
126
|
-
return tickFormat ? tickFormat(val, idx) : multiFormat(val);
|
|
136
|
+
return tickFormat ? tickFormat(val, idx) : multiFormat(val, undefined, useUTC);
|
|
127
137
|
});
|
|
128
138
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
129
139
|
}
|
|
@@ -177,22 +187,7 @@ export function prepareDatapoints(maxVal, minVal, splitInto, isIntegralDataset)
|
|
|
177
187
|
}
|
|
178
188
|
return dataPointsArray;
|
|
179
189
|
}
|
|
180
|
-
|
|
181
|
-
* Creating Numeric Y axis of the chart
|
|
182
|
-
* @export
|
|
183
|
-
* @param {IYAxisParams} yAxisParams
|
|
184
|
-
* @param {boolean} isRtl
|
|
185
|
-
*/
|
|
186
|
-
export function createYAxis(yAxisParams, isRtl, axisData, chartType, barWidth, isIntegralDataset, useSecondaryYScale) {
|
|
187
|
-
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
188
|
-
switch (chartType) {
|
|
189
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
190
|
-
return createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth);
|
|
191
|
-
default:
|
|
192
|
-
return createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
export function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData, barWidth) {
|
|
190
|
+
export function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
196
191
|
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
192
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
198
193
|
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
@@ -207,7 +202,7 @@ export function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axi
|
|
|
207
202
|
yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
208
203
|
return yAxisScale;
|
|
209
204
|
}
|
|
210
|
-
export function
|
|
205
|
+
export function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale) {
|
|
211
206
|
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
212
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;
|
|
213
208
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
@@ -228,21 +223,13 @@ export function createYAxisForOtherCharts(yAxisParams, isRtl, axisData, isIntegr
|
|
|
228
223
|
axisData.yAxisDomainValues = domainValues;
|
|
229
224
|
return yAxisScale;
|
|
230
225
|
}
|
|
231
|
-
export var createStringYAxis = function (yAxisParams, dataPoints, isRtl, chartType, barWidth, culture) {
|
|
232
|
-
switch (chartType) {
|
|
233
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
234
|
-
return createStringYAxisForHorizontalBarChartWithAxis(yAxisParams, dataPoints, isRtl, barWidth, culture);
|
|
235
|
-
default:
|
|
236
|
-
return createStringYAxisForOtherCharts(yAxisParams, dataPoints, isRtl);
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
226
|
/**
|
|
240
227
|
* Creating String Y axis of the chart for Horizontal Bar Chart With Axis
|
|
241
228
|
* @param yAxisParams
|
|
242
229
|
* @param dataPoints
|
|
243
230
|
* @param isRtl
|
|
244
231
|
*/
|
|
245
|
-
export var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth
|
|
232
|
+
export var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParams, dataPoints, isRtl, barWidth) {
|
|
246
233
|
var containerHeight = yAxisParams.containerHeight, _a = yAxisParams.tickPadding, tickPadding = _a === void 0 ? 12 : _a, margins = yAxisParams.margins, yAxisTickFormat = yAxisParams.yAxisTickFormat, yAxisElement = yAxisParams.yAxisElement;
|
|
247
234
|
var yAxisScale = d3ScaleBand()
|
|
248
235
|
.domain(dataPoints)
|
|
@@ -261,7 +248,7 @@ export var createStringYAxisForHorizontalBarChartWithAxis = function (yAxisParam
|
|
|
261
248
|
* @param dataPoints
|
|
262
249
|
* @param isRtl
|
|
263
250
|
*/
|
|
264
|
-
export var
|
|
251
|
+
export var createStringYAxis = function (yAxisParams, dataPoints, isRtl) {
|
|
265
252
|
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;
|
|
266
253
|
var yAxisScale = d3ScaleBand()
|
|
267
254
|
.domain(dataPoints)
|
|
@@ -463,7 +450,7 @@ export function createWrapOfXLabels(wrapLabelProps) {
|
|
|
463
450
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
464
451
|
export function createYAxisLabels(node,
|
|
465
452
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
466
|
-
yAxis, noOfCharsToTruncate, truncateLabel,
|
|
453
|
+
yAxis, noOfCharsToTruncate, truncateLabel, isRtl) {
|
|
467
454
|
if (node === null) {
|
|
468
455
|
return;
|
|
469
456
|
}
|
|
@@ -754,70 +741,6 @@ export function domainRageOfVerticalNumeric(points, margins, containerWidth, isR
|
|
|
754
741
|
? { dStartValue: xMax, dEndValue: xMin, rStartValue: rMin, rEndValue: rMax }
|
|
755
742
|
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rMin, rEndValue: rMax };
|
|
756
743
|
}
|
|
757
|
-
/**
|
|
758
|
-
* For creating X axis, need to calculate x axis domain and range values from given points.
|
|
759
|
-
* This may vary based on chart type and type of x axis
|
|
760
|
-
* So, this method will define which method need to call based on chart type and axis type.
|
|
761
|
-
* @export
|
|
762
|
-
* @param {*} points
|
|
763
|
-
* @param {IMargins} margins
|
|
764
|
-
* @param {number} width
|
|
765
|
-
* @param {ChartTypes} chartType
|
|
766
|
-
* @param {boolean} isRTL
|
|
767
|
-
* @param {XAxisTypes} xAxisType
|
|
768
|
-
* @param {number} [barWidth]
|
|
769
|
-
* @returns {IDomainNRange}
|
|
770
|
-
*/
|
|
771
|
-
export function getDomainNRangeValues(
|
|
772
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
773
|
-
points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
|
|
774
|
-
var domainNRangeValue;
|
|
775
|
-
if (xAxisType === XAxisTypes.NumericAxis) {
|
|
776
|
-
switch (chartType) {
|
|
777
|
-
case ChartTypes.AreaChart:
|
|
778
|
-
case ChartTypes.LineChart:
|
|
779
|
-
domainNRangeValue = domainRangeOfNumericForAreaChart(points, margins, width, isRTL);
|
|
780
|
-
break;
|
|
781
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
782
|
-
domainNRangeValue = domainRangeOfVSBCNumeric(points, margins, width, isRTL, barWidth);
|
|
783
|
-
break;
|
|
784
|
-
case ChartTypes.VerticalBarChart:
|
|
785
|
-
domainNRangeValue = domainRageOfVerticalNumeric(points, margins, width, isRTL, barWidth);
|
|
786
|
-
break;
|
|
787
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
788
|
-
domainNRangeValue = domainRangeOfNumericForHorizontalBarChartWithAxis(points, margins, width, isRTL, shiftX);
|
|
789
|
-
break;
|
|
790
|
-
default:
|
|
791
|
-
domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
else if (xAxisType === XAxisTypes.DateAxis) {
|
|
795
|
-
switch (chartType) {
|
|
796
|
-
case ChartTypes.AreaChart:
|
|
797
|
-
case ChartTypes.LineChart:
|
|
798
|
-
case ChartTypes.VerticalBarChart:
|
|
799
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
800
|
-
domainNRangeValue = domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues, chartType, barWidth);
|
|
801
|
-
break;
|
|
802
|
-
default:
|
|
803
|
-
domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
else {
|
|
807
|
-
// String Axis type
|
|
808
|
-
switch (chartType) {
|
|
809
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
810
|
-
case ChartTypes.GroupedVerticalBarChart:
|
|
811
|
-
case ChartTypes.VerticalBarChart:
|
|
812
|
-
case ChartTypes.HeatMapChart:
|
|
813
|
-
domainNRangeValue = domainRangeOfXStringAxis(margins, width, isRTL);
|
|
814
|
-
break;
|
|
815
|
-
default:
|
|
816
|
-
domainNRangeValue = { dStartValue: 0, dEndValue: 0, rStartValue: 0, rEndValue: 0 };
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
return domainNRangeValue;
|
|
820
|
-
}
|
|
821
744
|
/**
|
|
822
745
|
* Calculating start and ending values of the Area chart and LineChart
|
|
823
746
|
* @export
|
|
@@ -896,40 +819,6 @@ export function findHBCWANumericMinMaxOfY(points, yAxisType) {
|
|
|
896
819
|
}
|
|
897
820
|
return { startValue: 0, endValue: 0 };
|
|
898
821
|
}
|
|
899
|
-
/**
|
|
900
|
-
* For creating Y axis, need to calculate y axis domain values from given points. This may vary based on chart type.
|
|
901
|
-
* So, this method will define which method need to call based on chart type to find out min and max values(For Domain).
|
|
902
|
-
* For grouped vertical bar chart, Calculating yMax value in the base file and sending as MaxOfYVal to cartesian.
|
|
903
|
-
* @export
|
|
904
|
-
* @param {*} points
|
|
905
|
-
* @param {ChartTypes} chartType
|
|
906
|
-
* @returns {{ startValue: number; endValue: number }}
|
|
907
|
-
*/
|
|
908
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
909
|
-
export function getMinMaxOfYAxis(
|
|
910
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
911
|
-
points, chartType, yAxisType) {
|
|
912
|
-
if (yAxisType === void 0) { yAxisType = YAxisType.NumericAxis; }
|
|
913
|
-
var minMaxValues;
|
|
914
|
-
switch (chartType) {
|
|
915
|
-
case ChartTypes.AreaChart:
|
|
916
|
-
case ChartTypes.LineChart:
|
|
917
|
-
minMaxValues = findNumericMinMaxOfY(points);
|
|
918
|
-
break;
|
|
919
|
-
case ChartTypes.VerticalStackedBarChart:
|
|
920
|
-
minMaxValues = findVSBCNumericMinMaxOfY(points);
|
|
921
|
-
break;
|
|
922
|
-
case ChartTypes.VerticalBarChart:
|
|
923
|
-
minMaxValues = findVerticalNumericMinMaxOfY(points);
|
|
924
|
-
break;
|
|
925
|
-
case ChartTypes.HorizontalBarChartWithAxis:
|
|
926
|
-
minMaxValues = findHBCWANumericMinMaxOfY(points, yAxisType);
|
|
927
|
-
break;
|
|
928
|
-
default:
|
|
929
|
-
minMaxValues = { startValue: 0, endValue: 0 };
|
|
930
|
-
}
|
|
931
|
-
return minMaxValues;
|
|
932
|
-
}
|
|
933
822
|
/**
|
|
934
823
|
* @param p string or number or Date
|
|
935
824
|
*
|
|
@@ -1156,4 +1045,8 @@ export var getScalePadding = function (prop, shorthandProp, defaultValue) {
|
|
|
1156
1045
|
export var isScalePaddingDefined = function (prop, shorthandProp) {
|
|
1157
1046
|
return typeof prop === 'number' || typeof shorthandProp === 'number';
|
|
1158
1047
|
};
|
|
1048
|
+
export var formatDate = function (date, useUTC) {
|
|
1049
|
+
var timeFormat = useUTC ? d3UtcFormat : d3TimeFormat;
|
|
1050
|
+
return timeFormat('%-e %b %Y, %H:%M')(date) + (useUTC ? ' GMT' : '');
|
|
1051
|
+
};
|
|
1159
1052
|
//# sourceMappingURL=utilities.js.map
|