@fluentui/react-charting 5.24.2 → 5.24.3
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 +34 -1
- package/CHANGELOG.md +14 -2
- package/dist/react-charting.d.ts +170 -37
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +58 -11
- package/lib/ScatterChart.d.ts +1 -0
- package/lib/ScatterChart.js +2 -0
- package/lib/ScatterChart.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.base.js +45 -9
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js +48 -26
- package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +21 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +157 -78
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +252 -62
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.d.ts +7 -0
- package/lib/components/ScatterChart/ScatterChart.base.js +453 -0
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.d.ts +7 -0
- package/lib/components/ScatterChart/ScatterChart.js +10 -0
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
- package/lib/components/ScatterChart/ScatterChart.styles.js +7 -0
- package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.types.d.ts +42 -0
- package/lib/components/ScatterChart/ScatterChart.types.js +2 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib/components/ScatterChart/index.d.ts +2 -0
- package/lib/components/ScatterChart/index.js +3 -0
- package/lib/components/ScatterChart/index.js.map +1 -0
- 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 +73 -11
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/SVGTooltipText.d.ts +4 -0
- package/lib/utilities/SVGTooltipText.js +1 -2
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/utilities.d.ts +27 -3
- package/lib/utilities/utilities.js +102 -1
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-amd/ScatterChart.d.ts +1 -0
- package/lib-amd/ScatterChart.js +6 -0
- package/lib-amd/ScatterChart.js.map +1 -0
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +45 -9
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js +48 -26
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +21 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +155 -78
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +264 -71
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.d.ts +7 -0
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +447 -0
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -0
- package/lib-amd/components/ScatterChart/ScatterChart.d.ts +7 -0
- package/lib-amd/components/ScatterChart/ScatterChart.js +12 -0
- package/lib-amd/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib-amd/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js +12 -0
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -0
- package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +42 -0
- package/lib-amd/components/ScatterChart/ScatterChart.types.js +5 -0
- package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib-amd/components/ScatterChart/index.d.ts +2 -0
- package/lib-amd/components/ScatterChart/index.js +7 -0
- package/lib-amd/components/ScatterChart/index.js.map +1 -0
- 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 +73 -11
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/SVGTooltipText.d.ts +4 -0
- package/lib-amd/utilities/SVGTooltipText.js +1 -2
- package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +27 -3
- package/lib-amd/utilities/utilities.js +106 -2
- package/lib-amd/utilities/utilities.js.map +1 -1
- package/lib-commonjs/ScatterChart.d.ts +1 -0
- package/lib-commonjs/ScatterChart.js +5 -0
- package/lib-commonjs/ScatterChart.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +45 -9
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +48 -26
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +21 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +157 -78
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +263 -71
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.d.ts +7 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +456 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.d.ts +7 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +13 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +11 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +42 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +3 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/index.d.ts +2 -0
- package/lib-commonjs/components/ScatterChart/index.js +6 -0
- package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
- 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 +73 -11
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.d.ts +4 -0
- package/lib-commonjs/utilities/SVGTooltipText.js +1 -2
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +27 -3
- package/lib-commonjs/utilities/utilities.js +106 -2
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CommonComponents/CartesianChart.types.ts +25 -1
- package/src/components/ScatterChart/ScatterChart.types.ts +61 -0
|
@@ -22,6 +22,7 @@ export var ChartTypes;
|
|
|
22
22
|
ChartTypes[ChartTypes["GroupedVerticalBarChart"] = 4] = "GroupedVerticalBarChart";
|
|
23
23
|
ChartTypes[ChartTypes["HeatMapChart"] = 5] = "HeatMapChart";
|
|
24
24
|
ChartTypes[ChartTypes["HorizontalBarChartWithAxis"] = 6] = "HorizontalBarChartWithAxis";
|
|
25
|
+
ChartTypes[ChartTypes["ScatterChart"] = 7] = "ScatterChart";
|
|
25
26
|
})(ChartTypes || (ChartTypes = {}));
|
|
26
27
|
export var XAxisTypes;
|
|
27
28
|
(function (XAxisTypes) {
|
|
@@ -470,6 +471,8 @@ export var createStringYAxis = function (yAxisParams, dataPoints, isRtl, barWidt
|
|
|
470
471
|
* This methos creates an object for those 2 charts.
|
|
471
472
|
* @param values
|
|
472
473
|
*/
|
|
474
|
+
// changing the type to any as it is used by multiple charts with different data types
|
|
475
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
473
476
|
export function calloutData(values) {
|
|
474
477
|
var combinedResult = [];
|
|
475
478
|
values.forEach(function (line) {
|
|
@@ -481,6 +484,7 @@ export function calloutData(values) {
|
|
|
481
484
|
combinedResult = combinedResult.concat(elements);
|
|
482
485
|
});
|
|
483
486
|
var xValToDataPoints = {};
|
|
487
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
484
488
|
combinedResult.forEach(function (ele) {
|
|
485
489
|
var xValue = ele.x instanceof Date ? ele.x.getTime() : ele.x;
|
|
486
490
|
if (xValue in xValToDataPoints) {
|
|
@@ -509,7 +513,8 @@ export function calloutData(values) {
|
|
|
509
513
|
}
|
|
510
514
|
});
|
|
511
515
|
var result = Object.keys(xValToDataPoints).map(function (xValue) {
|
|
512
|
-
|
|
516
|
+
var originalXValue = isNaN(Number(xValue)) ? xValue : Number(xValue);
|
|
517
|
+
return { x: originalXValue, values: xValToDataPoints[xValue] };
|
|
513
518
|
});
|
|
514
519
|
return result;
|
|
515
520
|
}
|
|
@@ -1339,6 +1344,102 @@ export function getCurveFactory(curve, defaultFactory) {
|
|
|
1339
1344
|
return defaultFactory;
|
|
1340
1345
|
}
|
|
1341
1346
|
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Calculates Domain and range values for Date X axis for scatter chart.
|
|
1349
|
+
* @export
|
|
1350
|
+
* @param {LineChartPoints[]} points
|
|
1351
|
+
* @param {IMargins} margins
|
|
1352
|
+
* @param {number} width
|
|
1353
|
+
* @param {boolean} isRTL
|
|
1354
|
+
* @param {Date[] | number[]} tickValues
|
|
1355
|
+
* @returns {IDomainNRange}
|
|
1356
|
+
*/
|
|
1357
|
+
export function domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues) {
|
|
1358
|
+
if (tickValues === void 0) { tickValues = []; }
|
|
1359
|
+
var sDate;
|
|
1360
|
+
var lDate;
|
|
1361
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1362
|
+
sDate = d3Min(points, function (point) {
|
|
1363
|
+
return d3Min(point.data, function (item) {
|
|
1364
|
+
return item.x;
|
|
1365
|
+
});
|
|
1366
|
+
});
|
|
1367
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1368
|
+
lDate = d3Max(points, function (point) {
|
|
1369
|
+
return d3Max(point.data, function (item) {
|
|
1370
|
+
return item.x;
|
|
1371
|
+
});
|
|
1372
|
+
});
|
|
1373
|
+
var xPadding = (lDate.getTime() - sDate.getTime()) * 0.1;
|
|
1374
|
+
sDate = new Date(sDate.getTime() - xPadding);
|
|
1375
|
+
lDate = new Date(lDate.getTime() + xPadding);
|
|
1376
|
+
// Need to draw graph with given small and large date
|
|
1377
|
+
// (Which Involves customization of date axis tick values)
|
|
1378
|
+
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
1379
|
+
// So, Finding smallest and largest dates
|
|
1380
|
+
sDate = d3Min(__spreadArray(__spreadArray([], tickValues, true), [sDate], false));
|
|
1381
|
+
lDate = d3Max(__spreadArray(__spreadArray([], tickValues, true), [lDate], false));
|
|
1382
|
+
var rStartValue = margins.left;
|
|
1383
|
+
var rEndValue = width - margins.right;
|
|
1384
|
+
return isRTL
|
|
1385
|
+
? { dStartValue: lDate, dEndValue: sDate, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
1386
|
+
: { dStartValue: sDate, dEndValue: lDate, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Calculates Domain and range values for Numeric X axis for scatter chart.
|
|
1390
|
+
* @export
|
|
1391
|
+
* @param {LineChartPoints[]} points
|
|
1392
|
+
* @param {IMargins} margins
|
|
1393
|
+
* @param {number} width
|
|
1394
|
+
* @param {boolean} isRTL
|
|
1395
|
+
* @returns {IDomainNRange}
|
|
1396
|
+
*/
|
|
1397
|
+
export function domainRangeOfNumericForScatterChart(points, margins, width, isRTL) {
|
|
1398
|
+
var xMin = d3Min(points, function (point) {
|
|
1399
|
+
return d3Min(point.data, function (item) { return item.x; });
|
|
1400
|
+
});
|
|
1401
|
+
var xMax = d3Max(points, function (point) {
|
|
1402
|
+
return d3Max(point.data, function (item) {
|
|
1403
|
+
return item.x;
|
|
1404
|
+
});
|
|
1405
|
+
});
|
|
1406
|
+
var xPadding = (xMax - xMin) * 0.1;
|
|
1407
|
+
xMin = xMin - xPadding;
|
|
1408
|
+
xMax = xMax + xPadding;
|
|
1409
|
+
var rStartValue = margins.left;
|
|
1410
|
+
var rEndValue = width - margins.right;
|
|
1411
|
+
return isRTL
|
|
1412
|
+
? { dStartValue: xMax, dEndValue: xMin, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
1413
|
+
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
1414
|
+
}
|
|
1415
|
+
export function createYAxisForScatterChart(yAxisParams, isRtl, axisData, isIntegralDataset, useSecondaryYScale, _supportNegativeData, roundedTicks) {
|
|
1416
|
+
if (useSecondaryYScale === void 0) { useSecondaryYScale = false; }
|
|
1417
|
+
if (_supportNegativeData === void 0) { _supportNegativeData = false; }
|
|
1418
|
+
if (roundedTicks === void 0) { roundedTicks = false; }
|
|
1419
|
+
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;
|
|
1420
|
+
// maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
|
|
1421
|
+
var tempVal = maxOfYVal || yMinMaxValues.endValue;
|
|
1422
|
+
var finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
|
|
1423
|
+
var finalYmin = Math.min(yMinMaxValues.startValue, yMinValue || 0);
|
|
1424
|
+
var domainValues = prepareDatapoints(finalYmax, finalYmin, yAxisTickCount, isIntegralDataset, roundedTicks);
|
|
1425
|
+
var yMin = finalYmin;
|
|
1426
|
+
var yMax = domainValues[domainValues.length - 1];
|
|
1427
|
+
var yPadding = (yMax - yMin) * 0.1;
|
|
1428
|
+
yMin = yMin - yPadding;
|
|
1429
|
+
yMax = yMax + yPadding;
|
|
1430
|
+
var yAxisScale = d3ScaleLinear()
|
|
1431
|
+
.domain([domainValues[0], yMax])
|
|
1432
|
+
.range([containerHeight - margins.bottom, margins.top + (eventAnnotationProps ? eventLabelHeight : 0)]);
|
|
1433
|
+
var axis = (!isRtl && useSecondaryYScale) || (isRtl && !useSecondaryYScale) ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
|
|
1434
|
+
var yAxis = axis
|
|
1435
|
+
.tickPadding(tickPadding)
|
|
1436
|
+
.tickValues(domainValues)
|
|
1437
|
+
.tickSizeInner(-(containerWidth - margins.left - margins.right));
|
|
1438
|
+
yAxisTickFormat ? yAxis.tickFormat(yAxisTickFormat) : yAxis.tickFormat(d3Format('.2~s'));
|
|
1439
|
+
yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
|
|
1440
|
+
axisData.yAxisDomainValues = domainValues;
|
|
1441
|
+
return yAxisScale;
|
|
1442
|
+
}
|
|
1342
1443
|
export var truncateString = function (str, maxLength, ellipsis) {
|
|
1343
1444
|
if (ellipsis === void 0) { ellipsis = '...'; }
|
|
1344
1445
|
if (str.length <= maxLength) {
|