@fluentui/react-charting 5.24.23 → 5.24.25
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 +37 -1
- package/CHANGELOG.md +21 -2
- package/dist/react-charting.d.ts +59 -1
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +10 -0
- package/lib/components/CommonComponents/CartesianChart.base.js +11 -5
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +16 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +167 -30
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.base.d.ts +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js +66 -13
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.d.ts +4 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +37 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/utilities.d.ts +17 -13
- package/lib/utilities/utilities.js +131 -17
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +11 -5
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +16 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +171 -35
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/FunnelChart/funnelGeometry.js +5 -6
- package/lib-amd/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib-amd/components/GaugeChart/GaugeChart.base.d.ts +1 -1
- package/lib-amd/components/ResponsiveContainer/withResponsiveContainer.js +1 -2
- package/lib-amd/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib-amd/components/SankeyChart/SankeyChart.base.js +4 -4
- package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +64 -11
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +4 -0
- package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-amd/index.d.ts +1 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +37 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/image-export-utils.js +2 -3
- package/lib-amd/utilities/image-export-utils.js.map +1 -1
- package/lib-amd/utilities/scatterpolar-utils.js +2 -3
- package/lib-amd/utilities/scatterpolar-utils.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +17 -13
- package/lib-amd/utilities/utilities.js +170 -54
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +11 -5
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +16 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +171 -34
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/funnelGeometry.js +5 -6
- package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.base.d.ts +1 -1
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js +1 -2
- package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +4 -4
- package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +64 -11
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +4 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +37 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js +2 -3
- package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
- package/lib-commonjs/utilities/scatterpolar-utils.js +2 -3
- package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +17 -13
- package/lib-commonjs/utilities/utilities.js +170 -55
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CommonComponents/CartesianChart.types.ts +19 -0
- package/src/components/ScatterChart/ScatterChart.types.ts +5 -0
|
@@ -2,9 +2,48 @@ 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.
|
|
5
|
+
exports.generateMonthlyTicks = exports.generateLinearTicks = exports.getRangeForScatterMarkerSize = exports.getScatterXDomainExtent = exports.isPlottable = exports.isValidDomainValue = exports.getDomainPaddingForMarkers = exports.getInvertedTextColor = exports.sortAxisCategories = exports.truncateString = exports.createMeasurementSpan = exports.isScalePaddingDefined = exports.getScalePadding = exports.getBarWidth = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.calculateLongestLabelWidth = exports.wrapContent = exports.DEFAULT_WRAP_WIDTH = exports.createStringYAxis = exports.createStringYAxisForHorizontalBarChartWithAxis = exports.YAxisType = exports.XAxisTypes = exports.ChartTypes = exports.DEFAULT_DATE_STRING = exports.MIN_DONUT_RADIUS = exports.MIN_DOMAIN_MARGIN = void 0;
|
|
6
|
+
exports.defaultYAxisTickFormatter = defaultYAxisTickFormatter;
|
|
7
|
+
exports.createNumericXAxis = createNumericXAxis;
|
|
8
|
+
exports.getDateFormatLevel = getDateFormatLevel;
|
|
9
|
+
exports.createDateXAxis = createDateXAxis;
|
|
10
|
+
exports.createStringXAxis = createStringXAxis;
|
|
11
|
+
exports.prepareDatapoints = prepareDatapoints;
|
|
12
|
+
exports.createYAxisForHorizontalBarChartWithAxis = createYAxisForHorizontalBarChartWithAxis;
|
|
13
|
+
exports.createNumericYAxis = createNumericYAxis;
|
|
14
|
+
exports.calloutData = calloutData;
|
|
15
|
+
exports.getUnique = getUnique;
|
|
16
|
+
exports.silceOrAppendToArray = silceOrAppendToArray;
|
|
17
|
+
exports.createWrapOfXLabels = createWrapOfXLabels;
|
|
18
|
+
exports.createYAxisLabels = createYAxisLabels;
|
|
19
|
+
exports.tooltipOfAxislabels = tooltipOfAxislabels;
|
|
20
|
+
exports.getXAxisType = getXAxisType;
|
|
21
|
+
exports.domainRangeOfNumericForAreaLineScatterCharts = domainRangeOfNumericForAreaLineScatterCharts;
|
|
22
|
+
exports.groupChartDataByYValue = groupChartDataByYValue;
|
|
23
|
+
exports.computeLongestBars = computeLongestBars;
|
|
24
|
+
exports.domainRangeOfNumericForHorizontalBarChartWithAxis = domainRangeOfNumericForHorizontalBarChartWithAxis;
|
|
25
|
+
exports.domainRangeOfXStringAxis = domainRangeOfXStringAxis;
|
|
26
|
+
exports.domainRangeOfVSBCNumeric = domainRangeOfVSBCNumeric;
|
|
27
|
+
exports.domainRangeOfDateForAreaLineScatterVerticalBarCharts = domainRangeOfDateForAreaLineScatterVerticalBarCharts;
|
|
28
|
+
exports.domainRageOfVerticalNumeric = domainRageOfVerticalNumeric;
|
|
29
|
+
exports.findNumericMinMaxOfY = findNumericMinMaxOfY;
|
|
30
|
+
exports.findVSBCNumericMinMaxOfY = findVSBCNumericMinMaxOfY;
|
|
31
|
+
exports.findVerticalNumericMinMaxOfY = findVerticalNumericMinMaxOfY;
|
|
32
|
+
exports.findHBCWANumericMinMaxOfY = findHBCWANumericMinMaxOfY;
|
|
33
|
+
exports.rotateXAxisLabels = rotateXAxisLabels;
|
|
34
|
+
exports.wrapTextInsideDonut = wrapTextInsideDonut;
|
|
35
|
+
exports.formatScientificLimitWidth = formatScientificLimitWidth;
|
|
36
|
+
exports.getSecureProps = getSecureProps;
|
|
37
|
+
exports.areArraysEqual = areArraysEqual;
|
|
38
|
+
exports.resolveCSSVariables = resolveCSSVariables;
|
|
39
|
+
exports.copyStyle = copyStyle;
|
|
40
|
+
exports.getCurveFactory = getCurveFactory;
|
|
41
|
+
exports.getContrastTextColor = getContrastTextColor;
|
|
42
|
+
exports.isScatterPolarSeries = isScatterPolarSeries;
|
|
43
|
+
exports.isTextMode = isTextMode;
|
|
6
44
|
exports.MIN_DOMAIN_MARGIN = 8;
|
|
7
45
|
exports.MIN_DONUT_RADIUS = 1;
|
|
46
|
+
exports.DEFAULT_DATE_STRING = '2000-01-01';
|
|
8
47
|
var ChartTypes;
|
|
9
48
|
(function (ChartTypes) {
|
|
10
49
|
ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
|
|
@@ -56,15 +95,13 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
56
95
|
function defaultYAxisTickFormatter(value) {
|
|
57
96
|
return yAxisTickFormatterInternal(value);
|
|
58
97
|
}
|
|
59
|
-
exports.defaultYAxisTickFormatter = defaultYAxisTickFormatter;
|
|
60
98
|
/**
|
|
61
99
|
* Create Numeric X axis
|
|
62
100
|
* @export
|
|
63
101
|
* @param {IXAxisParams} xAxisParams
|
|
64
102
|
*/
|
|
65
103
|
function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleType) {
|
|
66
|
-
var _a;
|
|
67
|
-
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, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth;
|
|
104
|
+
var domainNRangeValues = xAxisParams.domainNRangeValues, _a = xAxisParams.showRoundOffXTickValues, showRoundOffXTickValues = _a === void 0 ? true : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, _c = xAxisParams.tickPadding, tickPadding = _c === void 0 ? 10 : _c, xAxisCount = xAxisParams.xAxisCount, xAxisElement = xAxisParams.xAxisElement, hideTickOverlap = xAxisParams.hideTickOverlap, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickStep = xAxisParams.tickStep, tick0 = xAxisParams.tick0;
|
|
68
105
|
var xAxisScale = createNumericScale(scaleType)
|
|
69
106
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
70
107
|
.range([domainNRangeValues.rStartValue, domainNRangeValues.rEndValue]);
|
|
@@ -79,7 +116,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
79
116
|
};
|
|
80
117
|
if (hideTickOverlap && typeof xAxisCount === 'undefined') {
|
|
81
118
|
var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(function (v, i) { return tickFormat(v, i); })) + 20;
|
|
82
|
-
var
|
|
119
|
+
var _d = xAxisScale.range(), start = _d[0], end = _d[1];
|
|
83
120
|
tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
84
121
|
}
|
|
85
122
|
var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale)
|
|
@@ -90,16 +127,22 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
90
127
|
if ([ChartTypes.HorizontalBarChartWithAxis, ChartTypes.GanttChart].includes(chartType)) {
|
|
91
128
|
xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
|
|
92
129
|
}
|
|
130
|
+
var customTickValues;
|
|
93
131
|
if (tickParams.tickValues) {
|
|
94
|
-
|
|
132
|
+
customTickValues = tickParams.tickValues;
|
|
133
|
+
}
|
|
134
|
+
else if (tickStep) {
|
|
135
|
+
customTickValues = generateNumericTicks(scaleType, tickStep, tick0, xAxisScale.domain());
|
|
136
|
+
}
|
|
137
|
+
if (customTickValues) {
|
|
138
|
+
xAxis.tickValues(customTickValues);
|
|
95
139
|
}
|
|
96
140
|
if (xAxisElement) {
|
|
97
141
|
(0, d3_selection_1.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
98
142
|
}
|
|
99
|
-
var tickValues = (
|
|
143
|
+
var tickValues = (customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
100
144
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
101
145
|
}
|
|
102
|
-
exports.createNumericXAxis = createNumericXAxis;
|
|
103
146
|
/**
|
|
104
147
|
* This function returns a multilevel formatter for a given date range.
|
|
105
148
|
* It determines the appropriate date format to accommodate each tick value.
|
|
@@ -192,7 +235,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
192
235
|
});
|
|
193
236
|
return (_a = matchedFormat === null || matchedFormat === void 0 ? void 0 : matchedFormat.formatLevel) !== null && _a !== void 0 ? _a : 7;
|
|
194
237
|
}
|
|
195
|
-
exports.getDateFormatLevel = getDateFormatLevel;
|
|
196
238
|
function isPowerOf10(num) {
|
|
197
239
|
var roundedfinalYMax = (0, chart_utilities_1.handleFloatingPointPrecisionError)(num);
|
|
198
240
|
return Math.log10(roundedfinalYMax) % 1 === 0;
|
|
@@ -204,8 +246,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
204
246
|
* @param {ITickParams} tickParams
|
|
205
247
|
*/
|
|
206
248
|
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
|
|
207
|
-
var _a;
|
|
208
|
-
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, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth;
|
|
249
|
+
var domainNRangeValues = xAxisParams.domainNRangeValues, xAxisElement = xAxisParams.xAxisElement, _a = xAxisParams.tickPadding, tickPadding = _a === void 0 ? 6 : _a, _b = xAxisParams.xAxistickSize, xAxistickSize = _b === void 0 ? 6 : _b, xAxisCount = xAxisParams.xAxisCount, calcMaxLabelWidth = xAxisParams.calcMaxLabelWidth, tickStep = xAxisParams.tickStep, tick0 = xAxisParams.tick0;
|
|
209
250
|
var xAxisScale = useUTC ? (0, d3_scale_1.scaleUtc)() : (0, d3_scale_1.scaleTime)();
|
|
210
251
|
xAxisScale
|
|
211
252
|
.domain([domainNRangeValues.dStartValue, domainNRangeValues.dEndValue])
|
|
@@ -244,7 +285,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
244
285
|
return (0, chart_utilities_1.formatDateToLocaleString)(domainValue, culture, useUTC, false, formatOptions);
|
|
245
286
|
};
|
|
246
287
|
var longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 40;
|
|
247
|
-
var
|
|
288
|
+
var _c = xAxisScale.range(), start = _c[0], end = _c[1];
|
|
248
289
|
var maxPossibleTickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
249
290
|
tickCount = Math.min(maxPossibleTickCount, xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : tickCount);
|
|
250
291
|
var xAxis = (0, d3_axis_1.axisBottom)(xAxisScale)
|
|
@@ -255,14 +296,22 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
255
296
|
if ([ChartTypes.GanttChart].includes(chartType)) {
|
|
256
297
|
xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
|
|
257
298
|
}
|
|
258
|
-
|
|
299
|
+
var customTickValues;
|
|
300
|
+
if (tickParams.tickValues) {
|
|
301
|
+
customTickValues = tickParams.tickValues;
|
|
302
|
+
}
|
|
303
|
+
else if (tickStep) {
|
|
304
|
+
customTickValues = generateDateTicks(tickStep, tick0, xAxisScale.domain(), useUTC);
|
|
305
|
+
}
|
|
306
|
+
if (customTickValues) {
|
|
307
|
+
xAxis.tickValues(customTickValues);
|
|
308
|
+
}
|
|
259
309
|
if (xAxisElement) {
|
|
260
310
|
(0, d3_selection_1.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
261
311
|
}
|
|
262
|
-
var tickValues = (
|
|
312
|
+
var tickValues = (customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount)).map(xAxis.tickFormat());
|
|
263
313
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
264
314
|
}
|
|
265
|
-
exports.createDateXAxis = createDateXAxis;
|
|
266
315
|
/**
|
|
267
316
|
* Create String X axis
|
|
268
317
|
* Currently using for only Vetical stacked bar chart and grouped vertical bar chart
|
|
@@ -315,7 +364,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
315
364
|
}
|
|
316
365
|
return { xScale: xAxisScale, tickValues: tickValues };
|
|
317
366
|
}
|
|
318
|
-
exports.createStringXAxis = createStringXAxis;
|
|
319
367
|
/**
|
|
320
368
|
* This method is used to calculate the rounded tick values for the y-axis
|
|
321
369
|
* @param {number} minVal
|
|
@@ -377,9 +425,8 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
377
425
|
}
|
|
378
426
|
return dataPointsArray;
|
|
379
427
|
}
|
|
380
|
-
exports.prepareDatapoints = prepareDatapoints;
|
|
381
428
|
function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl) {
|
|
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;
|
|
429
|
+
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, tickValues = yAxisParams.tickValues, tickStep = yAxisParams.tickStep, tick0 = yAxisParams.tick0;
|
|
383
430
|
// maxOfYVal coming from horizontal bar chart with axis (Calculation done at base file)
|
|
384
431
|
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
385
432
|
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -390,15 +437,24 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
390
437
|
var axis = isRtl ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
391
438
|
var yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
|
|
392
439
|
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(defaultYAxisTickFormatter);
|
|
440
|
+
var customTickValues;
|
|
441
|
+
if (tickValues) {
|
|
442
|
+
customTickValues = tickValues;
|
|
443
|
+
}
|
|
444
|
+
else if (tickStep) {
|
|
445
|
+
customTickValues = generateNumericTicks(undefined, tickStep, tick0, yAxisScale.domain());
|
|
446
|
+
}
|
|
447
|
+
if (customTickValues) {
|
|
448
|
+
yAxis.tickValues(customTickValues);
|
|
449
|
+
}
|
|
393
450
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
394
451
|
return yAxisScale;
|
|
395
452
|
}
|
|
396
|
-
exports.createYAxisForHorizontalBarChartWithAxis = createYAxisForHorizontalBarChartWithAxis;
|
|
397
453
|
function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale, supportNegativeData, roundedTicks, scaleType) {
|
|
398
454
|
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
399
455
|
if (supportNegativeData === void 0) { supportNegativeData = false; }
|
|
400
456
|
if (roundedTicks === void 0) { roundedTicks = false; }
|
|
401
|
-
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;
|
|
457
|
+
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, tickValues = yAxisParams.tickValues, tickStep = yAxisParams.tickStep, tick0 = yAxisParams.tick0;
|
|
402
458
|
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
403
459
|
var tempVal = maxOfYVal || yMinMaxValues.endValue || 0;
|
|
404
460
|
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
@@ -425,8 +481,25 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
425
481
|
.range([containerHeight - margins.bottom, margins.top + (eventAnnotationProps ? eventLabelHeight : 0)]);
|
|
426
482
|
var axis = (!isRtl && useSecondaryYScale) || (isRtl && !useSecondaryYScale) ? (0, d3_axis_1.axisRight)(yAxisScale) : (0, d3_axis_1.axisLeft)(yAxisScale);
|
|
427
483
|
var yAxis = axis.tickPadding(tickPadding).tickSizeInner(-(containerWidth - margins.left - margins.right));
|
|
428
|
-
|
|
429
|
-
|
|
484
|
+
var customTickValues;
|
|
485
|
+
if (tickValues) {
|
|
486
|
+
customTickValues = tickValues;
|
|
487
|
+
}
|
|
488
|
+
else if (tickStep) {
|
|
489
|
+
customTickValues = generateNumericTicks(scaleType, tickStep, tick0, yAxisScale.domain());
|
|
490
|
+
}
|
|
491
|
+
if (customTickValues) {
|
|
492
|
+
yAxis.tickValues(customTickValues);
|
|
493
|
+
axisData.yAxisDomainValues = customTickValues;
|
|
494
|
+
}
|
|
495
|
+
else {
|
|
496
|
+
if (scaleType === 'log') {
|
|
497
|
+
axisData.yAxisDomainValues = yAxisScale.ticks();
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
yAxis.tickValues(domainValues);
|
|
501
|
+
axisData.yAxisDomainValues = domainValues;
|
|
502
|
+
}
|
|
430
503
|
}
|
|
431
504
|
var tickFormat = function (domainValue, index, defaultFormat) {
|
|
432
505
|
var value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
@@ -436,10 +509,8 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
436
509
|
? yAxis.tickFormat(yAxisTickFormat)
|
|
437
510
|
: yAxis.tickFormat(function (v, i) { return tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)); });
|
|
438
511
|
yAxisElement ? (0, d3_selection_1.select)(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
439
|
-
axisData.yAxisDomainValues = domainValues;
|
|
440
512
|
return yAxisScale;
|
|
441
513
|
}
|
|
442
|
-
exports.createNumericYAxis = createNumericYAxis;
|
|
443
514
|
/**
|
|
444
515
|
* Creating String Y axis of the chart for Horizontal Bar Chart With Axis
|
|
445
516
|
* @param yAxisParams
|
|
@@ -542,7 +613,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
542
613
|
});
|
|
543
614
|
return result;
|
|
544
615
|
}
|
|
545
|
-
exports.calloutData = calloutData;
|
|
546
616
|
function getUnique(arr, comp) {
|
|
547
617
|
var unique = arr
|
|
548
618
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -554,7 +624,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
554
624
|
.map(function (e) { return arr[e]; });
|
|
555
625
|
return unique;
|
|
556
626
|
}
|
|
557
|
-
exports.getUnique = getUnique;
|
|
558
627
|
/**
|
|
559
628
|
* This function takes two paramerter
|
|
560
629
|
* 1. an array of strings
|
|
@@ -576,7 +645,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
576
645
|
return array.slice(0, pos).concat(array.slice(pos + 1));
|
|
577
646
|
}
|
|
578
647
|
}
|
|
579
|
-
exports.silceOrAppendToArray = silceOrAppendToArray;
|
|
580
648
|
exports.DEFAULT_WRAP_WIDTH = 10;
|
|
581
649
|
/**
|
|
582
650
|
* This method used for wrapping of x axis labels (tick values).
|
|
@@ -666,7 +734,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
666
734
|
}
|
|
667
735
|
return removeVal > 0 ? removeVal : 0;
|
|
668
736
|
}
|
|
669
|
-
exports.createWrapOfXLabels = createWrapOfXLabels;
|
|
670
737
|
/**
|
|
671
738
|
* This method used for wrapping of y axis labels (tick values).
|
|
672
739
|
*/
|
|
@@ -719,7 +786,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
719
786
|
}
|
|
720
787
|
});
|
|
721
788
|
}
|
|
722
|
-
exports.createYAxisLabels = createYAxisLabels;
|
|
723
789
|
var wrapContent = function (content, id, maxWidth) {
|
|
724
790
|
var textElement = (0, d3_selection_1.select)("#".concat(id));
|
|
725
791
|
textElement.text(content);
|
|
@@ -804,7 +870,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
804
870
|
_loop_1(i);
|
|
805
871
|
}
|
|
806
872
|
}
|
|
807
|
-
exports.tooltipOfAxislabels = tooltipOfAxislabels;
|
|
808
873
|
/**
|
|
809
874
|
* Find the axis type of line chart and area chart from given data
|
|
810
875
|
* @param points
|
|
@@ -821,7 +886,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
821
886
|
}
|
|
822
887
|
return isXAxisDateType;
|
|
823
888
|
}
|
|
824
|
-
exports.getXAxisType = getXAxisType;
|
|
825
889
|
/**
|
|
826
890
|
* Calculates Domain and range values for Numeric X axis.
|
|
827
891
|
* This method calculates Area cart and line chart.
|
|
@@ -846,7 +910,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
846
910
|
? { dStartValue: isScatterPolar ? 1 : xMax, dEndValue: isScatterPolar ? -1 : xMin, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
847
911
|
: { dStartValue: isScatterPolar ? -1 : xMin, dEndValue: isScatterPolar ? 1 : xMax, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
848
912
|
}
|
|
849
|
-
exports.domainRangeOfNumericForAreaLineScatterCharts = domainRangeOfNumericForAreaLineScatterCharts;
|
|
850
913
|
/**
|
|
851
914
|
* Groups HorizontalBarChart With Axis data based on YValue
|
|
852
915
|
* Used for stacked case
|
|
@@ -864,7 +927,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
864
927
|
});
|
|
865
928
|
return Object.values(map);
|
|
866
929
|
}
|
|
867
|
-
exports.groupChartDataByYValue = groupChartDataByYValue;
|
|
868
930
|
/**
|
|
869
931
|
* Calculates maximum domain values for Numeric x axis for both positive and negative values
|
|
870
932
|
* works for Horizontal Bar Chart With axis
|
|
@@ -882,7 +944,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
882
944
|
});
|
|
883
945
|
return { longestPositiveBar: longestPositiveBar, longestNegativeBar: longestNegativeBar };
|
|
884
946
|
}
|
|
885
|
-
exports.computeLongestBars = computeLongestBars;
|
|
886
947
|
/**
|
|
887
948
|
* Calculates Domain and range values for Numeric X axis.
|
|
888
949
|
* This method calculates Horizontal Chart with Axis
|
|
@@ -903,7 +964,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
903
964
|
? { dStartValue: xMax, dEndValue: Math.min(xMin, X_ORIGIN), rStartValue: rMin, rEndValue: rMax }
|
|
904
965
|
: { dStartValue: Math.min(xMin, X_ORIGIN), dEndValue: xMax, rStartValue: rMin, rEndValue: rMax };
|
|
905
966
|
}
|
|
906
|
-
exports.domainRangeOfNumericForHorizontalBarChartWithAxis = domainRangeOfNumericForHorizontalBarChartWithAxis;
|
|
907
967
|
/**
|
|
908
968
|
* Calculates Range values of x Axis string axis
|
|
909
969
|
* For String axis, we need to give domain values (Not start and end array values)
|
|
@@ -922,7 +982,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
922
982
|
? { dStartValue: 0, dEndValue: 0, rStartValue: rMax, rEndValue: rMin }
|
|
923
983
|
: { dStartValue: 0, dEndValue: 0, rStartValue: rMin, rEndValue: rMax };
|
|
924
984
|
}
|
|
925
|
-
exports.domainRangeOfXStringAxis = domainRangeOfXStringAxis;
|
|
926
985
|
/**
|
|
927
986
|
* Calculate domain and range values to the Vertical stacked bar chart - For Numeric axis
|
|
928
987
|
* @export
|
|
@@ -942,7 +1001,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
942
1001
|
? { dStartValue: xMax, dEndValue: xMin, rStartValue: rMax, rEndValue: rMin }
|
|
943
1002
|
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rMax, rEndValue: rMin };
|
|
944
1003
|
}
|
|
945
|
-
exports.domainRangeOfVSBCNumeric = domainRangeOfVSBCNumeric;
|
|
946
1004
|
/**
|
|
947
1005
|
* Calculates Domain and range values for Date X axis.
|
|
948
1006
|
* This method calculates Bar chart.
|
|
@@ -985,7 +1043,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
985
1043
|
? { dStartValue: lDate, dEndValue: sDate, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
986
1044
|
: { dStartValue: sDate, dEndValue: lDate, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
987
1045
|
}
|
|
988
|
-
exports.domainRangeOfDateForAreaLineScatterVerticalBarCharts = domainRangeOfDateForAreaLineScatterVerticalBarCharts;
|
|
989
1046
|
/**
|
|
990
1047
|
* Calculate domain and range values to the Vertical bar chart - For Numeric axis
|
|
991
1048
|
* @export
|
|
@@ -1005,7 +1062,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1005
1062
|
? { dStartValue: xMax, dEndValue: xMin, rStartValue: rMin, rEndValue: rMax }
|
|
1006
1063
|
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rMin, rEndValue: rMax };
|
|
1007
1064
|
}
|
|
1008
|
-
exports.domainRageOfVerticalNumeric = domainRageOfVerticalNumeric;
|
|
1009
1065
|
/**
|
|
1010
1066
|
* Calculating start and ending values of the Area chart and LineChart
|
|
1011
1067
|
* @export
|
|
@@ -1028,7 +1084,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1028
1084
|
endValue: (0, d3_array_1.max)(values),
|
|
1029
1085
|
};
|
|
1030
1086
|
}
|
|
1031
|
-
exports.findNumericMinMaxOfY = findNumericMinMaxOfY;
|
|
1032
1087
|
/**
|
|
1033
1088
|
* Find the minimum and maximum values of the vertical stacked bar chart y axis data point. Used for create y axis.
|
|
1034
1089
|
* @export
|
|
@@ -1040,7 +1095,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1040
1095
|
var yMin = (0, d3_array_1.min)(dataset, function (point) { return point.y; });
|
|
1041
1096
|
return { startValue: yMin, endValue: yMax };
|
|
1042
1097
|
}
|
|
1043
|
-
exports.findVSBCNumericMinMaxOfY = findVSBCNumericMinMaxOfY;
|
|
1044
1098
|
/**
|
|
1045
1099
|
* Fins the min and max values of the vertical bar chart y axis data point.
|
|
1046
1100
|
* @export
|
|
@@ -1061,7 +1115,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1061
1115
|
});
|
|
1062
1116
|
return { startValue: (0, d3_array_1.min)(values), endValue: (0, d3_array_1.max)(values) };
|
|
1063
1117
|
}
|
|
1064
|
-
exports.findVerticalNumericMinMaxOfY = findVerticalNumericMinMaxOfY;
|
|
1065
1118
|
/**
|
|
1066
1119
|
* Fins the min and max values of the horizontal bar chart y axis data point.
|
|
1067
1120
|
* @export
|
|
@@ -1076,7 +1129,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1076
1129
|
}
|
|
1077
1130
|
return { startValue: 0, endValue: 0 };
|
|
1078
1131
|
}
|
|
1079
|
-
exports.findHBCWANumericMinMaxOfY = findHBCWANumericMinMaxOfY;
|
|
1080
1132
|
/**
|
|
1081
1133
|
* @param p string or number or Date
|
|
1082
1134
|
*
|
|
@@ -1213,7 +1265,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1213
1265
|
});
|
|
1214
1266
|
return Math.floor(maxHeight / 1.414); // Compute maxHeight/tanInverse(45) to get the vertical height of labels.
|
|
1215
1267
|
}
|
|
1216
|
-
exports.rotateXAxisLabels = rotateXAxisLabels;
|
|
1217
1268
|
function wrapTextInsideDonut(selectorClass, maxWidth) {
|
|
1218
1269
|
var idx = 0;
|
|
1219
1270
|
(0, d3_selection_1.selectAll)(".".concat(selectorClass)).each(function () {
|
|
@@ -1250,11 +1301,9 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1250
1301
|
idx += 1;
|
|
1251
1302
|
});
|
|
1252
1303
|
}
|
|
1253
|
-
exports.wrapTextInsideDonut = wrapTextInsideDonut;
|
|
1254
1304
|
function formatScientificLimitWidth(value) {
|
|
1255
1305
|
return yAxisTickFormatterInternal(value, true);
|
|
1256
1306
|
}
|
|
1257
|
-
exports.formatScientificLimitWidth = formatScientificLimitWidth;
|
|
1258
1307
|
var DEFAULT_BAR_WIDTH = 16;
|
|
1259
1308
|
var MIN_BAR_WIDTH = 1;
|
|
1260
1309
|
var getBarWidth = function (barWidthProp, maxBarWidthProp, adjustedValue, modeProp) {
|
|
@@ -1293,7 +1342,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1293
1342
|
var dangerouslySetInnerHTML = props.dangerouslySetInnerHTML, result = tslib_1.__rest(props, ["dangerouslySetInnerHTML"]);
|
|
1294
1343
|
return result;
|
|
1295
1344
|
}
|
|
1296
|
-
exports.getSecureProps = getSecureProps;
|
|
1297
1345
|
function areArraysEqual(arr1, arr2) {
|
|
1298
1346
|
if (arr1 === arr2) {
|
|
1299
1347
|
return true;
|
|
@@ -1311,7 +1359,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1311
1359
|
}
|
|
1312
1360
|
return true;
|
|
1313
1361
|
}
|
|
1314
|
-
exports.areArraysEqual = areArraysEqual;
|
|
1315
1362
|
var cssVarRegExp = /var\((--[a-zA-Z0-9\-]+)\)/g;
|
|
1316
1363
|
function resolveCSSVariables(chartContainer, styleRules) {
|
|
1317
1364
|
var containerStyles = getComputedStyle(chartContainer);
|
|
@@ -1319,7 +1366,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1319
1366
|
return containerStyles.getPropertyValue(group1);
|
|
1320
1367
|
});
|
|
1321
1368
|
}
|
|
1322
|
-
exports.resolveCSSVariables = resolveCSSVariables;
|
|
1323
1369
|
function copyStyle(properties, fromEl, toEl) {
|
|
1324
1370
|
var styles = getComputedStyle(fromEl);
|
|
1325
1371
|
if (Array.isArray(properties)) {
|
|
@@ -1334,7 +1380,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1334
1380
|
});
|
|
1335
1381
|
}
|
|
1336
1382
|
}
|
|
1337
|
-
exports.copyStyle = copyStyle;
|
|
1338
1383
|
var MEASUREMENT_SPAN_STYLE = {
|
|
1339
1384
|
position: 'absolute',
|
|
1340
1385
|
visibility: 'hidden',
|
|
@@ -1385,7 +1430,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1385
1430
|
return defaultFactory;
|
|
1386
1431
|
}
|
|
1387
1432
|
}
|
|
1388
|
-
exports.getCurveFactory = getCurveFactory;
|
|
1389
1433
|
var truncateString = function (str, maxLength, ellipsis) {
|
|
1390
1434
|
if (ellipsis === void 0) { ellipsis = '...'; }
|
|
1391
1435
|
if (str.length <= maxLength) {
|
|
@@ -1466,7 +1510,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1466
1510
|
}
|
|
1467
1511
|
return textColor;
|
|
1468
1512
|
}
|
|
1469
|
-
exports.getContrastTextColor = getContrastTextColor;
|
|
1470
1513
|
/**
|
|
1471
1514
|
* Utility function to check if an array of points is scatterpolar
|
|
1472
1515
|
* @param points - Array of chart points
|
|
@@ -1477,7 +1520,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1477
1520
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1478
1521
|
function (item) { var _a; return typeof ((_a = item.lineOptions) === null || _a === void 0 ? void 0 : _a.mode) === 'string' && item.lineOptions.mode === 'scatterpolar'; });
|
|
1479
1522
|
}
|
|
1480
|
-
exports.isScatterPolarSeries = isScatterPolarSeries;
|
|
1481
1523
|
/**
|
|
1482
1524
|
* Utility function to check if an array of points contains mode as 'text' only
|
|
1483
1525
|
* @param points - Array of chart points
|
|
@@ -1488,7 +1530,6 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1488
1530
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1489
1531
|
function (item) { var _a; return typeof ((_a = item.lineOptions) === null || _a === void 0 ? void 0 : _a.mode) === 'string' && item.lineOptions.mode === 'text'; });
|
|
1490
1532
|
}
|
|
1491
|
-
exports.isTextMode = isTextMode;
|
|
1492
1533
|
// TODO: Refactor to encapsulate the complete numeric scale creation logic here, including setting domain and range.
|
|
1493
1534
|
var createNumericScale = function (scaleType) {
|
|
1494
1535
|
if (scaleType === 'log') {
|
|
@@ -1567,5 +1608,80 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1567
1608
|
return Math.min(extraXPixels, extraYPixels);
|
|
1568
1609
|
};
|
|
1569
1610
|
exports.getRangeForScatterMarkerSize = getRangeForScatterMarkerSize;
|
|
1611
|
+
var generateLinearTicks = function (tick0, tickStep, scaleDomain) {
|
|
1612
|
+
var domainMin = (0, d3_array_1.min)(scaleDomain);
|
|
1613
|
+
var domainMax = (0, d3_array_1.max)(scaleDomain);
|
|
1614
|
+
var precision = Math.max((0, react_1.calculatePrecision)(tick0), (0, react_1.calculatePrecision)(tickStep));
|
|
1615
|
+
var start = Math.ceil((0, react_1.precisionRound)((domainMin - tick0) / tickStep, precision));
|
|
1616
|
+
var end = Math.floor((0, react_1.precisionRound)((domainMax - tick0) / tickStep, precision));
|
|
1617
|
+
var ticks = [];
|
|
1618
|
+
for (var i = start; i <= end; i++) {
|
|
1619
|
+
ticks.push((0, react_1.precisionRound)(tick0 + i * tickStep, precision));
|
|
1620
|
+
}
|
|
1621
|
+
return ticks;
|
|
1622
|
+
};
|
|
1623
|
+
exports.generateLinearTicks = generateLinearTicks;
|
|
1624
|
+
var generateMonthlyTicks = function (tick0, tickStepInMonths, scaleDomain, useUTC) {
|
|
1625
|
+
var domainMin = +(0, d3_array_1.min)(scaleDomain);
|
|
1626
|
+
var domainMax = +(0, d3_array_1.max)(scaleDomain);
|
|
1627
|
+
var getMonth = function (d) { return (useUTC ? d.getUTCMonth() : d.getMonth()); };
|
|
1628
|
+
var setMonth = function (d, month) { return (useUTC ? new Date(d.setUTCMonth(month)) : new Date(d.setMonth(month))); };
|
|
1629
|
+
// Find the earliest tick <= domainMin
|
|
1630
|
+
var start = 0;
|
|
1631
|
+
for (var firstTick = new Date(+tick0); +firstTick > domainMin;) {
|
|
1632
|
+
firstTick = setMonth(firstTick, getMonth(firstTick) - tickStepInMonths);
|
|
1633
|
+
start -= tickStepInMonths;
|
|
1634
|
+
}
|
|
1635
|
+
var baseMonth = getMonth(tick0);
|
|
1636
|
+
var ticks = [];
|
|
1637
|
+
// Generate ticks forward until domainMax
|
|
1638
|
+
for (var i = start;; i += tickStepInMonths) {
|
|
1639
|
+
var tickDate = setMonth(new Date(+tick0), baseMonth + i);
|
|
1640
|
+
// Handle month rollover (e.g., Jan 31 + 1 month → Mar 3 instead of Feb)
|
|
1641
|
+
if (getMonth(tickDate) !== (((baseMonth + i) % 12) + 12) % 12) {
|
|
1642
|
+
tickDate = useUTC ? new Date(tickDate.setUTCDate(0)) : new Date(tickDate.setDate(0));
|
|
1643
|
+
}
|
|
1644
|
+
if (+tickDate > domainMax) {
|
|
1645
|
+
break;
|
|
1646
|
+
}
|
|
1647
|
+
if (+tickDate >= domainMin) {
|
|
1648
|
+
ticks.push(tickDate);
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
return ticks;
|
|
1652
|
+
};
|
|
1653
|
+
exports.generateMonthlyTicks = generateMonthlyTicks;
|
|
1654
|
+
var generateNumericTicks = function (scaleType, tickStep, tick0, scaleDomain) {
|
|
1655
|
+
var refTick = typeof tick0 === 'number' ? tick0 : 0;
|
|
1656
|
+
if (scaleType === 'log') {
|
|
1657
|
+
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
1658
|
+
return (0, exports.generateLinearTicks)(refTick, tickStep, scaleDomain.map(function (d) { return Math.log10(d); })).map(function (t) { return Math.pow(10, t); });
|
|
1659
|
+
}
|
|
1660
|
+
if (typeof tickStep === 'string') {
|
|
1661
|
+
var prefix = tickStep[0];
|
|
1662
|
+
var num = (0, chart_utilities_1.isNumber)(tickStep.slice(1)) ? Number(tickStep.slice(1)) : 0;
|
|
1663
|
+
if (prefix === 'L' && num > 0) {
|
|
1664
|
+
return (0, exports.generateLinearTicks)(refTick, num, scaleDomain);
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
return;
|
|
1668
|
+
}
|
|
1669
|
+
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
1670
|
+
return (0, exports.generateLinearTicks)(refTick, tickStep, scaleDomain);
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
var generateDateTicks = function (tickStep, tick0, scaleDomain, useUTC) {
|
|
1674
|
+
var refTick = tick0 instanceof Date ? tick0 : new Date(exports.DEFAULT_DATE_STRING);
|
|
1675
|
+
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
1676
|
+
return (0, exports.generateLinearTicks)(+refTick, tickStep, scaleDomain.map(function (d) { return +d; })).map(function (t) { return new Date(t); });
|
|
1677
|
+
}
|
|
1678
|
+
if (typeof tickStep === 'string') {
|
|
1679
|
+
var prefix = tickStep[0];
|
|
1680
|
+
var num = (0, chart_utilities_1.isNumber)(tickStep.slice(1)) ? Number(tickStep.slice(1)) : 0;
|
|
1681
|
+
if (prefix === 'M' && num > 0 && num === Math.round(num)) {
|
|
1682
|
+
return (0, exports.generateMonthlyTicks)(refTick, num, scaleDomain, useUTC);
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1685
|
+
};
|
|
1570
1686
|
});
|
|
1571
1687
|
//# sourceMappingURL=utilities.js.map
|