@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getGridProperties = exports.isNonPlotType = exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.getAllupLegendsProps = exports.
|
|
3
|
+
exports.getGridProperties = exports.isNonPlotType = exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.getAllupLegendsProps = exports.projectPolarToCartesian = exports.transformPlotlyJsonToFunnelChartProps = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToGanttChartProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToLineChartProps = exports.transformPlotlyJsonToAreaChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.normalizeObjectArrayForGVBC = exports.resolveXAxisPoint = exports._getGaugeAxisColor = exports.correctYearMonth = exports.SINGLE_REPEAT = exports.NON_PLOT_KEY_PREFIX = void 0;
|
|
4
|
+
exports.findArrayAttributes = findArrayAttributes;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
6
|
var d3_array_1 = require("d3-array");
|
|
6
7
|
var d3_scale_1 = require("d3-scale");
|
|
@@ -12,6 +13,7 @@ var chart_utilities_1 = require("@fluentui/chart-utilities");
|
|
|
12
13
|
var d3_shape_1 = require("d3-shape");
|
|
13
14
|
var PlotlyColorAdapter_1 = require("./PlotlyColorAdapter");
|
|
14
15
|
var d3_color_1 = require("d3-color");
|
|
16
|
+
var react_1 = require("@fluentui/react");
|
|
15
17
|
exports.NON_PLOT_KEY_PREFIX = 'nonplot_';
|
|
16
18
|
exports.SINGLE_REPEAT = 'repeat(1, 1fr)';
|
|
17
19
|
var dashOptions = {
|
|
@@ -459,7 +461,7 @@ var transformPlotlyJsonToVSBCProps = function (input, isMultiPlot, colorMap, col
|
|
|
459
461
|
});
|
|
460
462
|
});
|
|
461
463
|
var vsbcData = Object.values(mapXToDataPoints);
|
|
462
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vsbcData, width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_d = vsbcData[0]) === null || _d === void 0 ? void 0 : _d.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getBarProps(input.data, input.layout));
|
|
464
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vsbcData, width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barWidth: 'auto', yMaxValue: yMaxValue, yMinValue: yMinValue, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: typeof ((_d = vsbcData[0]) === null || _d === void 0 ? void 0 : _d.xAxisPoint) === 'string' }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getBarProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout));
|
|
463
465
|
};
|
|
464
466
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
465
467
|
var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -526,7 +528,7 @@ var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, col
|
|
|
526
528
|
});
|
|
527
529
|
});
|
|
528
530
|
var gvbcData = Object.values(mapXToDataPoints);
|
|
529
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: gvbcData, width: (_a = processedInput.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = processedInput.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barwidth: 'auto', mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: typeof ((_d = gvbcData[0]) === null || _d === void 0 ? void 0 : _d.name) === 'string' }), getTitles(processedInput.layout)), getAxisCategoryOrderProps(processedInput.data, processedInput.layout)), getYMinMaxValues(processedInput.data[0], processedInput.layout)), getXAxisTickFormat(processedInput.data[0], processedInput.layout)), yAxisTickFormat), getBarProps(processedInput.data, processedInput.layout));
|
|
531
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: gvbcData, width: (_a = processedInput.layout) === null || _a === void 0 ? void 0 : _a.width, height: (_c = (_b = processedInput.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350, barwidth: 'auto', mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, wrapXAxisLables: typeof ((_d = gvbcData[0]) === null || _d === void 0 ? void 0 : _d.name) === 'string' }), getTitles(processedInput.layout)), getAxisCategoryOrderProps(processedInput.data, processedInput.layout)), getYMinMaxValues(processedInput.data[0], processedInput.layout)), getXAxisTickFormat(processedInput.data[0], processedInput.layout)), yAxisTickFormat), getBarProps(processedInput.data, processedInput.layout)), getAxisTickProps(processedInput.data, processedInput.layout));
|
|
530
532
|
};
|
|
531
533
|
exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
|
|
532
534
|
var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -691,12 +693,13 @@ var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chart
|
|
|
691
693
|
var scatterChartProps = {
|
|
692
694
|
scatterChartData: chartData,
|
|
693
695
|
};
|
|
694
|
-
var commonProps = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ supportNegativeData: true }, secondaryYAxisValues), { width: (_b = input.layout) === null || _b === void 0 ? void 0 : _b.width, height: (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 350, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000 }), getTitles(input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getAxisScaleTypeProps(input.data, input.layout));
|
|
696
|
+
var commonProps = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ supportNegativeData: true }, secondaryYAxisValues), { width: (_b = input.layout) === null || _b === void 0 ? void 0 : _b.width, height: (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : 350, hideTickOverlap: true, hideLegend: hideLegend, useUTC: false, optimizeLargeData: numDataPoints > 1000 }), getTitles(input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat), getAxisScaleTypeProps(input.data, input.layout)), getAxisTickProps(input.data, input.layout));
|
|
695
697
|
if (isAreaChart) {
|
|
696
698
|
return tslib_1.__assign({ data: chartProps, mode: mode }, commonProps);
|
|
697
699
|
}
|
|
698
700
|
else {
|
|
699
|
-
return tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax)
|
|
701
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax), (isScatterChart
|
|
702
|
+
? tslib_1.__assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {}));
|
|
700
703
|
}
|
|
701
704
|
};
|
|
702
705
|
var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -741,9 +744,9 @@ var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPl
|
|
|
741
744
|
var scalingFactor = 0.01;
|
|
742
745
|
var gapFactor = 1 / (1 + scalingFactor * numberOfRows);
|
|
743
746
|
var barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
|
|
744
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: chartData, secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
|
|
747
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: chartData, secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
|
|
745
748
|
? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
|
|
746
|
-
: ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '', barHeight: barHeight, showYAxisLables: true, height: chartHeight, width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true));
|
|
749
|
+
: ((_q = (_p = (_o = input.layout) === null || _o === void 0 ? void 0 : _o.yaxis2) === null || _p === void 0 ? void 0 : _p.title) === null || _q === void 0 ? void 0 : _q.text) || '', barHeight: barHeight, showYAxisLables: true, height: chartHeight, width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true)), getAxisTickProps(input.data, input.layout));
|
|
747
750
|
};
|
|
748
751
|
exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
|
|
749
752
|
var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -790,7 +793,7 @@ var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMa
|
|
|
790
793
|
.filter(function (point) { return point !== null; });
|
|
791
794
|
})
|
|
792
795
|
.flat();
|
|
793
|
-
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: chartData, showYAxisLables: true, height: (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 350, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true, useUTC: false }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true));
|
|
796
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: chartData, showYAxisLables: true, height: (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 350, width: (_c = input.layout) === null || _c === void 0 ? void 0 : _c.width, hideTickOverlap: true, hideLegend: hideLegend, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, roundCorners: true, useUTC: false }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getBarProps(input.data, input.layout, true)), getAxisTickProps(input.data, input.layout));
|
|
794
797
|
};
|
|
795
798
|
exports.transformPlotlyJsonToGanttChartProps = transformPlotlyJsonToGanttChartProps;
|
|
796
799
|
var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -905,7 +908,7 @@ var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap,
|
|
|
905
908
|
var rangeValuesForColorScale = Array.isArray(colorscale)
|
|
906
909
|
? colorscale.map(function (arr) { return arr[1]; })
|
|
907
910
|
: defaultRange;
|
|
908
|
-
return tslib_1.__assign(tslib_1.__assign({ data: [heatmapData], domainValuesForColorScale: domainValuesForColorScale, rangeValuesForColorScale: rangeValuesForColorScale, hideLegend: true, showYAxisLables: true, sortOrder: 'none', width: (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.width, height: (_8 = (_7 = input.layout) === null || _7 === void 0 ? void 0 : _7.height) !== null && _8 !== void 0 ? _8 : 350, hideTickOverlap: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: true }, getTitles(input.layout)), getAxisCategoryOrderProps([firstData], input.layout));
|
|
911
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: [heatmapData], domainValuesForColorScale: domainValuesForColorScale, rangeValuesForColorScale: rangeValuesForColorScale, hideLegend: true, showYAxisLables: true, sortOrder: 'none', width: (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.width, height: (_8 = (_7 = input.layout) === null || _7 === void 0 ? void 0 : _7.height) !== null && _8 !== void 0 ? _8 : 350, hideTickOverlap: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true, wrapXAxisLables: true }, getTitles(input.layout)), getAxisCategoryOrderProps([firstData], input.layout)), getAxisTickProps(input.data, input.layout));
|
|
909
912
|
};
|
|
910
913
|
exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
|
|
911
914
|
var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -1450,7 +1453,6 @@ function findArrayAttributes(trace) {
|
|
|
1450
1453
|
// Init basecontainer and baseAttrName
|
|
1451
1454
|
crawlIntoTrace(baseContainer, 0, '');
|
|
1452
1455
|
}
|
|
1453
|
-
exports.findArrayAttributes = findArrayAttributes;
|
|
1454
1456
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1455
1457
|
function crawlIntoTrace(container, i, astrPartial) {
|
|
1456
1458
|
var item = container[stack[i]];
|
|
@@ -1541,11 +1543,11 @@ var createBins = function (data, binStart, binEnd, binSize) {
|
|
|
1541
1543
|
var binGenerator = (0, d3_array_1.bin)().domain([minVal, maxVal]);
|
|
1542
1544
|
if (typeof binSize === 'number' && binSize > 0) {
|
|
1543
1545
|
var thresholds = [];
|
|
1544
|
-
var precision = Math.max(
|
|
1545
|
-
var th = precisionRound(minVal, precision);
|
|
1546
|
-
while (th < precisionRound(maxVal + binSize, precision)) {
|
|
1546
|
+
var precision = Math.max((0, react_1.calculatePrecision)(minVal), (0, react_1.calculatePrecision)(binSize));
|
|
1547
|
+
var th = (0, react_1.precisionRound)(minVal, precision);
|
|
1548
|
+
while (th < (0, react_1.precisionRound)(maxVal + binSize, precision)) {
|
|
1547
1549
|
thresholds.push(th);
|
|
1548
|
-
th = precisionRound(th + binSize, precision);
|
|
1550
|
+
th = (0, react_1.precisionRound)(th + binSize, precision);
|
|
1549
1551
|
}
|
|
1550
1552
|
minVal = thresholds[0];
|
|
1551
1553
|
maxVal = thresholds[thresholds.length - 1];
|
|
@@ -1588,14 +1590,6 @@ var calculateHistNorm = function (histnorm, value, total, dx, dy) {
|
|
|
1588
1590
|
return value;
|
|
1589
1591
|
}
|
|
1590
1592
|
};
|
|
1591
|
-
var getPrecision = function (value) {
|
|
1592
|
-
var _a, _b;
|
|
1593
|
-
return (_b = (_a = value.toString().split('.')[1]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
1594
|
-
};
|
|
1595
|
-
var precisionRound = function (value, precision) {
|
|
1596
|
-
var factor = Math.pow(10, precision);
|
|
1597
|
-
return Math.round(value * factor) / factor;
|
|
1598
|
-
};
|
|
1599
1593
|
var getLegendShape = function (series) {
|
|
1600
1594
|
var _a, _b;
|
|
1601
1595
|
var dashType = ((_a = series.line) === null || _a === void 0 ? void 0 : _a.dash) || 'solid';
|
|
@@ -1978,7 +1972,128 @@ var getBarProps = function (data, layout, isHorizontal) {
|
|
|
1978
1972
|
};
|
|
1979
1973
|
};
|
|
1980
1974
|
var getAxisScaleTypeProps = function (data, layout) {
|
|
1975
|
+
var _a, _b, _c;
|
|
1981
1976
|
var result = {};
|
|
1977
|
+
var axisObjects = getAxisObjects(data, layout);
|
|
1978
|
+
if (((_a = axisObjects.x) === null || _a === void 0 ? void 0 : _a.type) === 'log') {
|
|
1979
|
+
result.xScaleType = 'log';
|
|
1980
|
+
}
|
|
1981
|
+
if (((_b = axisObjects.y) === null || _b === void 0 ? void 0 : _b.type) === 'log') {
|
|
1982
|
+
result.yScaleType = 'log';
|
|
1983
|
+
}
|
|
1984
|
+
if (((_c = axisObjects.y2) === null || _c === void 0 ? void 0 : _c.type) === 'log') {
|
|
1985
|
+
result.secondaryYScaleType = 'log';
|
|
1986
|
+
}
|
|
1987
|
+
return result;
|
|
1988
|
+
};
|
|
1989
|
+
/**
|
|
1990
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/tick_value_defaults.js#L8}
|
|
1991
|
+
*/
|
|
1992
|
+
var getAxisTickProps = function (data, layout) {
|
|
1993
|
+
var props = {};
|
|
1994
|
+
var axisObjects = getAxisObjects(data, layout);
|
|
1995
|
+
Object.keys(axisObjects).forEach(function (axId) {
|
|
1996
|
+
var ax = axisObjects[axId];
|
|
1997
|
+
if (!ax) {
|
|
1998
|
+
return;
|
|
1999
|
+
}
|
|
2000
|
+
var axType = getAxisType(data, axId[0], ax);
|
|
2001
|
+
if ((!ax.tickmode || ax.tickmode === 'array') && (0, chart_utilities_1.isArrayOrTypedArray)(ax.tickvals)) {
|
|
2002
|
+
var tickValues = axType === 'date' ? ax.tickvals.map(function (v) { return new Date(v); }) : ax.tickvals;
|
|
2003
|
+
if (axId === 'x') {
|
|
2004
|
+
props.tickValues = tickValues;
|
|
2005
|
+
}
|
|
2006
|
+
else if (axId === 'y') {
|
|
2007
|
+
props.yAxisTickValues = tickValues;
|
|
2008
|
+
}
|
|
2009
|
+
return;
|
|
2010
|
+
}
|
|
2011
|
+
if ((!ax.tickmode || ax.tickmode === 'linear') && ax.dtick) {
|
|
2012
|
+
var dtick = plotlyDtick(ax.dtick, axType);
|
|
2013
|
+
var tick0 = plotlyTick0(ax.tick0, axType, dtick);
|
|
2014
|
+
if (axId === 'x') {
|
|
2015
|
+
props.xAxis = {
|
|
2016
|
+
tickStep: dtick,
|
|
2017
|
+
tick0: tick0,
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
else if (axId === 'y') {
|
|
2021
|
+
props.yAxis = {
|
|
2022
|
+
tickStep: dtick,
|
|
2023
|
+
tick0: tick0,
|
|
2024
|
+
};
|
|
2025
|
+
}
|
|
2026
|
+
return;
|
|
2027
|
+
}
|
|
2028
|
+
if ((!ax.tickmode || ax.tickmode === 'auto') && typeof ax.nticks === 'number' && ax.nticks >= 0) {
|
|
2029
|
+
if (axId === 'x') {
|
|
2030
|
+
props.xAxisTickCount = ax.nticks;
|
|
2031
|
+
}
|
|
2032
|
+
else if (axId === 'y') {
|
|
2033
|
+
props.yAxisTickCount = ax.nticks;
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
});
|
|
2037
|
+
return props;
|
|
2038
|
+
};
|
|
2039
|
+
/**
|
|
2040
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/clean_ticks.js#L16}
|
|
2041
|
+
*/
|
|
2042
|
+
var plotlyDtick = function (dtick, axType) {
|
|
2043
|
+
var isLogAx = axType === 'log';
|
|
2044
|
+
var isDateAx = axType === 'date';
|
|
2045
|
+
var isCatAx = axType === 'category';
|
|
2046
|
+
var dtickDflt = isDateAx ? 86400000 : 1;
|
|
2047
|
+
if (!dtick) {
|
|
2048
|
+
return dtickDflt;
|
|
2049
|
+
}
|
|
2050
|
+
if ((0, chart_utilities_1.isNumber)(dtick)) {
|
|
2051
|
+
dtick = Number(dtick);
|
|
2052
|
+
if (dtick <= 0) {
|
|
2053
|
+
return dtickDflt;
|
|
2054
|
+
}
|
|
2055
|
+
if (isCatAx) {
|
|
2056
|
+
// category dtick must be positive integers
|
|
2057
|
+
return Math.max(1, Math.round(dtick));
|
|
2058
|
+
}
|
|
2059
|
+
if (isDateAx) {
|
|
2060
|
+
// date dtick must be at least 0.1ms (our current precision)
|
|
2061
|
+
return Math.max(0.1, dtick);
|
|
2062
|
+
}
|
|
2063
|
+
return dtick;
|
|
2064
|
+
}
|
|
2065
|
+
if (typeof dtick !== 'string' || !(isDateAx || isLogAx)) {
|
|
2066
|
+
return dtickDflt;
|
|
2067
|
+
}
|
|
2068
|
+
var prefix = dtick.charAt(0);
|
|
2069
|
+
var dtickNum = (0, chart_utilities_1.isNumber)(dtick.slice(1)) ? Number(dtick.slice(1)) : 0;
|
|
2070
|
+
if (dtickNum <= 0 ||
|
|
2071
|
+
!(
|
|
2072
|
+
// "M<n>" gives ticks every (integer) n months
|
|
2073
|
+
((isDateAx && prefix === 'M' && dtickNum === Math.round(dtickNum)) ||
|
|
2074
|
+
// "L<f>" gives ticks linearly spaced in data (not in position) every (float) f
|
|
2075
|
+
(isLogAx && prefix === 'L') ||
|
|
2076
|
+
// "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5
|
|
2077
|
+
(isLogAx && prefix === 'D' && (dtickNum === 1 || dtickNum === 2))))) {
|
|
2078
|
+
return dtickDflt;
|
|
2079
|
+
}
|
|
2080
|
+
return dtick;
|
|
2081
|
+
};
|
|
2082
|
+
/**
|
|
2083
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/clean_ticks.js#L70}
|
|
2084
|
+
*/
|
|
2085
|
+
var plotlyTick0 = function (tick0, axType, dtick) {
|
|
2086
|
+
if (axType === 'date') {
|
|
2087
|
+
return (0, chart_utilities_1.isDate)(tick0) ? new Date(tick0) : new Date(utilities_1.DEFAULT_DATE_STRING);
|
|
2088
|
+
}
|
|
2089
|
+
if (dtick === 'D1' || dtick === 'D2') {
|
|
2090
|
+
// D1 and D2 modes ignore tick0 entirely
|
|
2091
|
+
return undefined;
|
|
2092
|
+
}
|
|
2093
|
+
// Aside from date axes, tick0 must be numeric
|
|
2094
|
+
return (0, chart_utilities_1.isNumber)(tick0) ? Number(tick0) : 0;
|
|
2095
|
+
};
|
|
2096
|
+
var getAxisObjects = function (data, layout) {
|
|
1982
2097
|
// Traces are grouped by their xaxis property, and for each group/subplot, the adapter functions
|
|
1983
2098
|
// are called with the corresponding filtered data. As a result, all traces passed to an adapter
|
|
1984
2099
|
// function share the same xaxis.
|
|
@@ -1989,21 +2104,43 @@ var getAxisScaleTypeProps = function (data, layout) {
|
|
|
1989
2104
|
xAxisId = axisIds.x;
|
|
1990
2105
|
yAxisIds.add(axisIds.y);
|
|
1991
2106
|
});
|
|
1992
|
-
var
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
return ((_a = layout === null || layout === void 0 ? void 0 : layout[axisKey]) === null || _a === void 0 ? void 0 : _a.type) === 'log';
|
|
1996
|
-
};
|
|
1997
|
-
if (typeof xAxisId === 'number' && isLogAxis('x', xAxisId)) {
|
|
1998
|
-
result.xScaleType = 'log';
|
|
2107
|
+
var axisObjects = {};
|
|
2108
|
+
if (typeof xAxisId === 'number') {
|
|
2109
|
+
axisObjects.x = layout === null || layout === void 0 ? void 0 : layout[(0, chart_utilities_1.getAxisKey)('x', xAxisId)];
|
|
1999
2110
|
}
|
|
2000
2111
|
var sortedYAxisIds = Array.from(yAxisIds).sort();
|
|
2001
|
-
if (sortedYAxisIds.length > 0
|
|
2002
|
-
|
|
2112
|
+
if (sortedYAxisIds.length > 0) {
|
|
2113
|
+
axisObjects.y = layout === null || layout === void 0 ? void 0 : layout[(0, chart_utilities_1.getAxisKey)('y', sortedYAxisIds[0])];
|
|
2003
2114
|
}
|
|
2004
|
-
if (sortedYAxisIds.length > 1
|
|
2005
|
-
|
|
2115
|
+
if (sortedYAxisIds.length > 1) {
|
|
2116
|
+
axisObjects.y2 = layout === null || layout === void 0 ? void 0 : layout[(0, chart_utilities_1.getAxisKey)('y', sortedYAxisIds[1])];
|
|
2117
|
+
}
|
|
2118
|
+
return axisObjects;
|
|
2119
|
+
};
|
|
2120
|
+
var getAxisType = function (data, axLetter, ax) {
|
|
2121
|
+
var values = [];
|
|
2122
|
+
data.forEach(function (series) {
|
|
2123
|
+
var _a;
|
|
2124
|
+
(_a = series[axLetter]) === null || _a === void 0 ? void 0 : _a.forEach(function (val) {
|
|
2125
|
+
if (!(0, chart_utilities_1.isInvalidValue)(val)) {
|
|
2126
|
+
values.push(val);
|
|
2127
|
+
}
|
|
2128
|
+
});
|
|
2129
|
+
});
|
|
2130
|
+
// Note: When ax.type is explicitly specified, Plotly casts the values to match that type.
|
|
2131
|
+
// Therefore, simply checking the type of the values may not be sufficient. At the moment,
|
|
2132
|
+
// we don’t always perform this casting ourselves and instead use the values as provided.
|
|
2133
|
+
if ((0, chart_utilities_1.isNumberArray)(values)) {
|
|
2134
|
+
if ((ax === null || ax === void 0 ? void 0 : ax.type) === 'log') {
|
|
2135
|
+
return 'log';
|
|
2136
|
+
}
|
|
2137
|
+
return 'linear';
|
|
2138
|
+
}
|
|
2139
|
+
if ((0, chart_utilities_1.isDateArray)(values)) {
|
|
2140
|
+
return 'date';
|
|
2141
|
+
}
|
|
2142
|
+
if ((0, chart_utilities_1.isStringArray)(values)) {
|
|
2143
|
+
return 'category';
|
|
2006
2144
|
}
|
|
2007
|
-
return result;
|
|
2008
2145
|
};
|
|
2009
2146
|
//# sourceMappingURL=PlotlySchemaAdapter.js.map
|