@fluentui/react-charting 5.24.11 → 5.24.13
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 +61 -1
- package/CHANGELOG.md +25 -2
- package/bundle-size/GanttChart.fixture.js +7 -0
- package/dist/react-charting.d.ts +128 -3
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +44 -2
- package/lib/GanttChart.d.ts +1 -0
- package/lib/GanttChart.js +2 -0
- package/lib/GanttChart.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.base.js +2 -1
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +3 -3
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +22 -4
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +23 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +173 -63
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.base.d.ts +3 -0
- package/lib/components/GanttChart/GanttChart.base.js +329 -0
- package/lib/components/GanttChart/GanttChart.base.js.map +1 -0
- package/lib/components/GanttChart/GanttChart.d.ts +7 -0
- package/lib/components/GanttChart/GanttChart.js +10 -0
- package/lib/components/GanttChart/GanttChart.js.map +1 -0
- package/lib/components/GanttChart/GanttChart.styles.d.ts +2 -0
- package/lib/components/GanttChart/GanttChart.styles.js +4 -0
- package/lib/components/GanttChart/GanttChart.styles.js.map +1 -0
- package/lib/components/GanttChart/GanttChart.types.d.ts +67 -0
- package/lib/components/GanttChart/GanttChart.types.js +2 -0
- package/lib/components/GanttChart/GanttChart.types.js.map +1 -0
- package/lib/components/GanttChart/index.d.ts +2 -0
- package/lib/components/GanttChart/index.js +3 -0
- package/lib/components/GanttChart/index.js.map +1 -0
- package/lib/components/LineChart/LineChart.base.d.ts +1 -0
- package/lib/components/LineChart/LineChart.base.js +34 -11
- package/lib/components/LineChart/LineChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.js +37 -23
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +49 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/scatterpolar-utils.d.ts +22 -0
- package/lib/utilities/scatterpolar-utils.js +38 -0
- package/lib/utilities/scatterpolar-utils.js.map +1 -0
- package/lib/utilities/test-data.d.ts +4 -1
- package/lib/utilities/test-data.js +213 -0
- package/lib/utilities/test-data.js.map +1 -1
- package/lib/utilities/utilities.d.ts +14 -6
- package/lib/utilities/utilities.js +25 -9
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/GanttChart.d.ts +1 -0
- package/lib-amd/GanttChart.js +6 -0
- package/lib-amd/GanttChart.js.map +1 -0
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +2 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +3 -3
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +22 -5
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +25 -2
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +173 -62
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/GanttChart/GanttChart.base.d.ts +3 -0
- package/lib-amd/components/GanttChart/GanttChart.base.js +325 -0
- package/lib-amd/components/GanttChart/GanttChart.base.js.map +1 -0
- package/lib-amd/components/GanttChart/GanttChart.d.ts +7 -0
- package/lib-amd/components/GanttChart/GanttChart.js +12 -0
- package/lib-amd/components/GanttChart/GanttChart.js.map +1 -0
- package/lib-amd/components/GanttChart/GanttChart.styles.d.ts +2 -0
- package/lib-amd/components/GanttChart/GanttChart.styles.js +10 -0
- package/lib-amd/components/GanttChart/GanttChart.styles.js.map +1 -0
- package/lib-amd/components/GanttChart/GanttChart.types.d.ts +67 -0
- package/lib-amd/components/GanttChart/GanttChart.types.js +5 -0
- package/lib-amd/components/GanttChart/GanttChart.types.js.map +1 -0
- package/lib-amd/components/GanttChart/index.d.ts +2 -0
- package/lib-amd/components/GanttChart/index.js +7 -0
- package/lib-amd/components/GanttChart/index.js.map +1 -0
- package/lib-amd/components/LineChart/LineChart.base.d.ts +1 -0
- package/lib-amd/components/LineChart/LineChart.base.js +33 -11
- package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +36 -23
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/index.d.ts +3 -1
- package/lib-amd/index.js +3 -2
- package/lib-amd/index.js.map +1 -1
- package/lib-amd/types/IDataPoint.d.ts +49 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/scatterpolar-utils.d.ts +22 -0
- package/lib-amd/utilities/scatterpolar-utils.js +43 -0
- package/lib-amd/utilities/scatterpolar-utils.js.map +1 -0
- package/lib-amd/utilities/test-data.d.ts +4 -1
- package/lib-amd/utilities/test-data.js +214 -2
- package/lib-amd/utilities/test-data.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +14 -6
- package/lib-amd/utilities/utilities.js +27 -9
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/GanttChart.d.ts +1 -0
- package/lib-commonjs/GanttChart.js +5 -0
- package/lib-commonjs/GanttChart.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +2 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +3 -3
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +23 -5
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.d.ts +2 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +25 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +2 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +173 -62
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.base.d.ts +3 -0
- package/lib-commonjs/components/GanttChart/GanttChart.base.js +332 -0
- package/lib-commonjs/components/GanttChart/GanttChart.base.js.map +1 -0
- package/lib-commonjs/components/GanttChart/GanttChart.d.ts +7 -0
- package/lib-commonjs/components/GanttChart/GanttChart.js +13 -0
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -0
- package/lib-commonjs/components/GanttChart/GanttChart.styles.d.ts +2 -0
- package/lib-commonjs/components/GanttChart/GanttChart.styles.js +8 -0
- package/lib-commonjs/components/GanttChart/GanttChart.styles.js.map +1 -0
- package/lib-commonjs/components/GanttChart/GanttChart.types.d.ts +67 -0
- package/lib-commonjs/components/GanttChart/GanttChart.types.js +3 -0
- package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +1 -0
- package/lib-commonjs/components/GanttChart/index.d.ts +2 -0
- package/lib-commonjs/components/GanttChart/index.js +6 -0
- package/lib-commonjs/components/GanttChart/index.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.base.d.ts +1 -0
- package/lib-commonjs/components/LineChart/LineChart.base.js +33 -10
- package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +36 -22
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/index.d.ts +3 -1
- package/lib-commonjs/index.js +3 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/IDataPoint.d.ts +49 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/scatterpolar-utils.d.ts +22 -0
- package/lib-commonjs/utilities/scatterpolar-utils.js +42 -0
- package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -0
- package/lib-commonjs/utilities/test-data.d.ts +4 -1
- package/lib-commonjs/utilities/test-data.js +214 -1
- package/lib-commonjs/utilities/test-data.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +14 -6
- package/lib-commonjs/utilities/utilities.js +28 -10
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CommonComponents/CartesianChart.types.ts +5 -2
- package/src/components/GanttChart/GanttChart.types.ts +83 -0
|
@@ -24,6 +24,7 @@ export var ChartTypes;
|
|
|
24
24
|
ChartTypes[ChartTypes["HeatMapChart"] = 5] = "HeatMapChart";
|
|
25
25
|
ChartTypes[ChartTypes["HorizontalBarChartWithAxis"] = 6] = "HorizontalBarChartWithAxis";
|
|
26
26
|
ChartTypes[ChartTypes["ScatterChart"] = 7] = "ScatterChart";
|
|
27
|
+
ChartTypes[ChartTypes["GanttChart"] = 8] = "GanttChart";
|
|
27
28
|
})(ChartTypes || (ChartTypes = {}));
|
|
28
29
|
export var XAxisTypes;
|
|
29
30
|
(function (XAxisTypes) {
|
|
@@ -94,7 +95,7 @@ export function createNumericXAxis(xAxisParams, tickParams, chartType, culture)
|
|
|
94
95
|
.tickPadding(tickPadding)
|
|
95
96
|
.ticks(tickCount)
|
|
96
97
|
.tickFormat(tickFormat);
|
|
97
|
-
if (
|
|
98
|
+
if ([ChartTypes.HorizontalBarChartWithAxis, ChartTypes.GanttChart].includes(chartType)) {
|
|
98
99
|
xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
|
|
99
100
|
}
|
|
100
101
|
if (tickParams.tickValues) {
|
|
@@ -173,7 +174,7 @@ function getMultiLevelD3DateFormatter(startLevel, endLevel, locale, useUTC) {
|
|
|
173
174
|
var formatter = timeFormat(MULTI_LEVEL_DATE_TIME_FORMATS[startLevel][endLevel]);
|
|
174
175
|
return formatter;
|
|
175
176
|
}
|
|
176
|
-
function getDateFormatLevel(date, useUTC) {
|
|
177
|
+
export function getDateFormatLevel(date, useUTC) {
|
|
177
178
|
var _a;
|
|
178
179
|
var timeSecond = useUTC ? d3UtcSecond : d3TimeSecond;
|
|
179
180
|
var timeMinute = useUTC ? d3UtcMinute : d3TimeMinute;
|
|
@@ -208,7 +209,7 @@ function isPowerOf10(num) {
|
|
|
208
209
|
* @param {IXAxisParams} xAxisParams
|
|
209
210
|
* @param {ITickParams} tickParams
|
|
210
211
|
*/
|
|
211
|
-
export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC) {
|
|
212
|
+
export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
|
|
212
213
|
var _a;
|
|
213
214
|
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;
|
|
214
215
|
var xAxisScale = useUTC ? d3ScaleUtc() : d3ScaleTime();
|
|
@@ -257,6 +258,9 @@ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeF
|
|
|
257
258
|
.tickPadding(tickPadding)
|
|
258
259
|
.ticks(tickCount)
|
|
259
260
|
.tickFormat(tickFormat);
|
|
261
|
+
if ([ChartTypes.GanttChart].includes(chartType)) {
|
|
262
|
+
xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
|
|
263
|
+
}
|
|
260
264
|
tickParams.tickValues ? xAxis.tickValues(tickParams.tickValues) : '';
|
|
261
265
|
if (xAxisElement) {
|
|
262
266
|
d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
@@ -801,6 +805,7 @@ export function getXAxisType(points) {
|
|
|
801
805
|
* @returns {IDomainNRange}
|
|
802
806
|
*/
|
|
803
807
|
export function domainRangeOfNumericForAreaChart(points, margins, width, isRTL) {
|
|
808
|
+
var isScatterPolar = isScatterPolarSeries(points);
|
|
804
809
|
var xMin = d3Min(points, function (point) {
|
|
805
810
|
return d3Min(point.data, function (item) { return item.x; });
|
|
806
811
|
});
|
|
@@ -812,8 +817,8 @@ export function domainRangeOfNumericForAreaChart(points, margins, width, isRTL)
|
|
|
812
817
|
var rStartValue = margins.left;
|
|
813
818
|
var rEndValue = width - margins.right;
|
|
814
819
|
return isRTL
|
|
815
|
-
? { dStartValue: xMax, dEndValue: xMin, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
816
|
-
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
820
|
+
? { dStartValue: isScatterPolar ? 1 : xMax, dEndValue: isScatterPolar ? -1 : xMin, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
821
|
+
: { dStartValue: isScatterPolar ? -1 : xMin, dEndValue: isScatterPolar ? 1 : xMax, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
817
822
|
}
|
|
818
823
|
/**
|
|
819
824
|
* Groups HorizontalBarChart With Axis data based on YValue
|
|
@@ -1024,9 +1029,9 @@ export function findVerticalNumericMinMaxOfY(points, yAxisType, useSecondaryYSca
|
|
|
1024
1029
|
return { startValue: d3Min(values), endValue: d3Max(values) };
|
|
1025
1030
|
}
|
|
1026
1031
|
/**
|
|
1027
|
-
* Fins the min and max values of the
|
|
1032
|
+
* Fins the min and max values of the horizontal bar chart y axis data point.
|
|
1028
1033
|
* @export
|
|
1029
|
-
* @param {
|
|
1034
|
+
* @param {IHorizontalBarChartWithAxisDataPoint[]|IGanttChartDataPoint[]} points
|
|
1030
1035
|
* @returns {{ startValue: number; endValue: number }}
|
|
1031
1036
|
*/
|
|
1032
1037
|
export function findHBCWANumericMinMaxOfY(points, yAxisType) {
|
|
@@ -1383,6 +1388,7 @@ export function domainRangeOfDateForScatterChart(points, margins, width, isRTL,
|
|
|
1383
1388
|
* @returns {IDomainNRange}
|
|
1384
1389
|
*/
|
|
1385
1390
|
export function domainRangeOfNumericForScatterChart(points, margins, width, isRTL) {
|
|
1391
|
+
var isScatterPolar = isScatterPolarSeries(points);
|
|
1386
1392
|
var xMin = d3Min(points, function (point) {
|
|
1387
1393
|
return d3Min(point.data, function (item) { return item.x; });
|
|
1388
1394
|
});
|
|
@@ -1397,8 +1403,8 @@ export function domainRangeOfNumericForScatterChart(points, margins, width, isRT
|
|
|
1397
1403
|
var rStartValue = margins.left;
|
|
1398
1404
|
var rEndValue = width - margins.right;
|
|
1399
1405
|
return isRTL
|
|
1400
|
-
? { dStartValue: xMax, dEndValue: xMin, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
1401
|
-
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
1406
|
+
? { dStartValue: isScatterPolar ? 1 : xMax, dEndValue: isScatterPolar ? -1 : xMin, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
1407
|
+
: { dStartValue: isScatterPolar ? -1 : xMin, dEndValue: isScatterPolar ? 1 : xMax, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
1402
1408
|
}
|
|
1403
1409
|
export var truncateString = function (str, maxLength, ellipsis) {
|
|
1404
1410
|
if (ellipsis === void 0) { ellipsis = '...'; }
|
|
@@ -1477,4 +1483,14 @@ export function getContrastTextColor(backgroundColor, theme) {
|
|
|
1477
1483
|
}
|
|
1478
1484
|
return textColor;
|
|
1479
1485
|
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Utility function to check if an array of points is scatterpolar
|
|
1488
|
+
* @param points - Array of chart points
|
|
1489
|
+
* @returns true if any point has lineOptions.mode as 'scatterpolar'
|
|
1490
|
+
*/
|
|
1491
|
+
export function isScatterPolarSeries(points) {
|
|
1492
|
+
return points.some(
|
|
1493
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1494
|
+
function (item) { var _a; return typeof ((_a = item.lineOptions) === null || _a === void 0 ? void 0 : _a.mode) === 'string' && item.lineOptions.mode === 'scatterpolar'; });
|
|
1495
|
+
}
|
|
1480
1496
|
//# sourceMappingURL=utilities.js.map
|