@fluentui/react-charts 9.3.8 → 9.3.9
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.md +35 -2
- package/dist/index.d.ts +378 -0
- package/lib/PolarChart.js +1 -0
- package/lib/PolarChart.js.map +1 -0
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
- package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +21 -7
- package/lib/components/ChartTable/ChartTable.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.js +24 -3
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +7 -5
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +47 -3
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +24 -17
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +32 -13
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +33 -29
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +413 -210
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +18 -6
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +25 -5
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +16 -5
- package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js +28 -6
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +26 -4
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
- package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +7 -6
- package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +31 -19
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
- package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +5 -1
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +58 -6
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +18 -3
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js +9 -2
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +5 -6
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/PolarChart/PolarChart.js +577 -0
- package/lib/components/PolarChart/PolarChart.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.types.js +1 -0
- package/lib/components/PolarChart/PolarChart.types.js.map +1 -0
- package/lib/components/PolarChart/PolarChart.utils.js +174 -0
- package/lib/components/PolarChart/PolarChart.utils.js.map +1 -0
- package/lib/components/PolarChart/index.js +2 -0
- package/lib/components/PolarChart/index.js.map +1 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.js +72 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +61 -0
- package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
- package/lib/components/SankeyChart/SankeyChart.js +14 -4
- package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +23 -6
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +15 -5
- package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +1 -5
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +29 -38
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/ChartTitle.js +45 -0
- package/lib/utilities/ChartTitle.js.map +1 -0
- package/lib/utilities/Common.styles.js +73 -1
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js +70 -0
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/utilities.js +6 -6
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/PolarChart.js +6 -0
- package/lib-commonjs/PolarChart.js.map +1 -0
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -1
- package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +21 -7
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +34 -3
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +14 -2
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +7 -5
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +58 -4
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +24 -17
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +31 -12
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +59 -56
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +419 -213
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +17 -5
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +31 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +15 -4
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js +27 -5
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +36 -4
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +15 -3
- package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +6 -5
- package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +39 -18
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +23 -18
- package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +5 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +57 -5
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +26 -3
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +13 -2
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js +9 -2
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +5 -6
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/PolarChart/PolarChart.js +587 -0
- package/lib-commonjs/components/PolarChart/PolarChart.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.types.js +6 -0
- package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +1 -0
- package/lib-commonjs/components/PolarChart/PolarChart.utils.js +204 -0
- package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +1 -0
- package/lib-commonjs/components/PolarChart/index.js +7 -0
- package/lib-commonjs/components/PolarChart/index.js.map +1 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +107 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +75 -0
- package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/SankeyChart/SankeyChart.js +14 -4
- package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +28 -4
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +14 -3
- package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +1 -5
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +29 -38
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/ChartTitle.js +53 -0
- package/lib-commonjs/utilities/ChartTitle.js.map +1 -0
- package/lib-commonjs/utilities/Common.styles.js +69 -0
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +69 -0
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/index.js +1 -0
- package/lib-commonjs/utilities/index.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +10 -4
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +10 -16
|
@@ -10,6 +10,9 @@ function _export(target, all) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
+
DEFAULT_POLAR_SUBPLOT: function() {
|
|
14
|
+
return DEFAULT_POLAR_SUBPLOT;
|
|
15
|
+
},
|
|
13
16
|
NON_PLOT_KEY_PREFIX: function() {
|
|
14
17
|
return NON_PLOT_KEY_PREFIX;
|
|
15
18
|
},
|
|
@@ -43,9 +46,6 @@ _export(exports, {
|
|
|
43
46
|
normalizeObjectArrayForGVBC: function() {
|
|
44
47
|
return normalizeObjectArrayForGVBC;
|
|
45
48
|
},
|
|
46
|
-
projectPolarToCartesian: function() {
|
|
47
|
-
return projectPolarToCartesian;
|
|
48
|
-
},
|
|
49
49
|
resolveXAxisPoint: function() {
|
|
50
50
|
return resolveXAxisPoint;
|
|
51
51
|
},
|
|
@@ -82,6 +82,9 @@ _export(exports, {
|
|
|
82
82
|
transformPlotlyJsonToLineChartProps: function() {
|
|
83
83
|
return transformPlotlyJsonToLineChartProps;
|
|
84
84
|
},
|
|
85
|
+
transformPlotlyJsonToPolarChartProps: function() {
|
|
86
|
+
return transformPlotlyJsonToPolarChartProps;
|
|
87
|
+
},
|
|
85
88
|
transformPlotlyJsonToSankeyProps: function() {
|
|
86
89
|
return transformPlotlyJsonToSankeyProps;
|
|
87
90
|
},
|
|
@@ -147,12 +150,37 @@ const dashOptions = {
|
|
|
147
150
|
}
|
|
148
151
|
};
|
|
149
152
|
function getTitles(layout) {
|
|
150
|
-
var
|
|
151
|
-
|
|
153
|
+
var _layout_xaxis, _layout_xaxis1, _layout_xaxis_title, _layout_xaxis2, _layout_yaxis, _layout_yaxis1, _layout_yaxis_title, _layout_yaxis2;
|
|
154
|
+
const titleObj = layout === null || layout === void 0 ? void 0 : layout.title;
|
|
155
|
+
var _titleObj_text;
|
|
156
|
+
const chartTitle = typeof titleObj === 'string' ? titleObj : (_titleObj_text = titleObj === null || titleObj === void 0 ? void 0 : titleObj.text) !== null && _titleObj_text !== void 0 ? _titleObj_text : '';
|
|
157
|
+
const titleFont = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.font : undefined;
|
|
158
|
+
const titleXAnchor = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.xanchor : undefined;
|
|
159
|
+
const titleYAnchor = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.yanchor : undefined;
|
|
160
|
+
const titlePad = typeof titleObj === 'object' ? titleObj === null || titleObj === void 0 ? void 0 : titleObj.pad : undefined;
|
|
161
|
+
const titleStyles = {
|
|
162
|
+
...titleFont ? {
|
|
163
|
+
titleFont
|
|
164
|
+
} : {},
|
|
165
|
+
...titleXAnchor ? {
|
|
166
|
+
titleXAnchor
|
|
167
|
+
} : {},
|
|
168
|
+
...titleYAnchor ? {
|
|
169
|
+
titleYAnchor
|
|
170
|
+
} : {},
|
|
171
|
+
...titlePad ? {
|
|
172
|
+
titlePad
|
|
173
|
+
} : {}
|
|
174
|
+
};
|
|
175
|
+
var _layout_xaxis_title_text, _layout_yaxis_title_text;
|
|
152
176
|
const titles = {
|
|
153
|
-
chartTitle
|
|
177
|
+
chartTitle,
|
|
178
|
+
...Object.keys(titleStyles).length > 0 ? {
|
|
179
|
+
titleStyles
|
|
180
|
+
} : {},
|
|
154
181
|
xAxisTitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_xaxis = layout.xaxis) === null || _layout_xaxis === void 0 ? void 0 : _layout_xaxis.title) === 'string' ? layout === null || layout === void 0 ? void 0 : (_layout_xaxis1 = layout.xaxis) === null || _layout_xaxis1 === void 0 ? void 0 : _layout_xaxis1.title : (_layout_xaxis_title_text = layout === null || layout === void 0 ? void 0 : (_layout_xaxis2 = layout.xaxis) === null || _layout_xaxis2 === void 0 ? void 0 : (_layout_xaxis_title = _layout_xaxis2.title) === null || _layout_xaxis_title === void 0 ? void 0 : _layout_xaxis_title.text) !== null && _layout_xaxis_title_text !== void 0 ? _layout_xaxis_title_text : '',
|
|
155
|
-
yAxisTitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_yaxis = layout.yaxis) === null || _layout_yaxis === void 0 ? void 0 : _layout_yaxis.title) === 'string' ? layout === null || layout === void 0 ? void 0 : (_layout_yaxis1 = layout.yaxis) === null || _layout_yaxis1 === void 0 ? void 0 : _layout_yaxis1.title : (_layout_yaxis_title_text = layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis) === null || _layout_yaxis2 === void 0 ? void 0 : (_layout_yaxis_title = _layout_yaxis2.title) === null || _layout_yaxis_title === void 0 ? void 0 : _layout_yaxis_title.text) !== null && _layout_yaxis_title_text !== void 0 ? _layout_yaxis_title_text : ''
|
|
182
|
+
yAxisTitle: typeof (layout === null || layout === void 0 ? void 0 : (_layout_yaxis = layout.yaxis) === null || _layout_yaxis === void 0 ? void 0 : _layout_yaxis.title) === 'string' ? layout === null || layout === void 0 ? void 0 : (_layout_yaxis1 = layout.yaxis) === null || _layout_yaxis1 === void 0 ? void 0 : _layout_yaxis1.title : (_layout_yaxis_title_text = layout === null || layout === void 0 ? void 0 : (_layout_yaxis2 = layout.yaxis) === null || _layout_yaxis2 === void 0 ? void 0 : (_layout_yaxis_title = _layout_yaxis2.title) === null || _layout_yaxis_title === void 0 ? void 0 : _layout_yaxis_title.text) !== null && _layout_yaxis_title_text !== void 0 ? _layout_yaxis_title_text : '',
|
|
183
|
+
xAxisAnnotation: chartTitle
|
|
156
184
|
};
|
|
157
185
|
return titles;
|
|
158
186
|
}
|
|
@@ -433,6 +461,57 @@ const toFiniteNumber = (value)=>{
|
|
|
433
461
|
const numeric = typeof value === 'number' ? value : Number(value);
|
|
434
462
|
return Number.isFinite(numeric) ? numeric : undefined;
|
|
435
463
|
};
|
|
464
|
+
/**
|
|
465
|
+
* Parses Plotly axis references (e.g. `x`, `x2`, `xaxis2`, `paper`, `pixel`, `x domain`) into a ref type + axis id.
|
|
466
|
+
*/ const parseAxisRef = (ref, axis)=>{
|
|
467
|
+
if (!ref) {
|
|
468
|
+
return {
|
|
469
|
+
refType: 'axis',
|
|
470
|
+
axisId: 1
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
const normalized = ref.toLowerCase().trim();
|
|
474
|
+
if (normalized === 'pixel') {
|
|
475
|
+
return {
|
|
476
|
+
refType: 'pixel',
|
|
477
|
+
axisId: 1
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
if (normalized === 'paper') {
|
|
481
|
+
return {
|
|
482
|
+
refType: 'relative',
|
|
483
|
+
axisId: 1
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
if (normalized.endsWith(' domain')) {
|
|
487
|
+
return normalized.startsWith(axis) ? {
|
|
488
|
+
refType: 'relative',
|
|
489
|
+
axisId: 1
|
|
490
|
+
} : {
|
|
491
|
+
refType: undefined,
|
|
492
|
+
axisId: 1
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
const match = normalized.match(/^([xy])(axis)?(\d*)$/);
|
|
496
|
+
if (!match || match[1] !== axis) {
|
|
497
|
+
return {
|
|
498
|
+
refType: undefined,
|
|
499
|
+
axisId: 1
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
const suffix = match[3];
|
|
503
|
+
if (!suffix || suffix === '1') {
|
|
504
|
+
return {
|
|
505
|
+
refType: 'axis',
|
|
506
|
+
axisId: 1
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
const parsed = Number(suffix);
|
|
510
|
+
return {
|
|
511
|
+
refType: 'axis',
|
|
512
|
+
axisId: Number.isFinite(parsed) && parsed >= 1 ? parsed : 1
|
|
513
|
+
};
|
|
514
|
+
};
|
|
436
515
|
/**
|
|
437
516
|
* Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
|
|
438
517
|
*/ const transformRelativeYForChart = (value)=>{
|
|
@@ -486,21 +565,13 @@ const appendPx = (value)=>{
|
|
|
486
565
|
if (!ref) {
|
|
487
566
|
return 'axis';
|
|
488
567
|
}
|
|
489
|
-
const
|
|
490
|
-
if (
|
|
491
|
-
return
|
|
492
|
-
}
|
|
493
|
-
if (normalized === 'paper') {
|
|
494
|
-
return 'relative';
|
|
495
|
-
}
|
|
496
|
-
if (normalized.endsWith(' domain')) {
|
|
497
|
-
return normalized.startsWith(axis) ? 'relative' : undefined;
|
|
568
|
+
const parsed = parseAxisRef(ref, axis);
|
|
569
|
+
if (parsed.refType !== 'axis') {
|
|
570
|
+
return parsed.refType;
|
|
498
571
|
}
|
|
572
|
+
const normalized = (ref !== null && ref !== void 0 ? ref : '').toLowerCase().trim();
|
|
499
573
|
const match = normalized.match(/^([xy])(\d*)$/);
|
|
500
|
-
|
|
501
|
-
return 'axis';
|
|
502
|
-
}
|
|
503
|
-
return undefined;
|
|
574
|
+
return match && match[1] === axis ? 'axis' : undefined;
|
|
504
575
|
};
|
|
505
576
|
/**
|
|
506
577
|
* Retrieves the appropriate axis layout section from Plotly's layout given an axis reference alias.
|
|
@@ -509,56 +580,36 @@ const appendPx = (value)=>{
|
|
|
509
580
|
return undefined;
|
|
510
581
|
}
|
|
511
582
|
const defaultAxisKey = `${axis}axis`;
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
515
|
-
const normalized = ref.toLowerCase();
|
|
516
|
-
if (normalized === 'paper' || normalized === 'pixel' || normalized.endsWith(' domain')) {
|
|
517
|
-
return layout[defaultAxisKey];
|
|
518
|
-
}
|
|
519
|
-
const match = normalized.match(/^([xy])(\d*)$/);
|
|
520
|
-
if (match && match[1] === axis) {
|
|
521
|
-
const index = match[2];
|
|
522
|
-
if (index && index !== '' && index !== '1') {
|
|
523
|
-
const axisKey = `${axis}axis${index}`;
|
|
524
|
-
return layout[axisKey];
|
|
525
|
-
}
|
|
583
|
+
const { refType, axisId } = parseAxisRef(ref, axis);
|
|
584
|
+
if (refType !== 'axis' || axisId === 1) {
|
|
526
585
|
return layout[defaultAxisKey];
|
|
527
586
|
}
|
|
528
|
-
|
|
587
|
+
const axisKey = `${axis}axis${axisId}`;
|
|
588
|
+
return layout[axisKey];
|
|
529
589
|
};
|
|
530
|
-
|
|
531
|
-
* Normalizes raw Plotly data values into canonical number/date/string types based on axis configuration.
|
|
532
|
-
*/ const convertDataValue = (value, axisLayout)=>{
|
|
590
|
+
const convertAnnotationDataValue = (value, axisType)=>{
|
|
533
591
|
if (value === undefined || value === null) {
|
|
534
592
|
return undefined;
|
|
535
593
|
}
|
|
536
|
-
const axisType = axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type;
|
|
537
594
|
if (axisType === 'date') {
|
|
538
595
|
const dateValue = value instanceof Date ? value : new Date(value);
|
|
539
596
|
return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
|
|
540
597
|
}
|
|
541
|
-
if (value instanceof Date) {
|
|
542
|
-
return Number.isNaN(value.getTime()) ? undefined : value;
|
|
543
|
-
}
|
|
544
|
-
if (typeof value === 'number') {
|
|
545
|
-
return Number.isFinite(value) ? value : undefined;
|
|
546
|
-
}
|
|
547
598
|
if (axisType === 'linear' || axisType === 'log') {
|
|
599
|
+
if (typeof value === 'number') {
|
|
600
|
+
return Number.isFinite(value) ? value : undefined;
|
|
601
|
+
}
|
|
548
602
|
const numeric = Number(value);
|
|
549
603
|
return Number.isFinite(numeric) ? numeric : undefined;
|
|
550
604
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
return parsedDate;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
605
|
+
// For category-like axes, preserve raw strings (and avoid date parsing heuristics).
|
|
606
|
+
if (value instanceof Date) {
|
|
607
|
+
return value;
|
|
608
|
+
}
|
|
609
|
+
if (typeof value === 'number' || typeof value === 'string') {
|
|
559
610
|
return value;
|
|
560
611
|
}
|
|
561
|
-
return
|
|
612
|
+
return undefined;
|
|
562
613
|
};
|
|
563
614
|
const createAnnotationId = (text, index)=>{
|
|
564
615
|
const normalized = text.replace(/\s+/g, ' ').trim();
|
|
@@ -637,7 +688,9 @@ const getAnnotationCoordinateValue = (axis, refType, annotation, layout)=>{
|
|
|
637
688
|
const axisRef = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.xref : annotation === null || annotation === void 0 ? void 0 : annotation.yref;
|
|
638
689
|
const axisLayout = getAxisLayoutByRef(layout, axisRef, axis);
|
|
639
690
|
const rawValue = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y;
|
|
640
|
-
|
|
691
|
+
var _axisLayout_type;
|
|
692
|
+
const axisType = (_axisLayout_type = axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.type) !== null && _axisLayout_type !== void 0 ? _axisLayout_type : 'category';
|
|
693
|
+
return convertAnnotationDataValue(rawValue, axisType);
|
|
641
694
|
}
|
|
642
695
|
const numericValue = toFiniteNumber(axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y);
|
|
643
696
|
if (numericValue === undefined) {
|
|
@@ -861,14 +914,82 @@ const getAnnotationCoordinateValue = (axis, refType, annotation, layout)=>{
|
|
|
861
914
|
}
|
|
862
915
|
return chartAnnotation;
|
|
863
916
|
};
|
|
864
|
-
const getChartAnnotationsFromLayout = (layout, isMultiPlot)=>{
|
|
917
|
+
const getChartAnnotationsFromLayout = (data, layout, isMultiPlot)=>{
|
|
865
918
|
if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
|
|
866
919
|
return undefined;
|
|
867
920
|
}
|
|
921
|
+
// Infer axis types when they are not explicitly set.
|
|
922
|
+
// This is needed so annotation coordinate parsing can correctly treat values as 'date' vs 'category'
|
|
923
|
+
// (for example, bar chart category axes with date-like strings).
|
|
924
|
+
const inferredLayout = (()=>{
|
|
925
|
+
if (!data || !(0, _chartutilities.isArrayOrTypedArray)(data) || data.length === 0) {
|
|
926
|
+
return layout;
|
|
927
|
+
}
|
|
928
|
+
const valuesByAxisKey = new Map();
|
|
929
|
+
const axesExpectingCategories = new Set();
|
|
930
|
+
data.forEach((series)=>{
|
|
931
|
+
const trace = series;
|
|
932
|
+
const axisIds = (0, _chartutilities.getAxisIds)(trace);
|
|
933
|
+
if (trace.type === 'bar') {
|
|
934
|
+
const categoryAxisLetter = trace.orientation === 'h' ? 'y' : 'x';
|
|
935
|
+
axesExpectingCategories.add((0, _chartutilities.getAxisKey)(categoryAxisLetter, axisIds[categoryAxisLetter]));
|
|
936
|
+
}
|
|
937
|
+
[
|
|
938
|
+
'x',
|
|
939
|
+
'y'
|
|
940
|
+
].forEach((axLetter)=>{
|
|
941
|
+
const coords = trace[axLetter];
|
|
942
|
+
if (!coords || !(0, _chartutilities.isArrayOrTypedArray)(coords)) {
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
const axisKey = (0, _chartutilities.getAxisKey)(axLetter, axisIds[axLetter]);
|
|
946
|
+
var _valuesByAxisKey_get;
|
|
947
|
+
const existing = (_valuesByAxisKey_get = valuesByAxisKey.get(axisKey)) !== null && _valuesByAxisKey_get !== void 0 ? _valuesByAxisKey_get : [];
|
|
948
|
+
coords.forEach((val)=>{
|
|
949
|
+
if (!(0, _chartutilities.isInvalidValue)(val)) {
|
|
950
|
+
existing.push(val);
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
valuesByAxisKey.set(axisKey, existing);
|
|
954
|
+
});
|
|
955
|
+
});
|
|
956
|
+
let nextLayout;
|
|
957
|
+
valuesByAxisKey.forEach((values, axisKey)=>{
|
|
958
|
+
const currentAxis = layout === null || layout === void 0 ? void 0 : layout[axisKey];
|
|
959
|
+
const currentType = currentAxis === null || currentAxis === void 0 ? void 0 : currentAxis.type;
|
|
960
|
+
if ([
|
|
961
|
+
'linear',
|
|
962
|
+
'log',
|
|
963
|
+
'date',
|
|
964
|
+
'category'
|
|
965
|
+
].includes(currentType !== null && currentType !== void 0 ? currentType : '')) {
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
let inferredType;
|
|
969
|
+
if (axesExpectingCategories.has(axisKey) || (0, _chartutilities.isYearArray)(values)) {
|
|
970
|
+
inferredType = 'category';
|
|
971
|
+
} else if ((0, _chartutilities.isDateArray)(values)) {
|
|
972
|
+
inferredType = 'date';
|
|
973
|
+
}
|
|
974
|
+
if (!inferredType) {
|
|
975
|
+
return;
|
|
976
|
+
}
|
|
977
|
+
if (!nextLayout) {
|
|
978
|
+
nextLayout = {
|
|
979
|
+
...layout
|
|
980
|
+
};
|
|
981
|
+
}
|
|
982
|
+
nextLayout[axisKey] = {
|
|
983
|
+
...currentAxis !== null && currentAxis !== void 0 ? currentAxis : {},
|
|
984
|
+
type: inferredType
|
|
985
|
+
};
|
|
986
|
+
});
|
|
987
|
+
return nextLayout !== null && nextLayout !== void 0 ? nextLayout : layout;
|
|
988
|
+
})();
|
|
868
989
|
const annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [
|
|
869
990
|
layout.annotations
|
|
870
991
|
];
|
|
871
|
-
const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation,
|
|
992
|
+
const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, inferredLayout, index)).filter((annotation)=>annotation !== undefined);
|
|
872
993
|
return converted.length > 0 ? converted : undefined;
|
|
873
994
|
};
|
|
874
995
|
const normalizeObjectArrayForGVBC = (data, xLabels)=>{
|
|
@@ -945,7 +1066,7 @@ const normalizeObjectArrayForGVBC = (data, xLabels)=>{
|
|
|
945
1066
|
const transformPlotlyJsonToAnnotationChartProps = (input, isMultiPlot, _colorMap, _colorwayType, _isDarkTheme)=>{
|
|
946
1067
|
var _layoutWithMeta_meta, _input_layout, _input_layout1, _input_layout2, _input_layout3, _input_layout_font, _input_layout4, _input_layout_font1, _input_layout5, _input_layout6;
|
|
947
1068
|
var _getChartAnnotationsFromLayout;
|
|
948
|
-
const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.layout, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
|
|
1069
|
+
const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
|
|
949
1070
|
const titles = getTitles(input.layout);
|
|
950
1071
|
const layoutTitle = titles.chartTitle || undefined;
|
|
951
1072
|
const layoutWithMeta = input.layout;
|
|
@@ -1026,7 +1147,7 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
1026
1147
|
const donutMarginHorizontal = hideLabels ? 0 : 80;
|
|
1027
1148
|
const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
|
|
1028
1149
|
const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : _utilities.MIN_DONUT_RADIUS;
|
|
1029
|
-
const { chartTitle } = getTitles(input.layout);
|
|
1150
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
1030
1151
|
// Build anticlockwise order by keeping the first item, reversing the rest
|
|
1031
1152
|
const legends = Object.keys(mapLegendToDataPoint);
|
|
1032
1153
|
const reorderedEntries = legends.length > 1 ? [
|
|
@@ -1058,7 +1179,10 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
1058
1179
|
'percent+label'
|
|
1059
1180
|
].includes(firstData.textinfo) : true,
|
|
1060
1181
|
roundCorners: true,
|
|
1061
|
-
order: 'sorted'
|
|
1182
|
+
order: 'sorted',
|
|
1183
|
+
...titleStyles ? {
|
|
1184
|
+
titleStyles
|
|
1185
|
+
} : {}
|
|
1062
1186
|
};
|
|
1063
1187
|
};
|
|
1064
1188
|
const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
|
|
@@ -1212,7 +1336,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1212
1336
|
}
|
|
1213
1337
|
});
|
|
1214
1338
|
const vsbcData = Object.values(mapXToDataPoints);
|
|
1215
|
-
const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
|
|
1339
|
+
const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
|
|
1216
1340
|
var _input_layout_height;
|
|
1217
1341
|
return {
|
|
1218
1342
|
data: vsbcData,
|
|
@@ -1357,7 +1481,7 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1357
1481
|
});
|
|
1358
1482
|
}
|
|
1359
1483
|
});
|
|
1360
|
-
const annotations = getChartAnnotationsFromLayout(processedInput.layout, isMultiPlot);
|
|
1484
|
+
const annotations = getChartAnnotationsFromLayout(processedInput.data, processedInput.layout, isMultiPlot);
|
|
1361
1485
|
var _processedInput_layout_height;
|
|
1362
1486
|
return {
|
|
1363
1487
|
dataV2: gvbcDataV2,
|
|
@@ -1454,7 +1578,7 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
|
|
|
1454
1578
|
});
|
|
1455
1579
|
});
|
|
1456
1580
|
});
|
|
1457
|
-
const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
|
|
1581
|
+
const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
|
|
1458
1582
|
var _input_layout_height;
|
|
1459
1583
|
return {
|
|
1460
1584
|
data: vbcData,
|
|
@@ -1673,7 +1797,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
1673
1797
|
...lineShape
|
|
1674
1798
|
]
|
|
1675
1799
|
};
|
|
1676
|
-
const annotations = getChartAnnotationsFromLayout(input.layout, isMultiPlot);
|
|
1800
|
+
const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
|
|
1677
1801
|
var _input_layout_height;
|
|
1678
1802
|
const commonProps = {
|
|
1679
1803
|
supportNegativeData: true,
|
|
@@ -1731,7 +1855,7 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
|
|
|
1731
1855
|
const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color, colorMap, isDarkTheme);
|
|
1732
1856
|
const legend = legends[index];
|
|
1733
1857
|
return series.y.map((yValue, i)=>{
|
|
1734
|
-
var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
|
|
1858
|
+
var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x, _series_text;
|
|
1735
1859
|
if ((0, _chartutilities.isInvalidValue)(yValue)) {
|
|
1736
1860
|
return null;
|
|
1737
1861
|
}
|
|
@@ -1745,7 +1869,10 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
|
|
|
1745
1869
|
legend,
|
|
1746
1870
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
1747
1871
|
opacity
|
|
1748
|
-
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
1872
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
1873
|
+
...((_series_text = series.text) === null || _series_text === void 0 ? void 0 : _series_text[i]) ? {
|
|
1874
|
+
barLabel: series.text[i].toString()
|
|
1875
|
+
} : {}
|
|
1749
1876
|
};
|
|
1750
1877
|
}).filter((point)=>point !== null);
|
|
1751
1878
|
}).flat();
|
|
@@ -2056,7 +2183,7 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
2056
2183
|
};
|
|
2057
2184
|
};
|
|
2058
2185
|
const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
2059
|
-
var _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _node_label, _input_layout2, _input_layout3;
|
|
2186
|
+
var _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _node_label, _input_layout2, _input_layout3, _input_layout4;
|
|
2060
2187
|
const { link, node } = input.data[0];
|
|
2061
2188
|
var _link_value;
|
|
2062
2189
|
const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>{
|
|
@@ -2098,7 +2225,7 @@ const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorway
|
|
|
2098
2225
|
// ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),
|
|
2099
2226
|
// },
|
|
2100
2227
|
// };
|
|
2101
|
-
const { chartTitle } = getTitles(input.layout);
|
|
2228
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2102
2229
|
var _input_layout_height;
|
|
2103
2230
|
return {
|
|
2104
2231
|
data: {
|
|
@@ -2106,7 +2233,13 @@ const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorway
|
|
|
2106
2233
|
SankeyChartData: sankeyChartData
|
|
2107
2234
|
},
|
|
2108
2235
|
width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
|
|
2109
|
-
height: (_input_layout_height = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468
|
|
2236
|
+
height: (_input_layout_height = (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 468,
|
|
2237
|
+
// TODO
|
|
2238
|
+
// styles,
|
|
2239
|
+
hideLegend: isMultiPlot || ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.showlegend) === false,
|
|
2240
|
+
...titleStyles ? {
|
|
2241
|
+
titleStyles
|
|
2242
|
+
} : {}
|
|
2110
2243
|
};
|
|
2111
2244
|
};
|
|
2112
2245
|
const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -2157,7 +2290,7 @@ const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
2157
2290
|
const styles = {
|
|
2158
2291
|
sublabel: sublabelColor
|
|
2159
2292
|
};
|
|
2160
|
-
const { chartTitle } = getTitles(input.layout);
|
|
2293
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2161
2294
|
var _firstData_value2, _input_layout_height;
|
|
2162
2295
|
return {
|
|
2163
2296
|
segments,
|
|
@@ -2178,7 +2311,10 @@ const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
2178
2311
|
// styles,
|
|
2179
2312
|
variant: ((_firstData_gauge9 = firstData.gauge) === null || _firstData_gauge9 === void 0 ? void 0 : (_firstData_gauge_steps1 = _firstData_gauge9.steps) === null || _firstData_gauge_steps1 === void 0 ? void 0 : _firstData_gauge_steps1.length) ? 'multiple-segments' : 'single-segment',
|
|
2180
2313
|
styles,
|
|
2181
|
-
roundCorners: true
|
|
2314
|
+
roundCorners: true,
|
|
2315
|
+
...titleStyles ? {
|
|
2316
|
+
titleStyles
|
|
2317
|
+
} : {}
|
|
2182
2318
|
};
|
|
2183
2319
|
};
|
|
2184
2320
|
const cleanText = (text)=>{
|
|
@@ -2321,13 +2457,18 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
|
|
|
2321
2457
|
},
|
|
2322
2458
|
values: (_ref = (_tableHeader_values = tableHeader === null || tableHeader === void 0 ? void 0 : tableHeader.values) !== null && _tableHeader_values !== void 0 ? _tableHeader_values : templateHeader === null || templateHeader === void 0 ? void 0 : templateHeader.values) !== null && _ref !== void 0 ? _ref : []
|
|
2323
2459
|
};
|
|
2460
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2324
2461
|
var _tableData_header_values;
|
|
2325
2462
|
return {
|
|
2326
2463
|
headers: normalizeHeaders((_tableData_header_values = (_tableData_header = tableData.header) === null || _tableData_header === void 0 ? void 0 : _tableData_header.values) !== null && _tableData_header_values !== void 0 ? _tableData_header_values : [], header),
|
|
2327
2464
|
rows,
|
|
2328
2465
|
width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
|
|
2329
2466
|
height: (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height,
|
|
2330
|
-
styles
|
|
2467
|
+
styles,
|
|
2468
|
+
chartTitle,
|
|
2469
|
+
...titleStyles ? {
|
|
2470
|
+
titleStyles
|
|
2471
|
+
} : {}
|
|
2331
2472
|
};
|
|
2332
2473
|
};
|
|
2333
2474
|
function getCategoriesAndValues(series) {
|
|
@@ -2471,151 +2612,90 @@ const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorMap, col
|
|
|
2471
2612
|
});
|
|
2472
2613
|
});
|
|
2473
2614
|
}
|
|
2615
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2474
2616
|
return {
|
|
2475
2617
|
data: funnelData,
|
|
2618
|
+
chartTitle,
|
|
2476
2619
|
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
2477
2620
|
height: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height,
|
|
2478
2621
|
orientation: ((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.orientation) === 'v' ? 'horizontal' : 'vertical',
|
|
2479
|
-
hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false
|
|
2622
|
+
hideLegend: isMultiPlot || ((_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.showlegend) === false,
|
|
2623
|
+
...titleStyles ? {
|
|
2624
|
+
titleStyles
|
|
2625
|
+
} : {}
|
|
2480
2626
|
};
|
|
2481
2627
|
};
|
|
2482
|
-
const
|
|
2628
|
+
const transformPlotlyJsonToPolarChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
2483
2629
|
var _input_layout, _input_layout1;
|
|
2484
|
-
const
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
let categorical = false;
|
|
2538
|
-
if (!(0, _chartutilities.isNumberArray)(thetas)) {
|
|
2539
|
-
uniqueTheta = Array.from(new Set(thetas));
|
|
2540
|
-
categorical = true;
|
|
2541
|
-
}
|
|
2542
|
-
for(let ptindex = 0; ptindex < rVals.length; ptindex++){
|
|
2543
|
-
if ((0, _chartutilities.isInvalidValue)(thetas === null || thetas === void 0 ? void 0 : thetas[ptindex]) || (0, _chartutilities.isInvalidValue)(rVals === null || rVals === void 0 ? void 0 : rVals[ptindex])) {
|
|
2544
|
-
continue;
|
|
2545
|
-
}
|
|
2546
|
-
// Map theta to angle in radians
|
|
2547
|
-
let thetaRad;
|
|
2548
|
-
if (categorical) {
|
|
2549
|
-
const idx = uniqueTheta.indexOf(thetas[ptindex]);
|
|
2550
|
-
const step = 2 * Math.PI / uniqueTheta.length;
|
|
2551
|
-
thetaRad = startAngleInRad + dirMultiplier * idx * step;
|
|
2630
|
+
const polarData = [];
|
|
2631
|
+
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
2632
|
+
const resolveRValue = getAxisValueResolver(getPolarAxis(input.data, 'r', input.layout)._type);
|
|
2633
|
+
input.data.forEach((series, index)=>{
|
|
2634
|
+
const legend = legends[index];
|
|
2635
|
+
if (series.type === 'scatterpolar') {
|
|
2636
|
+
var _series_line, _series_marker, _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_r;
|
|
2637
|
+
const isAreaTrace = series.fill === 'toself' || series.fill === 'tonext';
|
|
2638
|
+
const isLineTrace = typeof series.mode === 'undefined' ? true : series.mode.includes('lines');
|
|
2639
|
+
const colors = isAreaTrace ? series.fillcolor : isLineTrace ? (_series_line = series.line) === null || _series_line === void 0 ? void 0 : _series_line.color : (_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color;
|
|
2640
|
+
const extractedColors = (0, _PlotlyColorAdapter.extractColor)((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, colorwayType, colors, colorMap, isDarkTheme);
|
|
2641
|
+
const seriesColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, legend, colorMap, (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_template1 = _input_layout1.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_layout1 = _input_layout_template1.layout) === null || _input_layout_template_layout1 === void 0 ? void 0 : _input_layout_template_layout1.colorway, isDarkTheme);
|
|
2642
|
+
const seriesOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
|
|
2643
|
+
const finalSeriesColor = (0, _d3color.rgb)(seriesColor).copy({
|
|
2644
|
+
opacity: seriesOpacity
|
|
2645
|
+
}).formatHex8();
|
|
2646
|
+
const lineOptions = getLineOptions(series.line);
|
|
2647
|
+
const thetaUnit = series.thetaunit;
|
|
2648
|
+
const commonProps = {
|
|
2649
|
+
legend,
|
|
2650
|
+
legendShape: getLegendShape(series),
|
|
2651
|
+
color: finalSeriesColor,
|
|
2652
|
+
data: ((_series_r = series.r) === null || _series_r === void 0 ? void 0 : _series_r.map((r, rIndex)=>{
|
|
2653
|
+
var _series_theta, _series_marker, _series_marker1, _input_layout_template_layout, _input_layout_template, _input_layout;
|
|
2654
|
+
const theta = (_series_theta = series.theta) === null || _series_theta === void 0 ? void 0 : _series_theta[rIndex];
|
|
2655
|
+
const markerSize = Array.isArray((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.size) ? series.marker.size[rIndex] : (_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.size;
|
|
2656
|
+
const text = Array.isArray(series.text) ? series.text[rIndex] : series.text;
|
|
2657
|
+
const markerColor = (0, _PlotlyColorAdapter.resolveColor)(extractedColors, rIndex, legend, colorMap, (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_template = _input_layout.template) === null || _input_layout_template === void 0 ? void 0 : (_input_layout_template_layout = _input_layout_template.layout) === null || _input_layout_template_layout === void 0 ? void 0 : _input_layout_template_layout.colorway, isDarkTheme);
|
|
2658
|
+
const markerOpacity = (0, _PlotlyColorAdapter.getOpacity)(series, rIndex);
|
|
2659
|
+
if ((0, _chartutilities.isInvalidValue)(resolveRValue(r)) || (0, _chartutilities.isInvalidValue)(theta)) {
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
return {
|
|
2663
|
+
r: resolveRValue(r),
|
|
2664
|
+
theta: typeof theta === 'number' ? thetaUnit === 'radians' ? theta * 180 / Math.PI : thetaUnit === 'gradians' ? theta * 0.9 : theta : theta,
|
|
2665
|
+
color: markerColor ? (0, _d3color.rgb)(markerColor).copy({
|
|
2666
|
+
opacity: markerOpacity
|
|
2667
|
+
}).formatHex8() : finalSeriesColor,
|
|
2668
|
+
...typeof markerSize !== 'undefined' ? {
|
|
2669
|
+
markerSize
|
|
2670
|
+
} : {},
|
|
2671
|
+
...typeof text !== 'undefined' ? {
|
|
2672
|
+
text
|
|
2673
|
+
} : {}
|
|
2674
|
+
};
|
|
2675
|
+
}).filter((item)=>typeof item !== 'undefined')) || []
|
|
2676
|
+
};
|
|
2677
|
+
if (isAreaTrace || isLineTrace) {
|
|
2678
|
+
polarData.push({
|
|
2679
|
+
type: isAreaTrace ? 'areapolar' : 'linepolar',
|
|
2680
|
+
...commonProps,
|
|
2681
|
+
lineOptions
|
|
2682
|
+
});
|
|
2552
2683
|
} else {
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
const polarRadius = rawRadius + radiusShift; // Only for projection
|
|
2558
|
-
// Calculate cartesian coordinates (with shifted polar origin)
|
|
2559
|
-
const x = polarRadius * Math.cos(thetaRad);
|
|
2560
|
-
const y = polarRadius * Math.sin(thetaRad);
|
|
2561
|
-
// Calculate the cartesian coordinates of the original polar origin (0,0)
|
|
2562
|
-
// This is the point that should be mapped to (0,0) in cartesian coordinates
|
|
2563
|
-
if (sindex === 0 && ptindex === 0) {
|
|
2564
|
-
// For polar origin (r=0, θ=0), cartesian coordinates are (0,0)
|
|
2565
|
-
// But since we shifted the radius by radiusShift, the cartesian origin is at (radiusShift, 0)
|
|
2566
|
-
originX = radiusShift;
|
|
2567
|
-
}
|
|
2568
|
-
series.x.push(x);
|
|
2569
|
-
series.y.push(y);
|
|
2570
|
-
allX.push(x);
|
|
2571
|
-
allY.push(y);
|
|
2572
|
-
}
|
|
2573
|
-
// Map text to each data point for downstream chart rendering
|
|
2574
|
-
if (series.x && series.y) {
|
|
2575
|
-
series.data = series.x.map((xVal, idx)=>({
|
|
2576
|
-
x: xVal,
|
|
2577
|
-
y: series.y[idx],
|
|
2578
|
-
...series.text ? {
|
|
2579
|
-
text: series.text[idx]
|
|
2580
|
-
} : {}
|
|
2581
|
-
}));
|
|
2582
|
-
}
|
|
2583
|
-
projection.data[sindex] = series;
|
|
2584
|
-
}
|
|
2585
|
-
// 7. Recenter all cartesian coordinates
|
|
2586
|
-
if (originX !== null) {
|
|
2587
|
-
for(let sindex = 0; sindex < projection.data.length; sindex++){
|
|
2588
|
-
const series = projection.data[sindex];
|
|
2589
|
-
if (series.x && series.y) {
|
|
2590
|
-
series.x = series.x.map((v)=>v - originX);
|
|
2684
|
+
polarData.push({
|
|
2685
|
+
type: 'scatterpolar',
|
|
2686
|
+
...commonProps
|
|
2687
|
+
});
|
|
2591
2688
|
}
|
|
2592
2689
|
}
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
// 9. Rescale all points so that the largest |x| or |y| is 0.5
|
|
2602
|
-
for(let sindex = 0; sindex < projection.data.length; sindex++){
|
|
2603
|
-
const series = projection.data[sindex];
|
|
2604
|
-
if (series.x && series.y) {
|
|
2605
|
-
series.x = series.x.map((v)=>v / (2 * maxAbs));
|
|
2606
|
-
series.y = series.y.map((v)=>v / (2 * maxAbs));
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2609
|
-
// 10. Customize layout for perfect square with absolute positioning
|
|
2610
|
-
const size = ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width) || ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) || 500;
|
|
2611
|
-
projection.layout = {
|
|
2612
|
-
...projection.layout,
|
|
2613
|
-
width: size,
|
|
2614
|
-
height: size
|
|
2690
|
+
});
|
|
2691
|
+
var _input_layout_height;
|
|
2692
|
+
return {
|
|
2693
|
+
data: polarData,
|
|
2694
|
+
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
2695
|
+
height: (_input_layout_height = (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 400,
|
|
2696
|
+
hideLegend,
|
|
2697
|
+
...getPolarAxisProps(input.data, input.layout)
|
|
2615
2698
|
};
|
|
2616
|
-
// Attach originX as custom properties
|
|
2617
|
-
projection.layout.__polarOriginX = originX !== null && originX !== void 0 ? originX : undefined;
|
|
2618
|
-
return projection;
|
|
2619
2699
|
};
|
|
2620
2700
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2621
2701
|
function isPlainObject(obj) {
|
|
@@ -2928,7 +3008,8 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
2928
3008
|
const xAxisLayout = layout[key];
|
|
2929
3009
|
const domainXInfo = {
|
|
2930
3010
|
start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
|
|
2931
|
-
end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1
|
|
3011
|
+
end: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[1] : 1,
|
|
3012
|
+
cellName: `x${domainX.length === 0 ? '' : domainX.length + 1}`
|
|
2932
3013
|
};
|
|
2933
3014
|
domainX.push(domainXInfo);
|
|
2934
3015
|
} else if (key.startsWith('yaxis')) {
|
|
@@ -2951,7 +3032,8 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
2951
3032
|
const yAxisLayout = layout[key];
|
|
2952
3033
|
const domainYInfo = {
|
|
2953
3034
|
start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
|
|
2954
|
-
end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1
|
|
3035
|
+
end: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[1] : 1,
|
|
3036
|
+
cellName: `x${domainY.length === 0 ? '' : domainY.length + 1}`
|
|
2955
3037
|
};
|
|
2956
3038
|
domainY.push(domainYInfo);
|
|
2957
3039
|
}
|
|
@@ -2964,11 +3046,13 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
2964
3046
|
const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
|
|
2965
3047
|
const domainXInfo = {
|
|
2966
3048
|
start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
|
|
2967
|
-
end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1
|
|
3049
|
+
end: ((_series_domain1 = series.domain) === null || _series_domain1 === void 0 ? void 0 : _series_domain1.x) ? series.domain.x[1] : 1,
|
|
3050
|
+
cellName: `${NON_PLOT_KEY_PREFIX}${domainX.length - cartesianDomains + 1}`
|
|
2968
3051
|
};
|
|
2969
3052
|
const domainYInfo = {
|
|
2970
3053
|
start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
|
|
2971
|
-
end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1
|
|
3054
|
+
end: ((_series_domain3 = series.domain) === null || _series_domain3 === void 0 ? void 0 : _series_domain3.y) ? series.domain.y[1] : 1,
|
|
3055
|
+
cellName: `${NON_PLOT_KEY_PREFIX}${domainY.length - cartesianDomains + 1}`
|
|
2972
3056
|
};
|
|
2973
3057
|
domainX.push(domainXInfo);
|
|
2974
3058
|
domainY.push(domainYInfo);
|
|
@@ -2976,6 +3060,24 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
2976
3060
|
});
|
|
2977
3061
|
if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
|
|
2978
3062
|
var _layout_annotations;
|
|
3063
|
+
Object.keys(layout !== null && layout !== void 0 ? layout : {}).forEach((key)=>{
|
|
3064
|
+
if (key.startsWith('polar')) {
|
|
3065
|
+
var _polarLayout_domain, _polarLayout_domain1, _polarLayout_domain2, _polarLayout_domain3;
|
|
3066
|
+
const polarLayout = layout[key];
|
|
3067
|
+
const domainXInfo = {
|
|
3068
|
+
start: ((_polarLayout_domain = polarLayout.domain) === null || _polarLayout_domain === void 0 ? void 0 : _polarLayout_domain.x) ? polarLayout.domain.x[0] : 0,
|
|
3069
|
+
end: ((_polarLayout_domain1 = polarLayout.domain) === null || _polarLayout_domain1 === void 0 ? void 0 : _polarLayout_domain1.x) ? polarLayout.domain.x[1] : 1,
|
|
3070
|
+
cellName: key
|
|
3071
|
+
};
|
|
3072
|
+
const domainYInfo = {
|
|
3073
|
+
start: ((_polarLayout_domain2 = polarLayout.domain) === null || _polarLayout_domain2 === void 0 ? void 0 : _polarLayout_domain2.y) ? polarLayout.domain.y[0] : 0,
|
|
3074
|
+
end: ((_polarLayout_domain3 = polarLayout.domain) === null || _polarLayout_domain3 === void 0 ? void 0 : _polarLayout_domain3.y) ? polarLayout.domain.y[1] : 1,
|
|
3075
|
+
cellName: key
|
|
3076
|
+
};
|
|
3077
|
+
domainX.push(domainXInfo);
|
|
3078
|
+
domainY.push(domainYInfo);
|
|
3079
|
+
}
|
|
3080
|
+
});
|
|
2979
3081
|
(_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
|
|
2980
3082
|
const xMatches = domainX.flatMap((interval, idx)=>(annotation === null || annotation === void 0 ? void 0 : annotation.x) >= interval.start && (annotation === null || annotation === void 0 ? void 0 : annotation.x) <= interval.end ? [
|
|
2981
3083
|
idx
|
|
@@ -3004,7 +3106,6 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
3004
3106
|
const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
|
|
3005
3107
|
templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
|
|
3006
3108
|
domainX.forEach((interval, index)=>{
|
|
3007
|
-
const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
|
|
3008
3109
|
const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
|
|
3009
3110
|
const columnNumber = columnIndex + 1; // Column numbers are 1-based
|
|
3010
3111
|
const annotationProps = annotations[index];
|
|
@@ -3019,7 +3120,7 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
3019
3120
|
end: 1
|
|
3020
3121
|
}
|
|
3021
3122
|
};
|
|
3022
|
-
gridLayout[cellName] = row;
|
|
3123
|
+
gridLayout[interval.cellName] = row;
|
|
3023
3124
|
});
|
|
3024
3125
|
}
|
|
3025
3126
|
if (domainY.length > 0) {
|
|
@@ -3034,12 +3135,11 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
3034
3135
|
const numberOfRows = sortedYStart.length;
|
|
3035
3136
|
templateRows = `repeat(${numberOfRows}, 1fr)`;
|
|
3036
3137
|
domainY.forEach((interval, index)=>{
|
|
3037
|
-
const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
|
|
3038
3138
|
const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
|
|
3039
3139
|
const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
|
|
3040
3140
|
const annotationProps = annotations[index];
|
|
3041
3141
|
const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
|
|
3042
|
-
const cell = gridLayout[cellName];
|
|
3142
|
+
const cell = gridLayout[interval.cellName];
|
|
3043
3143
|
if (cell !== undefined) {
|
|
3044
3144
|
cell.row = rowNumber;
|
|
3045
3145
|
cell.yAnnotation = yAnnotation;
|
|
@@ -3371,3 +3471,109 @@ const getAxisValueResolver = (axType, dateParser)=>{
|
|
|
3371
3471
|
}
|
|
3372
3472
|
return new Date(value);
|
|
3373
3473
|
};
|
|
3474
|
+
const POLAR_AXIS_BY_DATA_KEY = {
|
|
3475
|
+
r: 'radialAxis',
|
|
3476
|
+
theta: 'angularAxis'
|
|
3477
|
+
};
|
|
3478
|
+
const DEFAULT_POLAR_SUBPLOT = 'polar';
|
|
3479
|
+
const getPolarLayout = (trace, layout)=>{
|
|
3480
|
+
const subplotId = (trace === null || trace === void 0 ? void 0 : trace.subplot) || DEFAULT_POLAR_SUBPLOT;
|
|
3481
|
+
return layout === null || layout === void 0 ? void 0 : layout[subplotId];
|
|
3482
|
+
};
|
|
3483
|
+
const getValidAxisValues = (data, dataKey)=>{
|
|
3484
|
+
const values = [];
|
|
3485
|
+
data.forEach((series)=>{
|
|
3486
|
+
if ((0, _chartutilities.isArrayOrTypedArray)(series[dataKey])) {
|
|
3487
|
+
series[dataKey].forEach((val)=>{
|
|
3488
|
+
if (!(0, _chartutilities.isInvalidValue)(val)) {
|
|
3489
|
+
values.push(val);
|
|
3490
|
+
}
|
|
3491
|
+
});
|
|
3492
|
+
}
|
|
3493
|
+
});
|
|
3494
|
+
return values;
|
|
3495
|
+
};
|
|
3496
|
+
const getPolarAxisType = (data, dataKey, declaredType)=>{
|
|
3497
|
+
if ([
|
|
3498
|
+
'linear',
|
|
3499
|
+
'log',
|
|
3500
|
+
'date',
|
|
3501
|
+
'category'
|
|
3502
|
+
].includes(declaredType !== null && declaredType !== void 0 ? declaredType : '')) {
|
|
3503
|
+
return declaredType;
|
|
3504
|
+
}
|
|
3505
|
+
const values = getValidAxisValues(data, dataKey);
|
|
3506
|
+
if ((0, _chartutilities.isNumberArray)(values) && !(0, _chartutilities.isYearArray)(values)) {
|
|
3507
|
+
return 'linear';
|
|
3508
|
+
}
|
|
3509
|
+
if ((0, _chartutilities.isDateArray)(values)) {
|
|
3510
|
+
return 'date';
|
|
3511
|
+
}
|
|
3512
|
+
return 'category';
|
|
3513
|
+
};
|
|
3514
|
+
const getPolarAxis = (data, dataKey, layout)=>{
|
|
3515
|
+
const polarLayout = getPolarLayout(data[0], layout);
|
|
3516
|
+
const ax = polarLayout === null || polarLayout === void 0 ? void 0 : polarLayout[POLAR_AXIS_BY_DATA_KEY[dataKey].toLowerCase()];
|
|
3517
|
+
return {
|
|
3518
|
+
...ax,
|
|
3519
|
+
_dataKey: dataKey,
|
|
3520
|
+
_type: getPolarAxisType(data, dataKey, ax === null || ax === void 0 ? void 0 : ax.type)
|
|
3521
|
+
};
|
|
3522
|
+
};
|
|
3523
|
+
const getPolarAxisTickProps = (data, ax)=>{
|
|
3524
|
+
const props = {};
|
|
3525
|
+
if ((!ax.tickmode || ax.tickmode === 'array') && (0, _chartutilities.isArrayOrTypedArray)(ax.tickvals)) {
|
|
3526
|
+
const tickValues = ax._type === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
|
|
3527
|
+
props.tickValues = tickValues;
|
|
3528
|
+
props.tickText = ax.ticktext;
|
|
3529
|
+
return props;
|
|
3530
|
+
}
|
|
3531
|
+
if ((!ax.tickmode || ax.tickmode === 'linear') && ax.dtick) {
|
|
3532
|
+
const dtick = plotlyDtick(ax.dtick, ax._type);
|
|
3533
|
+
const tick0 = plotlyTick0(ax.tick0, ax._type, dtick);
|
|
3534
|
+
props.tickStep = dtick;
|
|
3535
|
+
props.tick0 = tick0;
|
|
3536
|
+
return props;
|
|
3537
|
+
}
|
|
3538
|
+
if ((!ax.tickmode || ax.tickmode === 'auto') && typeof ax.nticks === 'number' && ax.nticks >= 0) {
|
|
3539
|
+
props.tickCount = ax.nticks;
|
|
3540
|
+
}
|
|
3541
|
+
return props;
|
|
3542
|
+
};
|
|
3543
|
+
const getPolarAxisCategoryOrder = (data, ax)=>{
|
|
3544
|
+
if (ax._type !== 'category') {
|
|
3545
|
+
return 'data';
|
|
3546
|
+
}
|
|
3547
|
+
const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax.categoryarray) && ax.categoryarray.length > 0;
|
|
3548
|
+
if (isValidArray && (!ax.categoryorder || ax.categoryorder === 'array')) {
|
|
3549
|
+
return ax.categoryarray;
|
|
3550
|
+
}
|
|
3551
|
+
if (!ax.categoryorder || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
|
|
3552
|
+
const values = getValidAxisValues(data, ax._dataKey);
|
|
3553
|
+
const categoriesInTraceOrder = Array.from(new Set(values));
|
|
3554
|
+
return ax.autorange === 'reversed' ? categoriesInTraceOrder.reverse() : categoriesInTraceOrder;
|
|
3555
|
+
}
|
|
3556
|
+
return ax.categoryorder;
|
|
3557
|
+
};
|
|
3558
|
+
const getPolarAxisProps = (data, layout)=>{
|
|
3559
|
+
const props = {};
|
|
3560
|
+
Object.keys(POLAR_AXIS_BY_DATA_KEY).forEach((dataKey)=>{
|
|
3561
|
+
const propName = POLAR_AXIS_BY_DATA_KEY[dataKey];
|
|
3562
|
+
const ax = getPolarAxis(data, dataKey, layout);
|
|
3563
|
+
props[propName] = {
|
|
3564
|
+
scaleType: ax._type === 'log' ? 'log' : 'default',
|
|
3565
|
+
categoryOrder: getPolarAxisCategoryOrder(data, ax),
|
|
3566
|
+
tickFormat: ax.tickformat,
|
|
3567
|
+
...getPolarAxisTickProps(data, ax),
|
|
3568
|
+
...(0, _chartutilities.isArrayOrTypedArray)(ax.range) ? {
|
|
3569
|
+
rangeStart: ax.range[0],
|
|
3570
|
+
rangeEnd: ax.range[1]
|
|
3571
|
+
} : {}
|
|
3572
|
+
};
|
|
3573
|
+
if (propName === 'angularAxis') {
|
|
3574
|
+
props[propName].unit = ax.thetaunit;
|
|
3575
|
+
props.direction = ax.direction;
|
|
3576
|
+
}
|
|
3577
|
+
});
|
|
3578
|
+
return props;
|
|
3579
|
+
};
|