@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,7 +1,8 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-shape", "./PlotlyColorAdapter", "d3-color"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, d3_format_1, colors_1, index_1, utilities_1, chart_utilities_1, d3_shape_1, PlotlyColorAdapter_1, d3_color_1) {
|
|
1
|
+
define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-shape", "./PlotlyColorAdapter", "d3-color", "@fluentui/react"], function (require, exports, tslib_1, d3_array_1, d3_scale_1, d3_format_1, colors_1, index_1, utilities_1, chart_utilities_1, d3_shape_1, PlotlyColorAdapter_1, d3_color_1, react_1) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getGridProperties = exports.isNonPlotType = exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.getAllupLegendsProps = exports.
|
|
4
|
+
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;
|
|
5
|
+
exports.findArrayAttributes = findArrayAttributes;
|
|
5
6
|
exports.NON_PLOT_KEY_PREFIX = 'nonplot_';
|
|
6
7
|
exports.SINGLE_REPEAT = 'repeat(1, 1fr)';
|
|
7
8
|
var dashOptions = {
|
|
@@ -449,7 +450,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
449
450
|
});
|
|
450
451
|
});
|
|
451
452
|
var vsbcData = Object.values(mapXToDataPoints);
|
|
452
|
-
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));
|
|
453
|
+
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));
|
|
453
454
|
};
|
|
454
455
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
455
456
|
var transformPlotlyJsonToGVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -516,7 +517,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
516
517
|
});
|
|
517
518
|
});
|
|
518
519
|
var gvbcData = Object.values(mapXToDataPoints);
|
|
519
|
-
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));
|
|
520
|
+
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));
|
|
520
521
|
};
|
|
521
522
|
exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
|
|
522
523
|
var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -681,12 +682,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
681
682
|
var scatterChartProps = {
|
|
682
683
|
scatterChartData: chartData,
|
|
683
684
|
};
|
|
684
|
-
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));
|
|
685
|
+
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));
|
|
685
686
|
if (isAreaChart) {
|
|
686
687
|
return tslib_1.__assign({ data: chartProps, mode: mode }, commonProps);
|
|
687
688
|
}
|
|
688
689
|
else {
|
|
689
|
-
return tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax)
|
|
690
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax), (isScatterChart
|
|
691
|
+
? tslib_1.__assign({ showYAxisLablesTooltip: true }, getAxisCategoryOrderProps(input.data, input.layout)) : {}));
|
|
690
692
|
}
|
|
691
693
|
};
|
|
692
694
|
var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -731,9 +733,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
731
733
|
var scalingFactor = 0.01;
|
|
732
734
|
var gapFactor = 1 / (1 + scalingFactor * numberOfRows);
|
|
733
735
|
var barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
|
|
734
|
-
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'
|
|
736
|
+
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'
|
|
735
737
|
? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
|
|
736
|
-
: ((_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));
|
|
738
|
+
: ((_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));
|
|
737
739
|
};
|
|
738
740
|
exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
|
|
739
741
|
var transformPlotlyJsonToGanttChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -780,7 +782,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
780
782
|
.filter(function (point) { return point !== null; });
|
|
781
783
|
})
|
|
782
784
|
.flat();
|
|
783
|
-
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));
|
|
785
|
+
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));
|
|
784
786
|
};
|
|
785
787
|
exports.transformPlotlyJsonToGanttChartProps = transformPlotlyJsonToGanttChartProps;
|
|
786
788
|
var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -895,7 +897,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
895
897
|
var rangeValuesForColorScale = Array.isArray(colorscale)
|
|
896
898
|
? colorscale.map(function (arr) { return arr[1]; })
|
|
897
899
|
: defaultRange;
|
|
898
|
-
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));
|
|
900
|
+
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));
|
|
899
901
|
};
|
|
900
902
|
exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
|
|
901
903
|
var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -1440,7 +1442,6 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1440
1442
|
// Init basecontainer and baseAttrName
|
|
1441
1443
|
crawlIntoTrace(baseContainer, 0, '');
|
|
1442
1444
|
}
|
|
1443
|
-
exports.findArrayAttributes = findArrayAttributes;
|
|
1444
1445
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1445
1446
|
function crawlIntoTrace(container, i, astrPartial) {
|
|
1446
1447
|
var item = container[stack[i]];
|
|
@@ -1531,11 +1532,11 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1531
1532
|
var binGenerator = (0, d3_array_1.bin)().domain([minVal, maxVal]);
|
|
1532
1533
|
if (typeof binSize === 'number' && binSize > 0) {
|
|
1533
1534
|
var thresholds = [];
|
|
1534
|
-
var precision = Math.max(
|
|
1535
|
-
var th = precisionRound(minVal, precision);
|
|
1536
|
-
while (th < precisionRound(maxVal + binSize, precision)) {
|
|
1535
|
+
var precision = Math.max((0, react_1.calculatePrecision)(minVal), (0, react_1.calculatePrecision)(binSize));
|
|
1536
|
+
var th = (0, react_1.precisionRound)(minVal, precision);
|
|
1537
|
+
while (th < (0, react_1.precisionRound)(maxVal + binSize, precision)) {
|
|
1537
1538
|
thresholds.push(th);
|
|
1538
|
-
th = precisionRound(th + binSize, precision);
|
|
1539
|
+
th = (0, react_1.precisionRound)(th + binSize, precision);
|
|
1539
1540
|
}
|
|
1540
1541
|
minVal = thresholds[0];
|
|
1541
1542
|
maxVal = thresholds[thresholds.length - 1];
|
|
@@ -1578,14 +1579,6 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1578
1579
|
return value;
|
|
1579
1580
|
}
|
|
1580
1581
|
};
|
|
1581
|
-
var getPrecision = function (value) {
|
|
1582
|
-
var _a, _b;
|
|
1583
|
-
return (_b = (_a = value.toString().split('.')[1]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
1584
|
-
};
|
|
1585
|
-
var precisionRound = function (value, precision) {
|
|
1586
|
-
var factor = Math.pow(10, precision);
|
|
1587
|
-
return Math.round(value * factor) / factor;
|
|
1588
|
-
};
|
|
1589
1582
|
var getLegendShape = function (series) {
|
|
1590
1583
|
var _a, _b;
|
|
1591
1584
|
var dashType = ((_a = series.line) === null || _a === void 0 ? void 0 : _a.dash) || 'solid';
|
|
@@ -1968,7 +1961,128 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1968
1961
|
};
|
|
1969
1962
|
};
|
|
1970
1963
|
var getAxisScaleTypeProps = function (data, layout) {
|
|
1964
|
+
var _a, _b, _c;
|
|
1971
1965
|
var result = {};
|
|
1966
|
+
var axisObjects = getAxisObjects(data, layout);
|
|
1967
|
+
if (((_a = axisObjects.x) === null || _a === void 0 ? void 0 : _a.type) === 'log') {
|
|
1968
|
+
result.xScaleType = 'log';
|
|
1969
|
+
}
|
|
1970
|
+
if (((_b = axisObjects.y) === null || _b === void 0 ? void 0 : _b.type) === 'log') {
|
|
1971
|
+
result.yScaleType = 'log';
|
|
1972
|
+
}
|
|
1973
|
+
if (((_c = axisObjects.y2) === null || _c === void 0 ? void 0 : _c.type) === 'log') {
|
|
1974
|
+
result.secondaryYScaleType = 'log';
|
|
1975
|
+
}
|
|
1976
|
+
return result;
|
|
1977
|
+
};
|
|
1978
|
+
/**
|
|
1979
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/tick_value_defaults.js#L8}
|
|
1980
|
+
*/
|
|
1981
|
+
var getAxisTickProps = function (data, layout) {
|
|
1982
|
+
var props = {};
|
|
1983
|
+
var axisObjects = getAxisObjects(data, layout);
|
|
1984
|
+
Object.keys(axisObjects).forEach(function (axId) {
|
|
1985
|
+
var ax = axisObjects[axId];
|
|
1986
|
+
if (!ax) {
|
|
1987
|
+
return;
|
|
1988
|
+
}
|
|
1989
|
+
var axType = getAxisType(data, axId[0], ax);
|
|
1990
|
+
if ((!ax.tickmode || ax.tickmode === 'array') && (0, chart_utilities_1.isArrayOrTypedArray)(ax.tickvals)) {
|
|
1991
|
+
var tickValues = axType === 'date' ? ax.tickvals.map(function (v) { return new Date(v); }) : ax.tickvals;
|
|
1992
|
+
if (axId === 'x') {
|
|
1993
|
+
props.tickValues = tickValues;
|
|
1994
|
+
}
|
|
1995
|
+
else if (axId === 'y') {
|
|
1996
|
+
props.yAxisTickValues = tickValues;
|
|
1997
|
+
}
|
|
1998
|
+
return;
|
|
1999
|
+
}
|
|
2000
|
+
if ((!ax.tickmode || ax.tickmode === 'linear') && ax.dtick) {
|
|
2001
|
+
var dtick = plotlyDtick(ax.dtick, axType);
|
|
2002
|
+
var tick0 = plotlyTick0(ax.tick0, axType, dtick);
|
|
2003
|
+
if (axId === 'x') {
|
|
2004
|
+
props.xAxis = {
|
|
2005
|
+
tickStep: dtick,
|
|
2006
|
+
tick0: tick0,
|
|
2007
|
+
};
|
|
2008
|
+
}
|
|
2009
|
+
else if (axId === 'y') {
|
|
2010
|
+
props.yAxis = {
|
|
2011
|
+
tickStep: dtick,
|
|
2012
|
+
tick0: tick0,
|
|
2013
|
+
};
|
|
2014
|
+
}
|
|
2015
|
+
return;
|
|
2016
|
+
}
|
|
2017
|
+
if ((!ax.tickmode || ax.tickmode === 'auto') && typeof ax.nticks === 'number' && ax.nticks >= 0) {
|
|
2018
|
+
if (axId === 'x') {
|
|
2019
|
+
props.xAxisTickCount = ax.nticks;
|
|
2020
|
+
}
|
|
2021
|
+
else if (axId === 'y') {
|
|
2022
|
+
props.yAxisTickCount = ax.nticks;
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
return props;
|
|
2027
|
+
};
|
|
2028
|
+
/**
|
|
2029
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/clean_ticks.js#L16}
|
|
2030
|
+
*/
|
|
2031
|
+
var plotlyDtick = function (dtick, axType) {
|
|
2032
|
+
var isLogAx = axType === 'log';
|
|
2033
|
+
var isDateAx = axType === 'date';
|
|
2034
|
+
var isCatAx = axType === 'category';
|
|
2035
|
+
var dtickDflt = isDateAx ? 86400000 : 1;
|
|
2036
|
+
if (!dtick) {
|
|
2037
|
+
return dtickDflt;
|
|
2038
|
+
}
|
|
2039
|
+
if ((0, chart_utilities_1.isNumber)(dtick)) {
|
|
2040
|
+
dtick = Number(dtick);
|
|
2041
|
+
if (dtick <= 0) {
|
|
2042
|
+
return dtickDflt;
|
|
2043
|
+
}
|
|
2044
|
+
if (isCatAx) {
|
|
2045
|
+
// category dtick must be positive integers
|
|
2046
|
+
return Math.max(1, Math.round(dtick));
|
|
2047
|
+
}
|
|
2048
|
+
if (isDateAx) {
|
|
2049
|
+
// date dtick must be at least 0.1ms (our current precision)
|
|
2050
|
+
return Math.max(0.1, dtick);
|
|
2051
|
+
}
|
|
2052
|
+
return dtick;
|
|
2053
|
+
}
|
|
2054
|
+
if (typeof dtick !== 'string' || !(isDateAx || isLogAx)) {
|
|
2055
|
+
return dtickDflt;
|
|
2056
|
+
}
|
|
2057
|
+
var prefix = dtick.charAt(0);
|
|
2058
|
+
var dtickNum = (0, chart_utilities_1.isNumber)(dtick.slice(1)) ? Number(dtick.slice(1)) : 0;
|
|
2059
|
+
if (dtickNum <= 0 ||
|
|
2060
|
+
!(
|
|
2061
|
+
// "M<n>" gives ticks every (integer) n months
|
|
2062
|
+
((isDateAx && prefix === 'M' && dtickNum === Math.round(dtickNum)) ||
|
|
2063
|
+
// "L<f>" gives ticks linearly spaced in data (not in position) every (float) f
|
|
2064
|
+
(isLogAx && prefix === 'L') ||
|
|
2065
|
+
// "D1" gives powers of 10 with all small digits between, "D2" gives only 2 and 5
|
|
2066
|
+
(isLogAx && prefix === 'D' && (dtickNum === 1 || dtickNum === 2))))) {
|
|
2067
|
+
return dtickDflt;
|
|
2068
|
+
}
|
|
2069
|
+
return dtick;
|
|
2070
|
+
};
|
|
2071
|
+
/**
|
|
2072
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/clean_ticks.js#L70}
|
|
2073
|
+
*/
|
|
2074
|
+
var plotlyTick0 = function (tick0, axType, dtick) {
|
|
2075
|
+
if (axType === 'date') {
|
|
2076
|
+
return (0, chart_utilities_1.isDate)(tick0) ? new Date(tick0) : new Date(utilities_1.DEFAULT_DATE_STRING);
|
|
2077
|
+
}
|
|
2078
|
+
if (dtick === 'D1' || dtick === 'D2') {
|
|
2079
|
+
// D1 and D2 modes ignore tick0 entirely
|
|
2080
|
+
return undefined;
|
|
2081
|
+
}
|
|
2082
|
+
// Aside from date axes, tick0 must be numeric
|
|
2083
|
+
return (0, chart_utilities_1.isNumber)(tick0) ? Number(tick0) : 0;
|
|
2084
|
+
};
|
|
2085
|
+
var getAxisObjects = function (data, layout) {
|
|
1972
2086
|
// Traces are grouped by their xaxis property, and for each group/subplot, the adapter functions
|
|
1973
2087
|
// are called with the corresponding filtered data. As a result, all traces passed to an adapter
|
|
1974
2088
|
// function share the same xaxis.
|
|
@@ -1979,22 +2093,44 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1979
2093
|
xAxisId = axisIds.x;
|
|
1980
2094
|
yAxisIds.add(axisIds.y);
|
|
1981
2095
|
});
|
|
1982
|
-
var
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
return ((_a = layout === null || layout === void 0 ? void 0 : layout[axisKey]) === null || _a === void 0 ? void 0 : _a.type) === 'log';
|
|
1986
|
-
};
|
|
1987
|
-
if (typeof xAxisId === 'number' && isLogAxis('x', xAxisId)) {
|
|
1988
|
-
result.xScaleType = 'log';
|
|
2096
|
+
var axisObjects = {};
|
|
2097
|
+
if (typeof xAxisId === 'number') {
|
|
2098
|
+
axisObjects.x = layout === null || layout === void 0 ? void 0 : layout[(0, chart_utilities_1.getAxisKey)('x', xAxisId)];
|
|
1989
2099
|
}
|
|
1990
2100
|
var sortedYAxisIds = Array.from(yAxisIds).sort();
|
|
1991
|
-
if (sortedYAxisIds.length > 0
|
|
1992
|
-
|
|
2101
|
+
if (sortedYAxisIds.length > 0) {
|
|
2102
|
+
axisObjects.y = layout === null || layout === void 0 ? void 0 : layout[(0, chart_utilities_1.getAxisKey)('y', sortedYAxisIds[0])];
|
|
1993
2103
|
}
|
|
1994
|
-
if (sortedYAxisIds.length > 1
|
|
1995
|
-
|
|
2104
|
+
if (sortedYAxisIds.length > 1) {
|
|
2105
|
+
axisObjects.y2 = layout === null || layout === void 0 ? void 0 : layout[(0, chart_utilities_1.getAxisKey)('y', sortedYAxisIds[1])];
|
|
2106
|
+
}
|
|
2107
|
+
return axisObjects;
|
|
2108
|
+
};
|
|
2109
|
+
var getAxisType = function (data, axLetter, ax) {
|
|
2110
|
+
var values = [];
|
|
2111
|
+
data.forEach(function (series) {
|
|
2112
|
+
var _a;
|
|
2113
|
+
(_a = series[axLetter]) === null || _a === void 0 ? void 0 : _a.forEach(function (val) {
|
|
2114
|
+
if (!(0, chart_utilities_1.isInvalidValue)(val)) {
|
|
2115
|
+
values.push(val);
|
|
2116
|
+
}
|
|
2117
|
+
});
|
|
2118
|
+
});
|
|
2119
|
+
// Note: When ax.type is explicitly specified, Plotly casts the values to match that type.
|
|
2120
|
+
// Therefore, simply checking the type of the values may not be sufficient. At the moment,
|
|
2121
|
+
// we don’t always perform this casting ourselves and instead use the values as provided.
|
|
2122
|
+
if ((0, chart_utilities_1.isNumberArray)(values)) {
|
|
2123
|
+
if ((ax === null || ax === void 0 ? void 0 : ax.type) === 'log') {
|
|
2124
|
+
return 'log';
|
|
2125
|
+
}
|
|
2126
|
+
return 'linear';
|
|
2127
|
+
}
|
|
2128
|
+
if ((0, chart_utilities_1.isDateArray)(values)) {
|
|
2129
|
+
return 'date';
|
|
2130
|
+
}
|
|
2131
|
+
if ((0, chart_utilities_1.isStringArray)(values)) {
|
|
2132
|
+
return 'category';
|
|
1996
2133
|
}
|
|
1997
|
-
return result;
|
|
1998
2134
|
};
|
|
1999
2135
|
});
|
|
2000
2136
|
//# sourceMappingURL=PlotlySchemaAdapter.js.map
|