@fluentui/react-charting 5.24.2 → 5.24.4
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 +79 -1
- package/CHANGELOG.md +28 -2
- package/dist/react-charting.d.ts +204 -38
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +65 -12
- package/lib/ScatterChart.d.ts +1 -0
- package/lib/ScatterChart.js +2 -0
- package/lib/ScatterChart.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.base.d.ts +1 -0
- package/lib/components/AreaChart/AreaChart.base.js +4 -1
- package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.base.js +47 -11
- 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 +33 -3
- 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/PlotlyColorAdapter.d.ts +2 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +9 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +317 -126
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +22 -3
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
- package/lib/components/HeatMapChart/HeatMapChart.base.js +95 -37
- package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +24 -3
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.base.d.ts +7 -0
- package/lib/components/ScatterChart/ScatterChart.base.js +482 -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 +19 -0
- package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -0
- package/lib/components/ScatterChart/ScatterChart.types.d.ts +47 -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/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +27 -6
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +48 -31
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.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 +91 -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 +32 -5
- package/lib/utilities/utilities.js +132 -2
- 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/AreaChart/AreaChart.base.d.ts +1 -0
- package/lib-amd/components/AreaChart/AreaChart.base.js +4 -1
- package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.base.js +47 -11
- 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 +33 -3
- 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/PlotlyColorAdapter.d.ts +2 -1
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
- package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +327 -134
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -2
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +94 -36
- package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
- package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.base.d.ts +7 -0
- package/lib-amd/components/ScatterChart/ScatterChart.base.js +476 -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 +23 -0
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -0
- package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +47 -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/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +26 -5
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +47 -30
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.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 +91 -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 +32 -5
- package/lib-amd/utilities/utilities.js +135 -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/AreaChart/AreaChart.base.d.ts +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.base.js +4 -1
- package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +47 -11
- 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 +33 -3
- 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/PlotlyColorAdapter.d.ts +2 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +11 -2
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +28 -13
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +327 -134
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +21 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.d.ts +7 -0
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +94 -36
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -0
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +23 -2
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.d.ts +7 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +485 -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 +23 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +47 -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/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +26 -5
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +47 -30
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.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 +91 -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 +32 -5
- package/lib-commonjs/utilities/utilities.js +135 -2
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CommonComponents/CartesianChart.types.ts +45 -2
- package/src/components/ScatterChart/ScatterChart.types.ts +67 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.copyStyle = exports.resolveCSSVariables = exports.areArraysEqual = exports.getSecureProps = exports.isScalePaddingDefined = exports.getScalePadding = exports.getBarWidth = exports.formatScientificLimitWidth = exports.wrapTextInsideDonut = exports.rotateXAxisLabels = exports.getAccessibleDataObject = exports.pointTypes = exports.CustomPoints = exports.Points = exports.getTypeOfAxis = exports.findHBCWANumericMinMaxOfY = exports.findVerticalNumericMinMaxOfY = exports.findVSBCNumericMinMaxOfY = exports.findNumericMinMaxOfY = exports.domainRageOfVerticalNumeric = exports.domainRangeOfDateForAreaLineVerticalBarChart = exports.domainRangeOfVSBCNumeric = exports.domainRangeOfXStringAxis = exports.domainRangeOfNumericForHorizontalBarChartWithAxis = exports.computeLongestBars = exports.groupChartDataByYValue = exports.domainRangeOfNumericForAreaChart = exports.getXAxisType = exports.tooltipOfAxislabels = exports.calculateLongestLabelWidth = exports.wrapContent = exports.createYAxisLabels = exports.createWrapOfXLabels = exports.silceOrAppendToArray = exports.getUnique = exports.calloutData = exports.createStringYAxis = exports.createStringYAxisForHorizontalBarChartWithAxis = exports.createNumericYAxis = exports.createYAxisForHorizontalBarChartWithAxis = exports.prepareDatapoints = exports.createStringXAxis = exports.createDateXAxis = exports.createNumericXAxis = exports.defaultYAxisTickFormatter = exports.YAxisType = exports.XAxisTypes = exports.ChartTypes = exports.MIN_DONUT_RADIUS = exports.MIN_DOMAIN_MARGIN = void 0;
|
|
5
|
-
exports.truncateString = exports.getCurveFactory = exports.createMeasurementSpan = void 0;
|
|
5
|
+
exports.sortAxisCategories = exports.truncateString = exports.domainRangeOfNumericForScatterChart = exports.domainRangeOfDateForScatterChart = exports.getCurveFactory = exports.createMeasurementSpan = void 0;
|
|
6
6
|
var tslib_1 = require("tslib");
|
|
7
7
|
var d3_axis_1 = require("d3-axis");
|
|
8
8
|
var d3_array_1 = require("d3-array");
|
|
@@ -26,6 +26,7 @@ var ChartTypes;
|
|
|
26
26
|
ChartTypes[ChartTypes["GroupedVerticalBarChart"] = 4] = "GroupedVerticalBarChart";
|
|
27
27
|
ChartTypes[ChartTypes["HeatMapChart"] = 5] = "HeatMapChart";
|
|
28
28
|
ChartTypes[ChartTypes["HorizontalBarChartWithAxis"] = 6] = "HorizontalBarChartWithAxis";
|
|
29
|
+
ChartTypes[ChartTypes["ScatterChart"] = 7] = "ScatterChart";
|
|
29
30
|
})(ChartTypes || (exports.ChartTypes = ChartTypes = {}));
|
|
30
31
|
var XAxisTypes;
|
|
31
32
|
(function (XAxisTypes) {
|
|
@@ -483,6 +484,8 @@ exports.createStringYAxis = createStringYAxis;
|
|
|
483
484
|
* This methos creates an object for those 2 charts.
|
|
484
485
|
* @param values
|
|
485
486
|
*/
|
|
487
|
+
// changing the type to any as it is used by multiple charts with different data types
|
|
488
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
486
489
|
function calloutData(values) {
|
|
487
490
|
var combinedResult = [];
|
|
488
491
|
values.forEach(function (line) {
|
|
@@ -494,6 +497,7 @@ function calloutData(values) {
|
|
|
494
497
|
combinedResult = combinedResult.concat(elements);
|
|
495
498
|
});
|
|
496
499
|
var xValToDataPoints = {};
|
|
500
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
497
501
|
combinedResult.forEach(function (ele) {
|
|
498
502
|
var xValue = ele.x instanceof Date ? ele.x.getTime() : ele.x;
|
|
499
503
|
if (xValue in xValToDataPoints) {
|
|
@@ -522,7 +526,8 @@ function calloutData(values) {
|
|
|
522
526
|
}
|
|
523
527
|
});
|
|
524
528
|
var result = Object.keys(xValToDataPoints).map(function (xValue) {
|
|
525
|
-
|
|
529
|
+
var originalXValue = isNaN(Number(xValue)) ? xValue : Number(xValue);
|
|
530
|
+
return { x: originalXValue, values: xValToDataPoints[xValue] };
|
|
526
531
|
});
|
|
527
532
|
return result;
|
|
528
533
|
}
|
|
@@ -1387,6 +1392,76 @@ function getCurveFactory(curve, defaultFactory) {
|
|
|
1387
1392
|
}
|
|
1388
1393
|
}
|
|
1389
1394
|
exports.getCurveFactory = getCurveFactory;
|
|
1395
|
+
/**
|
|
1396
|
+
* Calculates Domain and range values for Date X axis for scatter chart.
|
|
1397
|
+
* @export
|
|
1398
|
+
* @param {LineChartPoints[]} points
|
|
1399
|
+
* @param {IMargins} margins
|
|
1400
|
+
* @param {number} width
|
|
1401
|
+
* @param {boolean} isRTL
|
|
1402
|
+
* @param {Date[] | number[]} tickValues
|
|
1403
|
+
* @returns {IDomainNRange}
|
|
1404
|
+
*/
|
|
1405
|
+
function domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues) {
|
|
1406
|
+
if (tickValues === void 0) { tickValues = []; }
|
|
1407
|
+
var sDate;
|
|
1408
|
+
var lDate;
|
|
1409
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1410
|
+
sDate = (0, d3_array_1.min)(points, function (point) {
|
|
1411
|
+
return (0, d3_array_1.min)(point.data, function (item) {
|
|
1412
|
+
return item.x;
|
|
1413
|
+
});
|
|
1414
|
+
});
|
|
1415
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1416
|
+
lDate = (0, d3_array_1.max)(points, function (point) {
|
|
1417
|
+
return (0, d3_array_1.max)(point.data, function (item) {
|
|
1418
|
+
return item.x;
|
|
1419
|
+
});
|
|
1420
|
+
});
|
|
1421
|
+
var xPadding = (lDate.getTime() - sDate.getTime()) * 0.1;
|
|
1422
|
+
sDate = new Date(sDate.getTime() - xPadding);
|
|
1423
|
+
lDate = new Date(lDate.getTime() + xPadding);
|
|
1424
|
+
// Need to draw graph with given small and large date
|
|
1425
|
+
// (Which Involves customization of date axis tick values)
|
|
1426
|
+
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
1427
|
+
// So, Finding smallest and largest dates
|
|
1428
|
+
sDate = (0, d3_array_1.min)(tslib_1.__spreadArray(tslib_1.__spreadArray([], tickValues, true), [sDate], false));
|
|
1429
|
+
lDate = (0, d3_array_1.max)(tslib_1.__spreadArray(tslib_1.__spreadArray([], tickValues, true), [lDate], false));
|
|
1430
|
+
var rStartValue = margins.left;
|
|
1431
|
+
var rEndValue = width - margins.right;
|
|
1432
|
+
return isRTL
|
|
1433
|
+
? { dStartValue: lDate, dEndValue: sDate, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
1434
|
+
: { dStartValue: sDate, dEndValue: lDate, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
1435
|
+
}
|
|
1436
|
+
exports.domainRangeOfDateForScatterChart = domainRangeOfDateForScatterChart;
|
|
1437
|
+
/**
|
|
1438
|
+
* Calculates Domain and range values for Numeric X axis for scatter chart.
|
|
1439
|
+
* @export
|
|
1440
|
+
* @param {LineChartPoints[]} points
|
|
1441
|
+
* @param {IMargins} margins
|
|
1442
|
+
* @param {number} width
|
|
1443
|
+
* @param {boolean} isRTL
|
|
1444
|
+
* @returns {IDomainNRange}
|
|
1445
|
+
*/
|
|
1446
|
+
function domainRangeOfNumericForScatterChart(points, margins, width, isRTL) {
|
|
1447
|
+
var xMin = (0, d3_array_1.min)(points, function (point) {
|
|
1448
|
+
return (0, d3_array_1.min)(point.data, function (item) { return item.x; });
|
|
1449
|
+
});
|
|
1450
|
+
var xMax = (0, d3_array_1.max)(points, function (point) {
|
|
1451
|
+
return (0, d3_array_1.max)(point.data, function (item) {
|
|
1452
|
+
return item.x;
|
|
1453
|
+
});
|
|
1454
|
+
});
|
|
1455
|
+
var xPadding = (xMax - xMin) * 0.1;
|
|
1456
|
+
xMin = xMin - xPadding;
|
|
1457
|
+
xMax = xMax + xPadding;
|
|
1458
|
+
var rStartValue = margins.left;
|
|
1459
|
+
var rEndValue = width - margins.right;
|
|
1460
|
+
return isRTL
|
|
1461
|
+
? { dStartValue: xMax, dEndValue: xMin, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
1462
|
+
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
1463
|
+
}
|
|
1464
|
+
exports.domainRangeOfNumericForScatterChart = domainRangeOfNumericForScatterChart;
|
|
1390
1465
|
var truncateString = function (str, maxLength, ellipsis) {
|
|
1391
1466
|
if (ellipsis === void 0) { ellipsis = '...'; }
|
|
1392
1467
|
if (str.length <= maxLength) {
|
|
@@ -1395,4 +1470,62 @@ var truncateString = function (str, maxLength, ellipsis) {
|
|
|
1395
1470
|
return str.slice(0, maxLength) + ellipsis;
|
|
1396
1471
|
};
|
|
1397
1472
|
exports.truncateString = truncateString;
|
|
1473
|
+
var categoryOrderRegex = /(category|total|sum|min|max|mean|median) (ascending|descending)/;
|
|
1474
|
+
/**
|
|
1475
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/plots.js#L3041}
|
|
1476
|
+
*/
|
|
1477
|
+
var sortAxisCategories = function (categoryToValues, categoryOrder) {
|
|
1478
|
+
if (Array.isArray(categoryOrder)) {
|
|
1479
|
+
var result_1 = [];
|
|
1480
|
+
var seen_1 = new Set();
|
|
1481
|
+
// Add elements from categoryOrder array that are in categoryToValues, in the array's order
|
|
1482
|
+
categoryOrder.forEach(function (category) {
|
|
1483
|
+
if (categoryToValues[category] && !seen_1.has(category)) {
|
|
1484
|
+
result_1.push(category);
|
|
1485
|
+
seen_1.add(category);
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
// Append any keys from categoryToValues not already in result
|
|
1489
|
+
Object.keys(categoryToValues).forEach(function (category) {
|
|
1490
|
+
if (!seen_1.has(category)) {
|
|
1491
|
+
result_1.push(category);
|
|
1492
|
+
}
|
|
1493
|
+
});
|
|
1494
|
+
return result_1;
|
|
1495
|
+
}
|
|
1496
|
+
var match = categoryOrder === null || categoryOrder === void 0 ? void 0 : categoryOrder.match(categoryOrderRegex);
|
|
1497
|
+
if (match) {
|
|
1498
|
+
var aggregator_1 = match[1];
|
|
1499
|
+
var order = match[2];
|
|
1500
|
+
if (aggregator_1 === 'category') {
|
|
1501
|
+
var result = Object.keys(categoryToValues).sort();
|
|
1502
|
+
return order === 'descending' ? result.reverse() : result;
|
|
1503
|
+
}
|
|
1504
|
+
var aggFn_1 = {
|
|
1505
|
+
min: d3_array_1.min,
|
|
1506
|
+
max: d3_array_1.max,
|
|
1507
|
+
sum: d3_array_1.sum,
|
|
1508
|
+
total: d3_array_1.sum,
|
|
1509
|
+
mean: d3_array_1.mean,
|
|
1510
|
+
median: d3_array_1.median,
|
|
1511
|
+
};
|
|
1512
|
+
var sortAscending = function (a, b) {
|
|
1513
|
+
return a[1] - b[1];
|
|
1514
|
+
};
|
|
1515
|
+
var sortDescending = function (a, b) {
|
|
1516
|
+
return b[1] - a[1];
|
|
1517
|
+
};
|
|
1518
|
+
var categoriesAggregatedValue_1 = [];
|
|
1519
|
+
Object.keys(categoryToValues).forEach(function (category) {
|
|
1520
|
+
categoriesAggregatedValue_1.push([category, aggFn_1[aggregator_1](categoryToValues[category]) || 0]);
|
|
1521
|
+
});
|
|
1522
|
+
categoriesAggregatedValue_1.sort(order === 'descending' ? sortDescending : sortAscending);
|
|
1523
|
+
return categoriesAggregatedValue_1.map(function (_a) {
|
|
1524
|
+
var category = _a[0];
|
|
1525
|
+
return category;
|
|
1526
|
+
});
|
|
1527
|
+
}
|
|
1528
|
+
return Object.keys(categoryToValues);
|
|
1529
|
+
};
|
|
1530
|
+
exports.sortAxisCategories = sortAxisCategories;
|
|
1398
1531
|
//# sourceMappingURL=utilities.js.map
|