@fluentui/react-charting 5.24.3 → 5.24.5
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 +85 -1
- package/CHANGELOG.md +29 -2
- package/config/tests.js +0 -12
- package/dist/react-charting.d.ts +38 -1
- package/dist/react-charting.js +1 -1
- package/dist/react-charting.min.js +1 -1
- package/etc/react-charting.api.md +8 -1
- 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 +14 -13
- package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.styles.js +41 -37
- package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.d.ts +12 -2
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +38 -16
- 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 +13 -3
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +276 -199
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.base.js +1 -0
- package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.styles.js +18 -0
- package/lib/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.d.ts +4 -0
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +25 -4
- 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.js +84 -55
- package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.styles.js +12 -0
- package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.d.ts +5 -0
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.base.js +30 -7
- 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 +51 -32
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js.map +1 -1
- package/lib/types/IDataPoint.d.ts +18 -0
- package/lib/types/IDataPoint.js.map +1 -1
- package/lib/utilities/SVGTooltipText.js +3 -3
- package/lib/utilities/SVGTooltipText.js.map +1 -1
- package/lib/utilities/utilities.d.ts +6 -3
- package/lib/utilities/utilities.js +58 -29
- package/lib/utilities/utilities.js.map +1 -1
- 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 +14 -13
- package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js +41 -37
- package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +12 -2
- package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +37 -15
- 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 +13 -3
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +276 -199
- package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.base.js +1 -0
- package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.styles.js +17 -1
- package/lib-amd/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib-amd/components/DonutChart/DonutChart.types.d.ts +4 -0
- package/lib-amd/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +24 -3
- 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.js +83 -54
- package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js +12 -1
- package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +5 -0
- package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +29 -6
- 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 +50 -31
- package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.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 +18 -0
- package/lib-amd/types/IDataPoint.js.map +1 -1
- package/lib-amd/utilities/SVGTooltipText.js +3 -3
- package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
- package/lib-amd/utilities/utilities.d.ts +6 -3
- package/lib-amd/utilities/utilities.js +59 -30
- package/lib-amd/utilities/utilities.js.map +1 -1
- 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 +14 -13
- package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +41 -37
- package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +12 -2
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +37 -15
- 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 +13 -3
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +276 -198
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.base.js +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.styles.js +18 -0
- package/lib-commonjs/components/DonutChart/DonutChart.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.d.ts +4 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +2 -0
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +24 -3
- 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.js +83 -54
- package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +12 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +5 -0
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +29 -6
- 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 +50 -31
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.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 +18 -0
- package/lib-commonjs/types/IDataPoint.js.map +1 -1
- package/lib-commonjs/utilities/SVGTooltipText.js +3 -3
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.d.ts +6 -3
- package/lib-commonjs/utilities/utilities.js +59 -30
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +2 -2
- package/src/components/CommonComponents/CartesianChart.types.ts +20 -1
- package/src/components/DonutChart/DonutChart.types.ts +5 -0
- package/src/components/ScatterChart/ScatterChart.types.ts +7 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../../utilities/colors", "../GaugeChart/index", "../../utilities/utilities", "@fluentui/chart-utilities", "d3-shape", "./PlotlyColorAdapter"], 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) {
|
|
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) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getGridProperties = exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.getAllupLegendsProps = exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToLineChartProps = exports.transformPlotlyJsonToAreaChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.resolveXAxisPoint = exports._getGaugeAxisColor = exports.correctYearMonth = void 0;
|
|
4
|
+
exports.getGridProperties = exports.isNonPlotType = exports.getValidXYRanges = exports.getNumberAtIndexOrDefault = exports.getAllupLegendsProps = exports.findArrayAttributes = exports.projectPolarToCartesian = exports.transformPlotlyJsonToChartTableProps = exports.transformPlotlyJsonToGaugeProps = exports.transformPlotlyJsonToSankeyProps = exports.transformPlotlyJsonToHeatmapProps = exports.transformPlotlyJsonToHorizontalBarWithAxisProps = exports.transformPlotlyJsonToScatterChartProps = exports.transformPlotlyJsonToLineChartProps = exports.transformPlotlyJsonToAreaChartProps = exports.transformPlotlyJsonToVBCProps = exports.transformPlotlyJsonToGVBCProps = exports.transformPlotlyJsonToVSBCProps = exports.transformPlotlyJsonToDonutProps = exports.resolveXAxisPoint = exports._getGaugeAxisColor = exports.correctYearMonth = exports.SINGLE_REPEAT = exports.NON_PLOT_KEY_PREFIX = void 0;
|
|
5
|
+
exports.NON_PLOT_KEY_PREFIX = 'nonplot_';
|
|
6
|
+
exports.SINGLE_REPEAT = 'repeat(1, 1fr)';
|
|
5
7
|
var dashOptions = {
|
|
6
8
|
dot: {
|
|
7
9
|
strokeDasharray: '1, 5',
|
|
@@ -49,6 +51,47 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
49
51
|
};
|
|
50
52
|
return titles;
|
|
51
53
|
}
|
|
54
|
+
var getXAxisTickFormat = function (series, layout) {
|
|
55
|
+
var xAxis = getXAxisProperties(series, layout);
|
|
56
|
+
if (xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat) {
|
|
57
|
+
return {
|
|
58
|
+
tickFormat: xAxis === null || xAxis === void 0 ? void 0 : xAxis.tickformat,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return {};
|
|
62
|
+
};
|
|
63
|
+
var getYAxisTickFormat = function (series, layout) {
|
|
64
|
+
var yAxis = getYAxisProperties(series, layout);
|
|
65
|
+
if (yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat) {
|
|
66
|
+
return {
|
|
67
|
+
yAxisTickFormat: (0, d3_format_1.format)(yAxis === null || yAxis === void 0 ? void 0 : yAxis.tickformat),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return {};
|
|
71
|
+
};
|
|
72
|
+
var getYMinMaxValues = function (series, layout) {
|
|
73
|
+
var _a;
|
|
74
|
+
var range = (_a = getYAxisProperties(series, layout)) === null || _a === void 0 ? void 0 : _a.range;
|
|
75
|
+
if (range && range.length === 2) {
|
|
76
|
+
return {
|
|
77
|
+
yMinValue: range[0],
|
|
78
|
+
yMaxValue: range[1],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
return {};
|
|
82
|
+
};
|
|
83
|
+
var getYAxisProperties = function (series, layout) {
|
|
84
|
+
return layout === null || layout === void 0 ? void 0 : layout.yaxis;
|
|
85
|
+
};
|
|
86
|
+
var getXAxisProperties = function (series, layout) {
|
|
87
|
+
return layout === null || layout === void 0 ? void 0 : layout.xaxis;
|
|
88
|
+
};
|
|
89
|
+
var getFormattedCalloutYData = function (yVal, yAxisFormat) {
|
|
90
|
+
if (typeof (yAxisFormat === null || yAxisFormat === void 0 ? void 0 : yAxisFormat.yAxisTickFormat) === 'function' && typeof yVal === 'number') {
|
|
91
|
+
return yAxisFormat.yAxisTickFormat(yVal);
|
|
92
|
+
}
|
|
93
|
+
return (0, chart_utilities_1.formatToLocaleString)(yVal);
|
|
94
|
+
};
|
|
52
95
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
96
|
var correctYearMonth = function (xValues) {
|
|
54
97
|
var presentYear = new Date().getFullYear();
|
|
@@ -199,7 +242,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
199
242
|
chartTitle: chartTitle,
|
|
200
243
|
chartData: Object.values(mapLegendToDataPoint),
|
|
201
244
|
},
|
|
202
|
-
hideLegend: ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false
|
|
245
|
+
hideLegend: isMultiPlot || ((_p = input.layout) === null || _p === void 0 ? void 0 : _p.showlegend) === false,
|
|
203
246
|
width: (_q = input.layout) === null || _q === void 0 ? void 0 : _q.width,
|
|
204
247
|
height: height,
|
|
205
248
|
innerRadius: innerRadius,
|
|
@@ -217,6 +260,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
217
260
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout);
|
|
218
261
|
var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
219
262
|
var colorScale = undefined;
|
|
263
|
+
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
220
264
|
input.data.forEach(function (series, index1) {
|
|
221
265
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
222
266
|
if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
@@ -240,7 +284,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
240
284
|
var rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
241
285
|
var rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
242
286
|
rangeXValues.forEach(function (x, index2) {
|
|
243
|
-
var _a, _b, _c, _d;
|
|
287
|
+
var _a, _b, _c, _d, _e, _f;
|
|
244
288
|
if (!mapXToDataPoints[x]) {
|
|
245
289
|
mapXToDataPoints[x] = {
|
|
246
290
|
xAxisPoint: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber),
|
|
@@ -255,12 +299,15 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
255
299
|
? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index2 % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
|
|
256
300
|
: 0)
|
|
257
301
|
: (0, PlotlyColorAdapter_1.resolveColor)(extractedBarColors, index2, legend, colorMap, isDarkTheme);
|
|
302
|
+
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index2);
|
|
258
303
|
var yVal = rangeYValues[index2];
|
|
304
|
+
var yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
|
|
259
305
|
if (series.type === 'bar') {
|
|
260
306
|
mapXToDataPoints[x].chartData.push({
|
|
261
307
|
legend: legend,
|
|
262
308
|
data: yVal,
|
|
263
|
-
color: color,
|
|
309
|
+
color: (_e = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color,
|
|
310
|
+
yAxisCalloutData: yAxisCalloutData,
|
|
264
311
|
});
|
|
265
312
|
if (typeof yVal === 'number') {
|
|
266
313
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
@@ -274,9 +321,10 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
274
321
|
legend: legend + (validXYRanges.length > 1 ? ".".concat(rangeIdx + 1) : ''),
|
|
275
322
|
legendShape: legendShape,
|
|
276
323
|
y: yVal,
|
|
277
|
-
color: lineColor,
|
|
324
|
+
color: (_f = (0, d3_color_1.rgb)(lineColor).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
|
|
278
325
|
lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
|
|
279
326
|
useSecondaryYScale: usesSecondaryYScale(series, input.layout),
|
|
327
|
+
yAxisCalloutData: yAxisCalloutData,
|
|
280
328
|
});
|
|
281
329
|
if (!usesSecondaryYScale(series, input.layout) && typeof yVal === 'number') {
|
|
282
330
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
@@ -286,8 +334,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
286
334
|
});
|
|
287
335
|
});
|
|
288
336
|
});
|
|
289
|
-
|
|
290
|
-
return tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), 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, chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true, supportNegativeData: true, barGapMax: 2, showYAxisLables: true, noOfCharsToTruncate: 20, showYAxisLablesTooltip: true });
|
|
337
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), 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 }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat);
|
|
291
338
|
};
|
|
292
339
|
exports.transformPlotlyJsonToVSBCProps = transformPlotlyJsonToVSBCProps;
|
|
293
340
|
var createColorScale = function (layout, series) {
|
|
@@ -312,6 +359,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
312
359
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, 0, 0);
|
|
313
360
|
var _d = getLegendProps(input.data, input.layout, isMultiPlot), legends = _d.legends, hideLegend = _d.hideLegend;
|
|
314
361
|
var colorScale = undefined;
|
|
362
|
+
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
315
363
|
input.data.forEach(function (series, index1) {
|
|
316
364
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
317
365
|
if (((_c = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.coloraxis) === null || _b === void 0 ? void 0 : _b.colorscale) === null || _c === void 0 ? void 0 : _c.length) &&
|
|
@@ -323,7 +371,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
323
371
|
// extract colors for each series only once
|
|
324
372
|
var extractedColors = (0, PlotlyColorAdapter_1.extractColor)((_k = (_j = (_h = input.layout) === null || _h === void 0 ? void 0 : _h.template) === null || _j === void 0 ? void 0 : _j.layout) === null || _k === void 0 ? void 0 : _k.colorway, colorwayType, (_l = series.marker) === null || _l === void 0 ? void 0 : _l.color, colorMap, isDarkTheme);
|
|
325
373
|
(_m = series.x) === null || _m === void 0 ? void 0 : _m.forEach(function (x, xIndex) {
|
|
326
|
-
var _a, _b, _c, _d, _e;
|
|
374
|
+
var _a, _b, _c, _d, _e, _f;
|
|
327
375
|
if ((0, chart_utilities_1.isInvalidValue)(x) || (0, chart_utilities_1.isInvalidValue)((_a = series.y) === null || _a === void 0 ? void 0 : _a[xIndex])) {
|
|
328
376
|
return;
|
|
329
377
|
}
|
|
@@ -337,20 +385,22 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
337
385
|
? colorScale((0, chart_utilities_1.isArrayOrTypedArray)((_b = series.marker) === null || _b === void 0 ? void 0 : _b.color)
|
|
338
386
|
? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[xIndex % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
|
|
339
387
|
: 0)
|
|
340
|
-
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors,
|
|
388
|
+
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, xIndex, legend, colorMap, isDarkTheme);
|
|
389
|
+
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, xIndex);
|
|
390
|
+
var yVal = series.y[xIndex];
|
|
341
391
|
mapXToDataPoints[x].series.push({
|
|
342
392
|
key: legend,
|
|
343
|
-
data:
|
|
393
|
+
data: yVal,
|
|
344
394
|
xAxisCalloutData: x,
|
|
345
|
-
color: color,
|
|
395
|
+
color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
|
|
346
396
|
legend: legend,
|
|
347
397
|
useSecondaryYScale: usesSecondaryYScale(series, input.layout),
|
|
398
|
+
yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
|
|
348
399
|
});
|
|
349
400
|
}
|
|
350
401
|
});
|
|
351
402
|
});
|
|
352
|
-
|
|
353
|
-
return tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), 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', chartTitle: chartTitle, xAxisTitle: xAxisTitle, yAxisTitle: yAxisTitle, mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true });
|
|
403
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: Object.values(mapXToDataPoints), 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', mode: 'plotly' }, secondaryYAxisValues), { hideTickOverlap: true, hideLegend: hideLegend, roundCorners: true }), getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout)), getXAxisTickFormat(input.data[0], input.layout)), yAxisTickFormat);
|
|
354
404
|
};
|
|
355
405
|
exports.transformPlotlyJsonToGVBCProps = transformPlotlyJsonToGVBCProps;
|
|
356
406
|
var transformPlotlyJsonToVBCProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -399,7 +449,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
399
449
|
return yVal;
|
|
400
450
|
});
|
|
401
451
|
xBins.forEach(function (bin, index) {
|
|
402
|
-
var _a, _b, _c, _d;
|
|
452
|
+
var _a, _b, _c, _d, _e;
|
|
403
453
|
var legend = legends[seriesIdx];
|
|
404
454
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
405
455
|
var color = colorScale
|
|
@@ -407,27 +457,14 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
407
457
|
? (_c = (_b = series.marker) === null || _b === void 0 ? void 0 : _b.color) === null || _c === void 0 ? void 0 : _c[index % ((_d = series.marker) === null || _d === void 0 ? void 0 : _d.color).length]
|
|
408
458
|
: 0)
|
|
409
459
|
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
460
|
+
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
|
|
410
461
|
var yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
411
|
-
vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: color }, (isXString
|
|
462
|
+
vbcData.push(tslib_1.__assign({ x: isXString ? bin.join(', ') : getBinCenter(bin), y: yVal, legend: legend, color: (_e = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _e !== void 0 ? _e : color }, (isXString
|
|
412
463
|
? {}
|
|
413
464
|
: { xAxisCalloutData: "[".concat(bin.x0, " - ").concat(bin.x1, ")") })));
|
|
414
465
|
});
|
|
415
466
|
});
|
|
416
|
-
|
|
417
|
-
return {
|
|
418
|
-
data: vbcData,
|
|
419
|
-
width: (_a = input.layout) === null || _a === void 0 ? void 0 : _a.width,
|
|
420
|
-
height: (_c = (_b = input.layout) === null || _b === void 0 ? void 0 : _b.height) !== null && _c !== void 0 ? _c : 350,
|
|
421
|
-
supportNegativeData: true,
|
|
422
|
-
chartTitle: chartTitle,
|
|
423
|
-
xAxisTitle: xAxisTitle,
|
|
424
|
-
yAxisTitle: yAxisTitle,
|
|
425
|
-
mode: 'histogram',
|
|
426
|
-
hideTickOverlap: true,
|
|
427
|
-
maxBarWidth: 50,
|
|
428
|
-
hideLegend: hideLegend,
|
|
429
|
-
roundCorners: true,
|
|
430
|
-
};
|
|
467
|
+
return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ data: vbcData, 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, supportNegativeData: true, mode: 'histogram', hideTickOverlap: true, maxBarWidth: 50, hideLegend: hideLegend, roundCorners: true }, getTitles(input.layout)), getAxisCategoryOrderProps(input.data, input.layout)), getYMinMaxValues(input.data[0], input.layout));
|
|
431
468
|
};
|
|
432
469
|
exports.transformPlotlyJsonToVBCProps = transformPlotlyJsonToVBCProps;
|
|
433
470
|
var transformPlotlyJsonToAreaChartProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -443,8 +480,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
443
480
|
};
|
|
444
481
|
exports.transformPlotlyJsonToScatterChartProps = transformPlotlyJsonToScatterChartProps;
|
|
445
482
|
var transformPlotlyJsonToScatterTraceProps = function (input, isMultiPlot, chartType, colorMap, colorwayType, isDarkTheme) {
|
|
446
|
-
var _a, _b, _c, _d
|
|
483
|
+
var _a, _b, _c, _d;
|
|
447
484
|
var isScatterMarkers = [
|
|
485
|
+
'markers',
|
|
448
486
|
'text+markers',
|
|
449
487
|
'markers+text',
|
|
450
488
|
'lines+markers',
|
|
@@ -455,7 +493,8 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
455
493
|
var isScatterChart = chartType === 'scatter';
|
|
456
494
|
var secondaryYAxisValues = getSecondaryYAxisValues(input.data, input.layout, isAreaChart ? 0 : undefined, isAreaChart ? 0 : undefined);
|
|
457
495
|
var mode = 'tonexty';
|
|
458
|
-
var
|
|
496
|
+
var _e = getLegendProps(input.data, input.layout, isMultiPlot), legends = _e.legends, hideLegend = _e.hideLegend;
|
|
497
|
+
var yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
459
498
|
var chartData = input.data
|
|
460
499
|
.map(function (series, index) {
|
|
461
500
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -474,12 +513,13 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
474
513
|
var legend = legends[index];
|
|
475
514
|
// resolve color for each legend's lines from the extracted colors
|
|
476
515
|
var seriesColor = (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, index, legend, colorMap, isDarkTheme);
|
|
516
|
+
var seriesOpacity = (0, PlotlyColorAdapter_1.getOpacity)(series, index);
|
|
477
517
|
mode = series.fill === 'tozeroy' ? 'tozeroy' : 'tonexty';
|
|
478
518
|
var lineOptions = getLineOptions(series.line);
|
|
479
519
|
var legendShape = getLegendShape(series);
|
|
480
520
|
var validXYRanges = (0, exports.getValidXYRanges)(series);
|
|
481
521
|
return validXYRanges.map(function (_a, rangeIdx) {
|
|
482
|
-
var _b;
|
|
522
|
+
var _b, _c;
|
|
483
523
|
var rangeStart = _a[0], rangeEnd = _a[1];
|
|
484
524
|
var rangeXValues = xValues.slice(rangeStart, rangeEnd);
|
|
485
525
|
var rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
@@ -492,35 +532,38 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
492
532
|
legendShape: legendShape,
|
|
493
533
|
data: rangeXValues.map(function (x, i) {
|
|
494
534
|
var _a, _b;
|
|
495
|
-
return (tslib_1.__assign(tslib_1.__assign({ x: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber), y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
|
|
535
|
+
return (tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ x: (0, exports.resolveXAxisPoint)(x, isXYearCategory, isXString, isXDate, isXNumber), y: rangeYValues[i] }, (Array.isArray((_a = series.marker) === null || _a === void 0 ? void 0 : _a.size)
|
|
496
536
|
? { markerSize: markerSizes[i] }
|
|
497
537
|
: typeof ((_b = series.marker) === null || _b === void 0 ? void 0 : _b.size) === 'number'
|
|
498
538
|
? { markerSize: series.marker.size }
|
|
499
|
-
: {})), (textValues ? { text: textValues[i] } : {})));
|
|
539
|
+
: {})), (textValues ? { text: textValues[i] } : {})), { yAxisCalloutData: getFormattedCalloutYData(rangeYValues[i], yAxisTickFormat) }));
|
|
500
540
|
}),
|
|
501
|
-
color: seriesColor,
|
|
541
|
+
color: (_c = (0, d3_color_1.rgb)(seriesColor).copy({ opacity: seriesOpacity }).formatHex8()) !== null && _c !== void 0 ? _c : seriesColor,
|
|
502
542
|
lineOptions: tslib_1.__assign(tslib_1.__assign({}, (lineOptions !== null && lineOptions !== void 0 ? lineOptions : {})), { mode: series.mode }),
|
|
503
543
|
useSecondaryYScale: usesSecondaryYScale(series, input.layout),
|
|
504
544
|
};
|
|
505
545
|
});
|
|
506
546
|
})
|
|
507
547
|
.flat();
|
|
508
|
-
var
|
|
509
|
-
|
|
548
|
+
var yMinMax = getYMinMaxValues(input.data[0], input.layout);
|
|
549
|
+
if (yMinMax.yMinValue === undefined && yMinMax.yMaxValue === undefined) {
|
|
550
|
+
var yMinMaxValues = (0, utilities_1.findNumericMinMaxOfY)(chartData);
|
|
551
|
+
yMinMax.yMinValue = yMinMaxValues.startValue;
|
|
552
|
+
yMinMax.yMaxValue = yMinMaxValues.endValue;
|
|
553
|
+
}
|
|
510
554
|
var numDataPoints = chartData.reduce(function (total, lineChartPoints) { return total + lineChartPoints.data.length; }, 0);
|
|
511
555
|
var chartProps = {
|
|
512
|
-
chartTitle: chartTitle,
|
|
513
556
|
lineChartData: chartData,
|
|
514
557
|
};
|
|
515
558
|
var scatterChartProps = {
|
|
516
|
-
chartTitle: chartTitle,
|
|
517
559
|
scatterChartData: chartData,
|
|
518
560
|
};
|
|
561
|
+
var commonProps = 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);
|
|
519
562
|
if (isAreaChart) {
|
|
520
|
-
return tslib_1.__assign(
|
|
563
|
+
return tslib_1.__assign({ data: chartProps, mode: mode }, commonProps);
|
|
521
564
|
}
|
|
522
565
|
else {
|
|
523
|
-
return tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps,
|
|
566
|
+
return tslib_1.__assign(tslib_1.__assign({ data: isScatterChart ? scatterChartProps : chartProps, roundedTicks: true, enableReflow: false }, commonProps), yMinMax);
|
|
524
567
|
}
|
|
525
568
|
};
|
|
526
569
|
var transformPlotlyJsonToHorizontalBarWithAxisProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -541,7 +584,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
541
584
|
var legend = legends[index];
|
|
542
585
|
return series.y
|
|
543
586
|
.map(function (yValue, i) {
|
|
544
|
-
var _a, _b, _c, _d, _e;
|
|
587
|
+
var _a, _b, _c, _d, _e, _f;
|
|
545
588
|
if ((0, chart_utilities_1.isInvalidValue)((_a = series.x) === null || _a === void 0 ? void 0 : _a[i]) || (0, chart_utilities_1.isInvalidValue)(yValue)) {
|
|
546
589
|
return null;
|
|
547
590
|
}
|
|
@@ -551,19 +594,17 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
551
594
|
? (_d = (_c = series.marker) === null || _c === void 0 ? void 0 : _c.color) === null || _d === void 0 ? void 0 : _d[i % ((_e = series.marker) === null || _e === void 0 ? void 0 : _e.color).length]
|
|
552
595
|
: 0)
|
|
553
596
|
: (0, PlotlyColorAdapter_1.resolveColor)(extractedColors, i, legend, colorMap, isDarkTheme);
|
|
597
|
+
var opacity = (0, PlotlyColorAdapter_1.getOpacity)(series, i);
|
|
554
598
|
return {
|
|
555
599
|
x: series.x[i],
|
|
556
600
|
y: yValue,
|
|
557
601
|
legend: legend,
|
|
558
|
-
color: color,
|
|
602
|
+
color: (_f = (0, d3_color_1.rgb)(color).copy({ opacity: opacity }).formatHex8()) !== null && _f !== void 0 ? _f : color,
|
|
559
603
|
};
|
|
560
604
|
})
|
|
561
605
|
.filter(function (point) { return point !== null; });
|
|
562
606
|
})
|
|
563
|
-
.
|
|
564
|
-
.flat()
|
|
565
|
-
//reversing the order to invert the Y bars order as required by plotly.
|
|
566
|
-
.reverse();
|
|
607
|
+
.flat();
|
|
567
608
|
var chartHeight = (_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 450;
|
|
568
609
|
var margin = (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.margin) === null || _d === void 0 ? void 0 : _d.l) !== null && _e !== void 0 ? _e : 0;
|
|
569
610
|
var padding = (_h = (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.margin) === null || _g === void 0 ? void 0 : _g.pad) !== null && _h !== void 0 ? _h : 0;
|
|
@@ -572,25 +613,9 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
572
613
|
var scalingFactor = 0.01;
|
|
573
614
|
var gapFactor = 1 / (1 + scalingFactor * numberOfRows);
|
|
574
615
|
var barHeight = availableHeight / (numberOfRows * (1 + gapFactor));
|
|
575
|
-
|
|
576
|
-
return {
|
|
577
|
-
data: chartData,
|
|
578
|
-
chartTitle: chartTitle,
|
|
579
|
-
xAxisTitle: xAxisTitle,
|
|
580
|
-
yAxisTitle: yAxisTitle,
|
|
581
|
-
secondaryYAxistitle: typeof ((_k = (_j = input.layout) === null || _j === void 0 ? void 0 : _j.yaxis2) === null || _k === void 0 ? void 0 : _k.title) === 'string'
|
|
616
|
+
return 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'
|
|
582
617
|
? (_m = (_l = input.layout) === null || _l === void 0 ? void 0 : _l.yaxis2) === null || _m === void 0 ? void 0 : _m.title
|
|
583
|
-
: ((_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) || '',
|
|
584
|
-
barHeight: barHeight,
|
|
585
|
-
showYAxisLables: true,
|
|
586
|
-
height: chartHeight,
|
|
587
|
-
width: (_r = input.layout) === null || _r === void 0 ? void 0 : _r.width,
|
|
588
|
-
hideTickOverlap: true,
|
|
589
|
-
hideLegend: hideLegend,
|
|
590
|
-
noOfCharsToTruncate: 20,
|
|
591
|
-
showYAxisLablesTooltip: true,
|
|
592
|
-
roundCorners: true,
|
|
593
|
-
};
|
|
618
|
+
: ((_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));
|
|
594
619
|
};
|
|
595
620
|
exports.transformPlotlyJsonToHorizontalBarWithAxisProps = transformPlotlyJsonToHorizontalBarWithAxisProps;
|
|
596
621
|
var transformPlotlyJsonToHeatmapProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -705,23 +730,7 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
705
730
|
var rangeValuesForColorScale = Array.isArray(colorscale)
|
|
706
731
|
? colorscale.map(function (arr) { return arr[1]; })
|
|
707
732
|
: defaultRange;
|
|
708
|
-
|
|
709
|
-
return {
|
|
710
|
-
data: [heatmapData],
|
|
711
|
-
domainValuesForColorScale: domainValuesForColorScale,
|
|
712
|
-
rangeValuesForColorScale: rangeValuesForColorScale,
|
|
713
|
-
hideLegend: true,
|
|
714
|
-
showYAxisLables: true,
|
|
715
|
-
chartTitle: chartTitle,
|
|
716
|
-
xAxisTitle: xAxisTitle,
|
|
717
|
-
yAxisTitle: yAxisTitle,
|
|
718
|
-
sortOrder: 'none',
|
|
719
|
-
width: (_6 = input.layout) === null || _6 === void 0 ? void 0 : _6.width,
|
|
720
|
-
height: (_8 = (_7 = input.layout) === null || _7 === void 0 ? void 0 : _7.height) !== null && _8 !== void 0 ? _8 : 350,
|
|
721
|
-
hideTickOverlap: true,
|
|
722
|
-
noOfCharsToTruncate: 20,
|
|
723
|
-
showYAxisLablesTooltip: true,
|
|
724
|
-
};
|
|
733
|
+
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 }, getTitles(input.layout)), getAxisCategoryOrderProps([firstData], input.layout));
|
|
725
734
|
};
|
|
726
735
|
exports.transformPlotlyJsonToHeatmapProps = transformPlotlyJsonToHeatmapProps;
|
|
727
736
|
var transformPlotlyJsonToSankeyProps = function (input, isMultiPlot, colorMap, colorwayType, isDarkTheme) {
|
|
@@ -1183,26 +1192,44 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1183
1192
|
}
|
|
1184
1193
|
return 'default';
|
|
1185
1194
|
};
|
|
1186
|
-
var getAllupLegendsProps = function (input, colorMap, colorwayType, isDarkTheme) {
|
|
1195
|
+
var getAllupLegendsProps = function (input, colorMap, colorwayType, traceInfo, isDarkTheme) {
|
|
1187
1196
|
var allupLegends = [];
|
|
1188
1197
|
// reduce on showlegend boolean propperty. reduce should return true if at least one series has showlegend true
|
|
1189
1198
|
var toShowLegend = input.data.reduce(function (acc, series) {
|
|
1190
|
-
return acc || series.showlegend === true;
|
|
1199
|
+
return (acc || series.showlegend === true || series.showlegend === undefined);
|
|
1191
1200
|
}, false);
|
|
1192
1201
|
if (toShowLegend) {
|
|
1193
1202
|
input.data.forEach(function (series, index) {
|
|
1194
|
-
var _a, _b, _c, _d, _e;
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1203
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
1204
|
+
if (traceInfo[index].type === 'donut') {
|
|
1205
|
+
var pieSeries = series;
|
|
1206
|
+
var colors_2 = (0, PlotlyColorAdapter_1.extractColor)((_b = (_a = input.layout) === null || _a === void 0 ? void 0 : _a.piecolorway) !== null && _b !== void 0 ? _b : (_e = (_d = (_c = input.layout) === null || _c === void 0 ? void 0 : _c.template) === null || _d === void 0 ? void 0 : _d.layout) === null || _e === void 0 ? void 0 : _e.colorway, colorwayType, (_g = (_f = input.layout) === null || _f === void 0 ? void 0 : _f.piecolorway) !== null && _g !== void 0 ? _g : (_h = pieSeries === null || pieSeries === void 0 ? void 0 : pieSeries.marker) === null || _h === void 0 ? void 0 : _h.colors, colorMap, isDarkTheme);
|
|
1207
|
+
(_j = pieSeries.labels) === null || _j === void 0 ? void 0 : _j.forEach(function (label, labelIndex) {
|
|
1208
|
+
var legend = "".concat(label);
|
|
1209
|
+
// resolve color for each legend from the extracted colors
|
|
1210
|
+
var color = (0, PlotlyColorAdapter_1.resolveColor)(colors_2, labelIndex, legend, colorMap, isDarkTheme);
|
|
1211
|
+
if (legend !== '' && allupLegends.some(function (group) { return group.title === legend; }) === false) {
|
|
1212
|
+
allupLegends.push({
|
|
1213
|
+
title: legend,
|
|
1214
|
+
color: color,
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1204
1217
|
});
|
|
1205
1218
|
}
|
|
1219
|
+
else if ((0, exports.isNonPlotType)(traceInfo[index].type) === false) {
|
|
1220
|
+
var plotSeries = series;
|
|
1221
|
+
var name_1 = plotSeries.legendgroup;
|
|
1222
|
+
var color = ((_k = plotSeries.line) === null || _k === void 0 ? void 0 : _k.color) || ((_l = plotSeries.marker) === null || _l === void 0 ? void 0 : _l.color);
|
|
1223
|
+
var legendShape = getLegendShape(plotSeries);
|
|
1224
|
+
var resolvedColor = (0, PlotlyColorAdapter_1.extractColor)((_p = (_o = (_m = input.layout) === null || _m === void 0 ? void 0 : _m.template) === null || _o === void 0 ? void 0 : _o.layout) === null || _p === void 0 ? void 0 : _p.colorway, colorwayType, color, colorMap, isDarkTheme);
|
|
1225
|
+
if (name_1 !== undefined && name_1 !== '' && allupLegends.some(function (group) { return group.title === name_1; }) === false) {
|
|
1226
|
+
allupLegends.push({
|
|
1227
|
+
title: name_1,
|
|
1228
|
+
color: resolvedColor,
|
|
1229
|
+
shape: legendShape,
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1206
1233
|
});
|
|
1207
1234
|
}
|
|
1208
1235
|
return {
|
|
@@ -1265,155 +1292,205 @@ define(["require", "exports", "tslib", "d3-array", "d3-scale", "d3-format", "../
|
|
|
1265
1292
|
var normalizedKey = key.replace(pattern, '') === '' ? '1' : key.replace(pattern, '');
|
|
1266
1293
|
return parseInt(normalizedKey, 10) - 1;
|
|
1267
1294
|
};
|
|
1268
|
-
var
|
|
1295
|
+
var isNonPlotType = function (chartType) {
|
|
1296
|
+
return ['donut', 'sankey', 'pie'].includes(chartType);
|
|
1297
|
+
};
|
|
1298
|
+
exports.isNonPlotType = isNonPlotType;
|
|
1299
|
+
var getGridProperties = function (schema, isMultiPlot, validTracesInfo) {
|
|
1269
1300
|
var _a;
|
|
1270
|
-
var
|
|
1271
|
-
var
|
|
1301
|
+
var domainX = [];
|
|
1302
|
+
var domainY = [];
|
|
1303
|
+
var cartesianDomains = 0;
|
|
1272
1304
|
var annotations = {};
|
|
1273
1305
|
var templateRows = '1fr';
|
|
1274
1306
|
var templateColumns = '1fr';
|
|
1275
1307
|
var gridLayout = {};
|
|
1276
|
-
if (layout === undefined || layout === null || Object.keys(layout).length === 0) {
|
|
1277
|
-
return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
|
|
1278
|
-
}
|
|
1279
|
-
if (!layout.xaxis || !layout.yaxis) {
|
|
1280
|
-
return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
|
|
1281
|
-
}
|
|
1282
1308
|
if (!isMultiPlot) {
|
|
1283
1309
|
return { templateRows: templateRows, templateColumns: templateColumns, layout: gridLayout };
|
|
1284
1310
|
}
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
var
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1311
|
+
var layout = schema === null || schema === void 0 ? void 0 : schema.layout;
|
|
1312
|
+
if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
|
|
1313
|
+
Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach(function (key) {
|
|
1314
|
+
var _a, _b, _c, _d, _e;
|
|
1315
|
+
if (key.startsWith('xaxis')) {
|
|
1316
|
+
var index = getIndexFromKey(key, 'xaxis');
|
|
1317
|
+
var anchor = (_b = (_a = layout[key]) === null || _a === void 0 ? void 0 : _a.anchor) !== null && _b !== void 0 ? _b : 'y';
|
|
1318
|
+
var anchorIndex = getIndexFromKey(anchor, 'y');
|
|
1319
|
+
if (index !== anchorIndex) {
|
|
1320
|
+
throw new Error("Invalid layout: xaxis ".concat(index + 1, " anchor should be y").concat(anchorIndex + 1));
|
|
1321
|
+
}
|
|
1322
|
+
var xAxisLayout = layout[key];
|
|
1323
|
+
var domainXInfo = {
|
|
1324
|
+
start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
|
|
1325
|
+
end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1,
|
|
1326
|
+
};
|
|
1327
|
+
domainX.push(domainXInfo);
|
|
1293
1328
|
}
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1329
|
+
else if (key.startsWith('yaxis')) {
|
|
1330
|
+
var index = getIndexFromKey(key, 'yaxis');
|
|
1331
|
+
var anchor = (_d = (_c = layout[key]) === null || _c === void 0 ? void 0 : _c.anchor) !== null && _d !== void 0 ? _d : 'x';
|
|
1332
|
+
var anchorIndex = getIndexFromKey(anchor, 'x');
|
|
1333
|
+
if (index !== anchorIndex) {
|
|
1334
|
+
if ((index === 1 && anchorIndex === 0) || ((_e = layout.yaxis2) === null || _e === void 0 ? void 0 : _e.side) === 'right') {
|
|
1335
|
+
// Special case for secondary y axis where yaxis2 can anchor to x1
|
|
1336
|
+
return { templateRows: templateRows, templateColumns: templateColumns };
|
|
1337
|
+
}
|
|
1338
|
+
throw new Error("Invalid layout: yaxis ".concat(index + 1, " anchor should be x").concat(anchorIndex + 1));
|
|
1304
1339
|
}
|
|
1305
|
-
|
|
1340
|
+
var yAxisLayout = layout[key];
|
|
1341
|
+
var domainYInfo = {
|
|
1342
|
+
start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
|
|
1343
|
+
end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1,
|
|
1344
|
+
};
|
|
1345
|
+
domainY.push(domainYInfo);
|
|
1306
1346
|
}
|
|
1307
|
-
gridY[index] = (_j = (_h = layout[key]) === null || _h === void 0 ? void 0 : _h.domain) !== null && _j !== void 0 ? _j : [];
|
|
1308
|
-
}
|
|
1309
|
-
});
|
|
1310
|
-
(_a = layout.annotations) === null || _a === void 0 ? void 0 : _a.forEach(function (annotation) {
|
|
1311
|
-
var xMatches = gridX.flatMap(function (interval, idx) {
|
|
1312
|
-
return (annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval[0] && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval[1] ? [idx] : [];
|
|
1313
1347
|
});
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1348
|
+
}
|
|
1349
|
+
cartesianDomains = domainX.length; // Assuming that the number of x and y axes is the same
|
|
1350
|
+
validTracesInfo.forEach(function (trace, index) {
|
|
1351
|
+
var _a, _b, _c, _d, _e;
|
|
1352
|
+
if ((0, exports.isNonPlotType)(trace.type)) {
|
|
1353
|
+
var series = (_a = schema === null || schema === void 0 ? void 0 : schema.data) === null || _a === void 0 ? void 0 : _a[index];
|
|
1354
|
+
var domainXInfo = {
|
|
1355
|
+
start: ((_b = series.domain) === null || _b === void 0 ? void 0 : _b.x) ? series.domain.x[0] : 0,
|
|
1356
|
+
end: ((_c = series.domain) === null || _c === void 0 ? void 0 : _c.x) ? series.domain.x[1] : 1,
|
|
1357
|
+
};
|
|
1358
|
+
var domainYInfo = {
|
|
1359
|
+
start: ((_d = series.domain) === null || _d === void 0 ? void 0 : _d.y) ? series.domain.y[0] : 0,
|
|
1360
|
+
end: ((_e = series.domain) === null || _e === void 0 ? void 0 : _e.y) ? series.domain.y[1] : 1,
|
|
1361
|
+
};
|
|
1362
|
+
domainX.push(domainXInfo);
|
|
1363
|
+
domainY.push(domainYInfo);
|
|
1329
1364
|
}
|
|
1330
1365
|
});
|
|
1331
|
-
if (
|
|
1366
|
+
if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
|
|
1367
|
+
(_a = layout.annotations) === null || _a === void 0 ? void 0 : _a.forEach(function (annotation) {
|
|
1368
|
+
var xMatches = domainX.flatMap(function (interval, idx) {
|
|
1369
|
+
return (annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval.start && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval.end ? [idx] : [];
|
|
1370
|
+
});
|
|
1371
|
+
var yMatch = domainY.findIndex(function (interval, yIndex) {
|
|
1372
|
+
return xMatches.includes(yIndex) &&
|
|
1373
|
+
(annotation === null || annotation === void 0 ? void 0 : annotation.y) >= interval.start &&
|
|
1374
|
+
(annotation === null || annotation === void 0 ? void 0 : annotation.y) <= interval.end;
|
|
1375
|
+
});
|
|
1376
|
+
if (yMatch !== -1) {
|
|
1377
|
+
if (annotations[yMatch] === undefined) {
|
|
1378
|
+
annotations[yMatch] = {};
|
|
1379
|
+
}
|
|
1380
|
+
if ((annotation === null || annotation === void 0 ? void 0 : annotation.textangle) === 90) {
|
|
1381
|
+
annotations[yMatch].yAnnotation = annotation.text;
|
|
1382
|
+
}
|
|
1383
|
+
else {
|
|
1384
|
+
annotations[yMatch].xAnnotation = annotation.text;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
}
|
|
1389
|
+
if (domainX.length > 0) {
|
|
1332
1390
|
var uniqueXIntervals_1 = new Map();
|
|
1333
|
-
|
|
1334
|
-
var key = "".concat(interval
|
|
1391
|
+
domainX.forEach(function (interval) {
|
|
1392
|
+
var key = "".concat(interval.start, "-").concat(interval.end);
|
|
1335
1393
|
if (!uniqueXIntervals_1.has(key)) {
|
|
1336
1394
|
uniqueXIntervals_1.set(key, interval);
|
|
1337
1395
|
}
|
|
1338
1396
|
});
|
|
1339
|
-
var
|
|
1340
|
-
|
|
1341
|
-
.
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
var cellName = "x".concat(index === 0 ? '' : index + 1);
|
|
1397
|
+
var sortedXStart_1 = Array.from(uniqueXIntervals_1.values())
|
|
1398
|
+
.map(function (interval) { return interval.start; })
|
|
1399
|
+
.sort();
|
|
1400
|
+
templateColumns = "repeat(".concat(sortedXStart_1.length, ", 1fr)");
|
|
1401
|
+
domainX.forEach(function (interval, index) {
|
|
1402
|
+
var cellName = index >= cartesianDomains
|
|
1403
|
+
? "".concat(exports.NON_PLOT_KEY_PREFIX).concat(index - cartesianDomains + 1)
|
|
1404
|
+
: "x".concat(index === 0 ? '' : index + 1);
|
|
1405
|
+
var columnIndex = sortedXStart_1.findIndex(function (start) { return start === interval.start; });
|
|
1406
|
+
var columnNumber = columnIndex + 1; // Column numbers are 1-based
|
|
1350
1407
|
var annotationProps = annotations[index];
|
|
1351
1408
|
var xAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.xAnnotation;
|
|
1352
|
-
if (interval[0] < lastIntervalEnd_1) {
|
|
1353
|
-
columnNumber_1 = 1;
|
|
1354
|
-
}
|
|
1355
|
-
lastIntervalEnd_1 = interval[1];
|
|
1356
1409
|
var row = {
|
|
1357
1410
|
row: -1,
|
|
1358
|
-
column:
|
|
1411
|
+
column: columnNumber,
|
|
1359
1412
|
xAnnotation: xAnnotation,
|
|
1413
|
+
xDomain: interval,
|
|
1414
|
+
yDomain: { start: 0, end: 1 }, // Default yDomain for x-axis
|
|
1360
1415
|
};
|
|
1361
1416
|
gridLayout[cellName] = row;
|
|
1362
|
-
columnNumber_1 += 1;
|
|
1363
1417
|
});
|
|
1364
1418
|
}
|
|
1365
|
-
|
|
1366
|
-
var columnFill = {};
|
|
1367
|
-
for (var i = 1; i <= numColumns; i++) {
|
|
1368
|
-
columnFill[i] = { row: 1, fillDomain: 0 };
|
|
1369
|
-
}
|
|
1370
|
-
if (gridY.length > 0) {
|
|
1419
|
+
if (domainY.length > 0) {
|
|
1371
1420
|
var uniqueYIntervals_1 = new Map();
|
|
1372
|
-
|
|
1373
|
-
var key = "".concat(interval
|
|
1421
|
+
domainY.forEach(function (interval) {
|
|
1422
|
+
var key = "".concat(interval.start, "-").concat(interval.end);
|
|
1374
1423
|
if (!uniqueYIntervals_1.has(key)) {
|
|
1375
1424
|
uniqueYIntervals_1.set(key, interval);
|
|
1376
1425
|
}
|
|
1377
1426
|
});
|
|
1378
|
-
var
|
|
1379
|
-
|
|
1380
|
-
.
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1427
|
+
var sortedYStart_1 = Array.from(uniqueYIntervals_1.values())
|
|
1428
|
+
.map(function (interval) { return interval.start; })
|
|
1429
|
+
.sort();
|
|
1430
|
+
var numberOfRows_1 = sortedYStart_1.length;
|
|
1431
|
+
templateRows = "repeat(".concat(numberOfRows_1, ", 1fr)");
|
|
1432
|
+
domainY.forEach(function (interval, index) {
|
|
1433
|
+
var cellName = index >= cartesianDomains
|
|
1434
|
+
? "".concat(exports.NON_PLOT_KEY_PREFIX).concat(index - cartesianDomains + 1)
|
|
1435
|
+
: "x".concat(index === 0 ? '' : index + 1);
|
|
1436
|
+
var rowIndex = sortedYStart_1.findIndex(function (start) { return start === interval.start; });
|
|
1437
|
+
var rowNumber = numberOfRows_1 - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
|
|
1387
1438
|
var annotationProps = annotations[index];
|
|
1388
1439
|
var yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
|
|
1389
1440
|
var cell = gridLayout[cellName];
|
|
1390
1441
|
if (cell !== undefined) {
|
|
1391
|
-
cell.row =
|
|
1442
|
+
cell.row = rowNumber;
|
|
1392
1443
|
cell.yAnnotation = yAnnotation;
|
|
1444
|
+
cell.yDomain = interval;
|
|
1393
1445
|
}
|
|
1394
|
-
columnFill[cell.column].fillDomain = interval[1];
|
|
1395
|
-
columnFill[cell.column].row += 1;
|
|
1396
1446
|
});
|
|
1397
1447
|
}
|
|
1398
|
-
// reverse the order of rows in grid layout from bottom-top to top-bottom as required by CSS grid
|
|
1399
|
-
var reversedGridLayout = {};
|
|
1400
|
-
// find the maximum row number
|
|
1401
|
-
var maxRowNumber = Math.max.apply(Math, Object.values(gridLayout).map(function (cell) { var _a; return (_a = cell.row) !== null && _a !== void 0 ? _a : 0; }));
|
|
1402
|
-
// iterate over the gridLayout and reverse the row numbers
|
|
1403
|
-
Object.keys(gridLayout).forEach(function (key) {
|
|
1404
|
-
var cell = gridLayout[key];
|
|
1405
|
-
if (cell.row !== undefined) {
|
|
1406
|
-
// reverse the row number
|
|
1407
|
-
cell.row = maxRowNumber - cell.row + 1;
|
|
1408
|
-
}
|
|
1409
|
-
reversedGridLayout[key] = cell;
|
|
1410
|
-
});
|
|
1411
1448
|
return {
|
|
1412
1449
|
templateRows: templateRows,
|
|
1413
1450
|
templateColumns: templateColumns,
|
|
1414
|
-
layout:
|
|
1451
|
+
layout: gridLayout,
|
|
1415
1452
|
};
|
|
1416
1453
|
};
|
|
1417
1454
|
exports.getGridProperties = getGridProperties;
|
|
1455
|
+
/**
|
|
1456
|
+
* @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/category_order_defaults.js#L50}
|
|
1457
|
+
*/
|
|
1458
|
+
var getAxisCategoryOrderProps = function (data, layout) {
|
|
1459
|
+
var result = {};
|
|
1460
|
+
var axesById = {
|
|
1461
|
+
x: layout === null || layout === void 0 ? void 0 : layout.xaxis,
|
|
1462
|
+
y: layout === null || layout === void 0 ? void 0 : layout.yaxis,
|
|
1463
|
+
};
|
|
1464
|
+
Object.keys(axesById).forEach(function (axId) {
|
|
1465
|
+
var ax = axesById[axId];
|
|
1466
|
+
var axLetter = axId[0];
|
|
1467
|
+
var propName = "".concat(axLetter, "AxisCategoryOrder");
|
|
1468
|
+
var values = [];
|
|
1469
|
+
data.forEach(function (series) {
|
|
1470
|
+
var _a;
|
|
1471
|
+
(_a = series[axLetter]) === null || _a === void 0 ? void 0 : _a.forEach(function (val) {
|
|
1472
|
+
if (!(0, chart_utilities_1.isInvalidValue)(val)) {
|
|
1473
|
+
values.push(val);
|
|
1474
|
+
}
|
|
1475
|
+
});
|
|
1476
|
+
});
|
|
1477
|
+
var isAxisTypeCategory = (ax === null || ax === void 0 ? void 0 : ax.type) === 'category' || ((0, chart_utilities_1.isStringArray)(values) && !(0, chart_utilities_1.isNumberArray)(values) && !(0, chart_utilities_1.isDateArray)(values));
|
|
1478
|
+
if (!isAxisTypeCategory) {
|
|
1479
|
+
return;
|
|
1480
|
+
}
|
|
1481
|
+
var isValidArray = (0, chart_utilities_1.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
|
|
1482
|
+
if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
|
|
1483
|
+
result[propName] = ax.categoryarray;
|
|
1484
|
+
return;
|
|
1485
|
+
}
|
|
1486
|
+
if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
|
|
1487
|
+
var categoriesInTraceOrder = Array.from(new Set(values));
|
|
1488
|
+
result[propName] = categoriesInTraceOrder;
|
|
1489
|
+
return;
|
|
1490
|
+
}
|
|
1491
|
+
result[propName] = ax.categoryorder;
|
|
1492
|
+
});
|
|
1493
|
+
return result;
|
|
1494
|
+
};
|
|
1418
1495
|
});
|
|
1419
1496
|
//# sourceMappingURL=PlotlySchemaAdapter.js.map
|