@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 @@ 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.truncateString = exports.getCurveFactory = exports.createMeasurementSpan = 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.sortAxisCategories = exports.truncateString = exports.domainRangeOfNumericForScatterChart = exports.domainRangeOfDateForScatterChart = exports.getCurveFactory = exports.createMeasurementSpan = 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;
|
|
6
6
|
exports.MIN_DOMAIN_MARGIN = 8;
|
|
7
7
|
exports.MIN_DONUT_RADIUS = 1;
|
|
8
8
|
var ChartTypes;
|
|
@@ -14,6 +14,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
14
14
|
ChartTypes[ChartTypes["GroupedVerticalBarChart"] = 4] = "GroupedVerticalBarChart";
|
|
15
15
|
ChartTypes[ChartTypes["HeatMapChart"] = 5] = "HeatMapChart";
|
|
16
16
|
ChartTypes[ChartTypes["HorizontalBarChartWithAxis"] = 6] = "HorizontalBarChartWithAxis";
|
|
17
|
+
ChartTypes[ChartTypes["ScatterChart"] = 7] = "ScatterChart";
|
|
17
18
|
})(ChartTypes || (exports.ChartTypes = ChartTypes = {}));
|
|
18
19
|
var XAxisTypes;
|
|
19
20
|
(function (XAxisTypes) {
|
|
@@ -471,6 +472,8 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
471
472
|
* This methos creates an object for those 2 charts.
|
|
472
473
|
* @param values
|
|
473
474
|
*/
|
|
475
|
+
// changing the type to any as it is used by multiple charts with different data types
|
|
476
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
474
477
|
function calloutData(values) {
|
|
475
478
|
var combinedResult = [];
|
|
476
479
|
values.forEach(function (line) {
|
|
@@ -482,6 +485,7 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
482
485
|
combinedResult = combinedResult.concat(elements);
|
|
483
486
|
});
|
|
484
487
|
var xValToDataPoints = {};
|
|
488
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
485
489
|
combinedResult.forEach(function (ele) {
|
|
486
490
|
var xValue = ele.x instanceof Date ? ele.x.getTime() : ele.x;
|
|
487
491
|
if (xValue in xValToDataPoints) {
|
|
@@ -510,7 +514,8 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
510
514
|
}
|
|
511
515
|
});
|
|
512
516
|
var result = Object.keys(xValToDataPoints).map(function (xValue) {
|
|
513
|
-
|
|
517
|
+
var originalXValue = isNaN(Number(xValue)) ? xValue : Number(xValue);
|
|
518
|
+
return { x: originalXValue, values: xValToDataPoints[xValue] };
|
|
514
519
|
});
|
|
515
520
|
return result;
|
|
516
521
|
}
|
|
@@ -1375,6 +1380,76 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1375
1380
|
}
|
|
1376
1381
|
}
|
|
1377
1382
|
exports.getCurveFactory = getCurveFactory;
|
|
1383
|
+
/**
|
|
1384
|
+
* Calculates Domain and range values for Date X axis for scatter chart.
|
|
1385
|
+
* @export
|
|
1386
|
+
* @param {LineChartPoints[]} points
|
|
1387
|
+
* @param {IMargins} margins
|
|
1388
|
+
* @param {number} width
|
|
1389
|
+
* @param {boolean} isRTL
|
|
1390
|
+
* @param {Date[] | number[]} tickValues
|
|
1391
|
+
* @returns {IDomainNRange}
|
|
1392
|
+
*/
|
|
1393
|
+
function domainRangeOfDateForScatterChart(points, margins, width, isRTL, tickValues) {
|
|
1394
|
+
if (tickValues === void 0) { tickValues = []; }
|
|
1395
|
+
var sDate;
|
|
1396
|
+
var lDate;
|
|
1397
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1398
|
+
sDate = (0, d3_array_1.min)(points, function (point) {
|
|
1399
|
+
return (0, d3_array_1.min)(point.data, function (item) {
|
|
1400
|
+
return item.x;
|
|
1401
|
+
});
|
|
1402
|
+
});
|
|
1403
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1404
|
+
lDate = (0, d3_array_1.max)(points, function (point) {
|
|
1405
|
+
return (0, d3_array_1.max)(point.data, function (item) {
|
|
1406
|
+
return item.x;
|
|
1407
|
+
});
|
|
1408
|
+
});
|
|
1409
|
+
var xPadding = (lDate.getTime() - sDate.getTime()) * 0.1;
|
|
1410
|
+
sDate = new Date(sDate.getTime() - xPadding);
|
|
1411
|
+
lDate = new Date(lDate.getTime() + xPadding);
|
|
1412
|
+
// Need to draw graph with given small and large date
|
|
1413
|
+
// (Which Involves customization of date axis tick values)
|
|
1414
|
+
// That may be Either from given graph data or from prop 'tickValues' date values.
|
|
1415
|
+
// So, Finding smallest and largest dates
|
|
1416
|
+
sDate = (0, d3_array_1.min)(tslib_1.__spreadArray(tslib_1.__spreadArray([], tickValues, true), [sDate], false));
|
|
1417
|
+
lDate = (0, d3_array_1.max)(tslib_1.__spreadArray(tslib_1.__spreadArray([], tickValues, true), [lDate], false));
|
|
1418
|
+
var rStartValue = margins.left;
|
|
1419
|
+
var rEndValue = width - margins.right;
|
|
1420
|
+
return isRTL
|
|
1421
|
+
? { dStartValue: lDate, dEndValue: sDate, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
1422
|
+
: { dStartValue: sDate, dEndValue: lDate, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
1423
|
+
}
|
|
1424
|
+
exports.domainRangeOfDateForScatterChart = domainRangeOfDateForScatterChart;
|
|
1425
|
+
/**
|
|
1426
|
+
* Calculates Domain and range values for Numeric X axis for scatter chart.
|
|
1427
|
+
* @export
|
|
1428
|
+
* @param {LineChartPoints[]} points
|
|
1429
|
+
* @param {IMargins} margins
|
|
1430
|
+
* @param {number} width
|
|
1431
|
+
* @param {boolean} isRTL
|
|
1432
|
+
* @returns {IDomainNRange}
|
|
1433
|
+
*/
|
|
1434
|
+
function domainRangeOfNumericForScatterChart(points, margins, width, isRTL) {
|
|
1435
|
+
var xMin = (0, d3_array_1.min)(points, function (point) {
|
|
1436
|
+
return (0, d3_array_1.min)(point.data, function (item) { return item.x; });
|
|
1437
|
+
});
|
|
1438
|
+
var xMax = (0, d3_array_1.max)(points, function (point) {
|
|
1439
|
+
return (0, d3_array_1.max)(point.data, function (item) {
|
|
1440
|
+
return item.x;
|
|
1441
|
+
});
|
|
1442
|
+
});
|
|
1443
|
+
var xPadding = (xMax - xMin) * 0.1;
|
|
1444
|
+
xMin = xMin - xPadding;
|
|
1445
|
+
xMax = xMax + xPadding;
|
|
1446
|
+
var rStartValue = margins.left;
|
|
1447
|
+
var rEndValue = width - margins.right;
|
|
1448
|
+
return isRTL
|
|
1449
|
+
? { dStartValue: xMax, dEndValue: xMin, rStartValue: rStartValue, rEndValue: rEndValue }
|
|
1450
|
+
: { dStartValue: xMin, dEndValue: xMax, rStartValue: rStartValue, rEndValue: rEndValue };
|
|
1451
|
+
}
|
|
1452
|
+
exports.domainRangeOfNumericForScatterChart = domainRangeOfNumericForScatterChart;
|
|
1378
1453
|
var truncateString = function (str, maxLength, ellipsis) {
|
|
1379
1454
|
if (ellipsis === void 0) { ellipsis = '...'; }
|
|
1380
1455
|
if (str.length <= maxLength) {
|
|
@@ -1383,5 +1458,63 @@ define(["require", "exports", "tslib", "d3-axis", "d3-array", "d3-scale", "d3-se
|
|
|
1383
1458
|
return str.slice(0, maxLength) + ellipsis;
|
|
1384
1459
|
};
|
|
1385
1460
|
exports.truncateString = truncateString;
|
|
1461
|
+
var categoryOrderRegex = /(category|total|sum|min|max|mean|median) (ascending|descending)/;
|
|
1462
|
+
/**
|
|
1463
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/plots.js#L3041}
|
|
1464
|
+
*/
|
|
1465
|
+
var sortAxisCategories = function (categoryToValues, categoryOrder) {
|
|
1466
|
+
if (Array.isArray(categoryOrder)) {
|
|
1467
|
+
var result_1 = [];
|
|
1468
|
+
var seen_1 = new Set();
|
|
1469
|
+
// Add elements from categoryOrder array that are in categoryToValues, in the array's order
|
|
1470
|
+
categoryOrder.forEach(function (category) {
|
|
1471
|
+
if (categoryToValues[category] && !seen_1.has(category)) {
|
|
1472
|
+
result_1.push(category);
|
|
1473
|
+
seen_1.add(category);
|
|
1474
|
+
}
|
|
1475
|
+
});
|
|
1476
|
+
// Append any keys from categoryToValues not already in result
|
|
1477
|
+
Object.keys(categoryToValues).forEach(function (category) {
|
|
1478
|
+
if (!seen_1.has(category)) {
|
|
1479
|
+
result_1.push(category);
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
return result_1;
|
|
1483
|
+
}
|
|
1484
|
+
var match = categoryOrder === null || categoryOrder === void 0 ? void 0 : categoryOrder.match(categoryOrderRegex);
|
|
1485
|
+
if (match) {
|
|
1486
|
+
var aggregator_1 = match[1];
|
|
1487
|
+
var order = match[2];
|
|
1488
|
+
if (aggregator_1 === 'category') {
|
|
1489
|
+
var result = Object.keys(categoryToValues).sort();
|
|
1490
|
+
return order === 'descending' ? result.reverse() : result;
|
|
1491
|
+
}
|
|
1492
|
+
var aggFn_1 = {
|
|
1493
|
+
min: d3_array_1.min,
|
|
1494
|
+
max: d3_array_1.max,
|
|
1495
|
+
sum: d3_array_1.sum,
|
|
1496
|
+
total: d3_array_1.sum,
|
|
1497
|
+
mean: d3_array_1.mean,
|
|
1498
|
+
median: d3_array_1.median,
|
|
1499
|
+
};
|
|
1500
|
+
var sortAscending = function (a, b) {
|
|
1501
|
+
return a[1] - b[1];
|
|
1502
|
+
};
|
|
1503
|
+
var sortDescending = function (a, b) {
|
|
1504
|
+
return b[1] - a[1];
|
|
1505
|
+
};
|
|
1506
|
+
var categoriesAggregatedValue_1 = [];
|
|
1507
|
+
Object.keys(categoryToValues).forEach(function (category) {
|
|
1508
|
+
categoriesAggregatedValue_1.push([category, aggFn_1[aggregator_1](categoryToValues[category]) || 0]);
|
|
1509
|
+
});
|
|
1510
|
+
categoriesAggregatedValue_1.sort(order === 'descending' ? sortDescending : sortAscending);
|
|
1511
|
+
return categoriesAggregatedValue_1.map(function (_a) {
|
|
1512
|
+
var category = _a[0];
|
|
1513
|
+
return category;
|
|
1514
|
+
});
|
|
1515
|
+
}
|
|
1516
|
+
return Object.keys(categoryToValues);
|
|
1517
|
+
};
|
|
1518
|
+
exports.sortAxisCategories = sortAxisCategories;
|
|
1386
1519
|
});
|
|
1387
1520
|
//# sourceMappingURL=utilities.js.map
|