@fluentui/react-charts 9.3.7 → 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 +60 -2
- package/dist/index.d.ts +433 -7
- 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/AreaChart/AreaChart.js +1 -28
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +27 -8
- 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 +111 -69
- 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 +54 -4
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
- package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.js +81 -44
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +5 -5
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -3
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.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 +643 -366
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +24 -9
- 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 +33 -8
- 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/GanttChart/GanttChart.js +1 -1
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GaugeChart/GaugeChart.js +13 -9
- 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 +18 -18
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.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 +60 -10
- 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/Legends.js +3 -4
- package/lib/components/Legends/Legends.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 +65 -64
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
- package/lib/components/LineChart/useLineChartStyles.styles.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 +15 -5
- 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 +24 -8
- 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 +13 -25
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js +1 -2
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +13 -78
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +48 -68
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/ChartAnnotation.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 -2
- package/lib/utilities/Common.styles.js.map +1 -1
- package/lib/utilities/Common.styles.raw.js +70 -1
- package/lib/utilities/Common.styles.raw.js.map +1 -1
- package/lib/utilities/image-export-utils.js +4 -4
- package/lib/utilities/image-export-utils.js.map +1 -1
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/index.js.map +1 -1
- package/lib/utilities/utilities.js +219 -77
- 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/AreaChart/AreaChart.js +0 -26
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +27 -8
- 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 +111 -69
- 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 +65 -5
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +31 -18
- package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +80 -43
- 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/CommonComponents/useCartesianChartStyles.styles.js +3 -4
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +3 -2
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.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 +649 -368
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +22 -7
- 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 +31 -6
- 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/GanttChart/GanttChart.js +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GaugeChart/GaugeChart.js +11 -7
- 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 +16 -16
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.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 +59 -9
- 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/Legends.js +3 -4
- package/lib-commonjs/components/Legends/Legends.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 +64 -63
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.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 +15 -5
- 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 -6
- 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 +12 -24
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +12 -77
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +47 -67
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/ChartAnnotation.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 -1
- package/lib-commonjs/utilities/Common.styles.js.map +1 -1
- package/lib-commonjs/utilities/Common.styles.raw.js +69 -1
- package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
- package/lib-commonjs/utilities/image-export-utils.js +3 -3
- package/lib-commonjs/utilities/image-export-utils.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 +235 -78
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +11 -17
- package/lib/components/DeclarativeChart/imageExporter.js +0 -223
- package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
|
@@ -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
|
}
|
|
@@ -313,6 +341,62 @@ const resolveXAxisPoint = (x, isXYearCategory, isXString, isXDate, isXNumber)=>{
|
|
|
313
341
|
}
|
|
314
342
|
return x;
|
|
315
343
|
};
|
|
344
|
+
/**
|
|
345
|
+
* Formats text values according to the texttemplate specification
|
|
346
|
+
* Supports D3 format specifiers within %{text:format} patterns
|
|
347
|
+
* @param textValue The raw text value to format
|
|
348
|
+
* @param textTemplate The template string (e.g., "%{text:.1f}%", "%{text:.2%}", "%{text:,.0f}")
|
|
349
|
+
* @param index Optional index for array-based templates
|
|
350
|
+
* @returns Formatted text string
|
|
351
|
+
*
|
|
352
|
+
* Examples:
|
|
353
|
+
* - "%{text:.1f}%" → Formats number with 1 decimal place and adds % suffix
|
|
354
|
+
* - "%{text:.2%}" → Formats as percentage with 2 decimal places
|
|
355
|
+
* - "%{text:,.0f}" → Formats with thousands separator and no decimals
|
|
356
|
+
* - "%{text:$,.2f}" → Formats as currency with thousands separator and 2 decimals
|
|
357
|
+
*/ const formatTextWithTemplate = (textValue, textTemplate, index)=>{
|
|
358
|
+
if (!textTemplate) {
|
|
359
|
+
return String(textValue);
|
|
360
|
+
}
|
|
361
|
+
const numVal = typeof textValue === 'number' ? textValue : parseFloat(String(textValue));
|
|
362
|
+
if (isNaN(numVal)) {
|
|
363
|
+
return String(textValue);
|
|
364
|
+
}
|
|
365
|
+
const template = typeof textTemplate === 'string' ? textTemplate : textTemplate[index || 0] || '';
|
|
366
|
+
// Match Plotly's texttemplate pattern: %{text:format} or %{text}
|
|
367
|
+
// Can be followed by any literal text like %, $, etc.
|
|
368
|
+
const plotlyPattern = /%\{text(?::([^}]+))?\}(.*)$/;
|
|
369
|
+
const match = template.match(plotlyPattern);
|
|
370
|
+
if (match) {
|
|
371
|
+
const formatSpec = match[1]; // The format specifier (e.g., ".1f", ".2%", ",.0f") or undefined
|
|
372
|
+
const suffix = match[2]; // Any text after the closing brace (e.g., "%", " units")
|
|
373
|
+
// If no format specifier is provided (e.g., %{text}%), try to infer from suffix
|
|
374
|
+
if (!formatSpec) {
|
|
375
|
+
// Check if suffix starts with % - assume simple percentage with 1 decimal
|
|
376
|
+
if (suffix.startsWith('%')) {
|
|
377
|
+
return `${numVal.toFixed(1)}${suffix}`;
|
|
378
|
+
}
|
|
379
|
+
// No format specifier, just return the number with the suffix
|
|
380
|
+
return `${numVal}${suffix}`;
|
|
381
|
+
}
|
|
382
|
+
try {
|
|
383
|
+
// Use D3 format function to apply the format specifier
|
|
384
|
+
const formatter = (0, _d3format.format)(formatSpec);
|
|
385
|
+
const formattedValue = formatter(numVal);
|
|
386
|
+
return `${formattedValue}${suffix}`;
|
|
387
|
+
} catch (error) {
|
|
388
|
+
// Try to extract precision for basic fallback
|
|
389
|
+
const precisionMatch = formatSpec.match(/\.(\d+)[f%]/);
|
|
390
|
+
const precision = precisionMatch ? parseInt(precisionMatch[1], 10) : 2;
|
|
391
|
+
// Check if it's a percentage format
|
|
392
|
+
if (formatSpec.includes('%')) {
|
|
393
|
+
return `${(numVal * 100).toFixed(precision)}%${suffix}`;
|
|
394
|
+
}
|
|
395
|
+
return `${numVal.toFixed(precision)}${suffix}`;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
return String(textValue);
|
|
399
|
+
};
|
|
316
400
|
/**
|
|
317
401
|
* Extracts unique X-axis categories from Plotly data traces
|
|
318
402
|
* @param data Array of Plotly data traces
|
|
@@ -378,60 +462,55 @@ const toFiniteNumber = (value)=>{
|
|
|
378
462
|
return Number.isFinite(numeric) ? numeric : undefined;
|
|
379
463
|
};
|
|
380
464
|
/**
|
|
381
|
-
*
|
|
382
|
-
*/ const
|
|
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)=>{
|
|
383
467
|
if (!ref) {
|
|
384
|
-
return
|
|
468
|
+
return {
|
|
469
|
+
refType: 'axis',
|
|
470
|
+
axisId: 1
|
|
471
|
+
};
|
|
385
472
|
}
|
|
386
|
-
const normalized = ref.toLowerCase();
|
|
387
|
-
if (normalized ===
|
|
388
|
-
return
|
|
473
|
+
const normalized = ref.toLowerCase().trim();
|
|
474
|
+
if (normalized === 'pixel') {
|
|
475
|
+
return {
|
|
476
|
+
refType: 'pixel',
|
|
477
|
+
axisId: 1
|
|
478
|
+
};
|
|
389
479
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
480
|
+
if (normalized === 'paper') {
|
|
481
|
+
return {
|
|
482
|
+
refType: 'relative',
|
|
483
|
+
axisId: 1
|
|
484
|
+
};
|
|
393
485
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
486
|
+
if (normalized.endsWith(' domain')) {
|
|
487
|
+
return normalized.startsWith(axis) ? {
|
|
488
|
+
refType: 'relative',
|
|
489
|
+
axisId: 1
|
|
490
|
+
} : {
|
|
491
|
+
refType: undefined,
|
|
492
|
+
axisId: 1
|
|
493
|
+
};
|
|
401
494
|
}
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
const plotTrace = trace;
|
|
409
|
-
const traceAxisRef = normalizeAxisRef(plotTrace[traceAxisKey], axis);
|
|
410
|
-
if (traceAxisRef !== targetRef) {
|
|
411
|
-
return;
|
|
412
|
-
}
|
|
413
|
-
const values = axis === 'x' ? plotTrace.x : plotTrace.y;
|
|
414
|
-
if (!(0, _chartutilities.isArrayOrTypedArray)(values)) {
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
const arrayLike = values;
|
|
418
|
-
for(let index = 0; index < arrayLike.length; index++){
|
|
419
|
-
const value = arrayLike[index];
|
|
420
|
-
const numeric = toNumericValue(convertDataValue(value, axisLayout));
|
|
421
|
-
if (numeric === undefined || Number.isNaN(numeric)) {
|
|
422
|
-
continue;
|
|
423
|
-
}
|
|
424
|
-
minValue = minValue === undefined ? numeric : Math.min(minValue, numeric);
|
|
425
|
-
maxValue = maxValue === undefined ? numeric : Math.max(maxValue, numeric);
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
if (minValue === undefined || maxValue === undefined || minValue === maxValue) {
|
|
429
|
-
return undefined;
|
|
495
|
+
const match = normalized.match(/^([xy])(axis)?(\d*)$/);
|
|
496
|
+
if (!match || match[1] !== axis) {
|
|
497
|
+
return {
|
|
498
|
+
refType: undefined,
|
|
499
|
+
axisId: 1
|
|
500
|
+
};
|
|
430
501
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
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
|
+
};
|
|
435
514
|
};
|
|
436
515
|
/**
|
|
437
516
|
* Converts Plotly's bottom-origin relative Y coordinate into the SVG top-origin space used by our overlay.
|
|
@@ -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,74 +580,37 @@ 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')) {
|
|
583
|
+
const { refType, axisId } = parseAxisRef(ref, axis);
|
|
584
|
+
if (refType !== 'axis' || axisId === 1) {
|
|
517
585
|
return layout[defaultAxisKey];
|
|
518
586
|
}
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
const index = match[2];
|
|
522
|
-
if (index && index !== '' && index !== '1') {
|
|
523
|
-
const axisKey = `${axis}axis${index}`;
|
|
524
|
-
return layout[axisKey];
|
|
525
|
-
}
|
|
526
|
-
return layout[defaultAxisKey];
|
|
527
|
-
}
|
|
528
|
-
return layout[defaultAxisKey];
|
|
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
|
-
if (
|
|
594
|
+
if (axisType === 'date') {
|
|
537
595
|
const dateValue = value instanceof Date ? value : new Date(value);
|
|
538
596
|
return Number.isNaN(dateValue.getTime()) ? undefined : dateValue;
|
|
539
597
|
}
|
|
540
|
-
if (
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
598
|
+
if (axisType === 'linear' || axisType === 'log') {
|
|
599
|
+
if (typeof value === 'number') {
|
|
600
|
+
return Number.isFinite(value) ? value : undefined;
|
|
601
|
+
}
|
|
544
602
|
const numeric = Number(value);
|
|
545
603
|
return Number.isFinite(numeric) ? numeric : undefined;
|
|
546
604
|
}
|
|
605
|
+
// For category-like axes, preserve raw strings (and avoid date parsing heuristics).
|
|
547
606
|
if (value instanceof Date) {
|
|
548
607
|
return value;
|
|
549
608
|
}
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
const toNumericValue = (value)=>{
|
|
553
|
-
if (value instanceof Date) {
|
|
554
|
-
const timestamp = value.getTime();
|
|
555
|
-
return Number.isFinite(timestamp) ? timestamp : undefined;
|
|
556
|
-
}
|
|
557
|
-
if (typeof value === 'number') {
|
|
558
|
-
return Number.isFinite(value) ? value : undefined;
|
|
559
|
-
}
|
|
560
|
-
if (typeof value === 'string') {
|
|
561
|
-
const numeric = Number(value);
|
|
562
|
-
return Number.isFinite(numeric) ? numeric : undefined;
|
|
609
|
+
if (typeof value === 'number' || typeof value === 'string') {
|
|
610
|
+
return value;
|
|
563
611
|
}
|
|
564
612
|
return undefined;
|
|
565
613
|
};
|
|
566
|
-
const toRelativeCoordinate = (value, axisLayout, fallbackRange)=>{
|
|
567
|
-
const range = Array.isArray(axisLayout === null || axisLayout === void 0 ? void 0 : axisLayout.range) ? axisLayout.range : undefined;
|
|
568
|
-
let start = range && range.length >= 2 ? toNumericValue(convertDataValue(range[0], axisLayout)) : undefined;
|
|
569
|
-
let end = range && range.length >= 2 ? toNumericValue(convertDataValue(range[1], axisLayout)) : undefined;
|
|
570
|
-
if ((start === undefined || end === undefined || start === end) && fallbackRange) {
|
|
571
|
-
[start, end] = fallbackRange;
|
|
572
|
-
}
|
|
573
|
-
const current = toNumericValue(convertDataValue(value, axisLayout));
|
|
574
|
-
if (start === undefined || end === undefined || current === undefined || start === end) {
|
|
575
|
-
return undefined;
|
|
576
|
-
}
|
|
577
|
-
const relative = (current - start) / (end - start);
|
|
578
|
-
return Number.isFinite(relative) ? relative : undefined;
|
|
579
|
-
};
|
|
580
614
|
const createAnnotationId = (text, index)=>{
|
|
581
615
|
const normalized = text.replace(/\s+/g, ' ').trim();
|
|
582
616
|
if (normalized) {
|
|
@@ -640,10 +674,37 @@ const mapArrowDashToPattern = (value)=>{
|
|
|
640
674
|
return value;
|
|
641
675
|
}
|
|
642
676
|
};
|
|
677
|
+
const mapRefTypeToCoordinateType = (refType)=>{
|
|
678
|
+
return refType === 'axis' ? 'data' : refType;
|
|
679
|
+
};
|
|
680
|
+
const normalizeCoordinateValueForType = (coordinateType, value)=>{
|
|
681
|
+
if (coordinateType === 'data') {
|
|
682
|
+
return value;
|
|
683
|
+
}
|
|
684
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
685
|
+
};
|
|
686
|
+
const getAnnotationCoordinateValue = (axis, refType, annotation, layout)=>{
|
|
687
|
+
if (refType === 'axis') {
|
|
688
|
+
const axisRef = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.xref : annotation === null || annotation === void 0 ? void 0 : annotation.yref;
|
|
689
|
+
const axisLayout = getAxisLayoutByRef(layout, axisRef, axis);
|
|
690
|
+
const rawValue = axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y;
|
|
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);
|
|
694
|
+
}
|
|
695
|
+
const numericValue = toFiniteNumber(axis === 'x' ? annotation === null || annotation === void 0 ? void 0 : annotation.x : annotation === null || annotation === void 0 ? void 0 : annotation.y);
|
|
696
|
+
if (numericValue === undefined) {
|
|
697
|
+
return undefined;
|
|
698
|
+
}
|
|
699
|
+
if (refType === 'relative') {
|
|
700
|
+
return axis === 'y' ? transformRelativeYForChart(numericValue) : numericValue;
|
|
701
|
+
}
|
|
702
|
+
return numericValue;
|
|
703
|
+
};
|
|
643
704
|
/**
|
|
644
705
|
* Converts a Plotly annotation definition into the internal `ChartAnnotation` format, translating coordinates,
|
|
645
706
|
* layout alignment, styling, and connector metadata while skipping unsupported configurations.
|
|
646
|
-
*/ const convertPlotlyAnnotation = (annotation, layout,
|
|
707
|
+
*/ const convertPlotlyAnnotation = (annotation, layout, index)=>{
|
|
647
708
|
if (!annotation || annotation.visible === false) {
|
|
648
709
|
return undefined;
|
|
649
710
|
}
|
|
@@ -652,77 +713,51 @@ const mapArrowDashToPattern = (value)=>{
|
|
|
652
713
|
if (!xRefType || !yRefType) {
|
|
653
714
|
return undefined;
|
|
654
715
|
}
|
|
716
|
+
const xValue = getAnnotationCoordinateValue('x', xRefType, annotation, layout);
|
|
717
|
+
const yValue = getAnnotationCoordinateValue('y', yRefType, annotation, layout);
|
|
718
|
+
if (xValue === undefined || yValue === undefined) {
|
|
719
|
+
return undefined;
|
|
720
|
+
}
|
|
721
|
+
const xCoordinateType = mapRefTypeToCoordinateType(xRefType);
|
|
722
|
+
const yCoordinateType = mapRefTypeToCoordinateType(yRefType);
|
|
723
|
+
const normalizedX = normalizeCoordinateValueForType(xCoordinateType, xValue);
|
|
724
|
+
const normalizedY = normalizeCoordinateValueForType(yCoordinateType, yValue);
|
|
725
|
+
if (normalizedX === undefined || normalizedY === undefined) {
|
|
726
|
+
return undefined;
|
|
727
|
+
}
|
|
728
|
+
const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
|
|
729
|
+
const yAxisProps = yCoordinateType === 'data' && yRefNormalized === 'y2' ? {
|
|
730
|
+
yAxis: 'secondary'
|
|
731
|
+
} : undefined;
|
|
655
732
|
let coordinates;
|
|
656
|
-
if (
|
|
657
|
-
const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
|
|
658
|
-
const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
|
|
659
|
-
const xValue = convertDataValue(annotation.x, xAxisLayout);
|
|
660
|
-
const yValue = convertDataValue(annotation.y, yAxisLayout);
|
|
661
|
-
if (xValue === undefined || yValue === undefined) {
|
|
662
|
-
return undefined;
|
|
663
|
-
}
|
|
664
|
-
const yRefNormalized = typeof annotation.yref === 'string' ? annotation.yref.toLowerCase() : undefined;
|
|
733
|
+
if (xCoordinateType === 'data' && yCoordinateType === 'data') {
|
|
665
734
|
coordinates = {
|
|
666
735
|
type: 'data',
|
|
667
|
-
x:
|
|
668
|
-
y:
|
|
669
|
-
...
|
|
670
|
-
yAxis: 'secondary'
|
|
671
|
-
} : {}
|
|
736
|
+
x: normalizedX,
|
|
737
|
+
y: normalizedY,
|
|
738
|
+
...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
|
|
672
739
|
};
|
|
673
|
-
} else if (
|
|
674
|
-
const xValue = toFiniteNumber(annotation.x);
|
|
675
|
-
const yValue = toFiniteNumber(annotation.y);
|
|
676
|
-
const chartRelativeY = transformRelativeYForChart(yValue);
|
|
677
|
-
if (xValue === undefined || chartRelativeY === undefined) {
|
|
678
|
-
return undefined;
|
|
679
|
-
}
|
|
680
|
-
coordinates = {
|
|
681
|
-
type: 'relative',
|
|
682
|
-
x: xValue,
|
|
683
|
-
y: chartRelativeY
|
|
684
|
-
};
|
|
685
|
-
} else if (xRefType === 'relative' && yRefType === 'axis') {
|
|
686
|
-
const xValue = toFiniteNumber(annotation.x);
|
|
687
|
-
const yAxisLayout = getAxisLayoutByRef(layout, annotation.yref, 'y');
|
|
688
|
-
const yFallbackRange = getAxisNumericRangeFromData('y', annotation.yref, layout, data);
|
|
689
|
-
const yRelative = toRelativeCoordinate(annotation.y, yAxisLayout, yFallbackRange);
|
|
690
|
-
const chartRelativeY = transformRelativeYForChart(yRelative);
|
|
691
|
-
if (xValue === undefined || chartRelativeY === undefined) {
|
|
692
|
-
return undefined;
|
|
693
|
-
}
|
|
694
|
-
coordinates = {
|
|
695
|
-
type: 'relative',
|
|
696
|
-
x: xValue,
|
|
697
|
-
y: chartRelativeY
|
|
698
|
-
};
|
|
699
|
-
} else if (xRefType === 'axis' && yRefType === 'relative') {
|
|
700
|
-
const yValue = toFiniteNumber(annotation.y);
|
|
701
|
-
const xAxisLayout = getAxisLayoutByRef(layout, annotation.xref, 'x');
|
|
702
|
-
const xFallbackRange = getAxisNumericRangeFromData('x', annotation.xref, layout, data);
|
|
703
|
-
const xRelative = toRelativeCoordinate(annotation.x, xAxisLayout, xFallbackRange);
|
|
704
|
-
const chartRelativeY = transformRelativeYForChart(yValue);
|
|
705
|
-
if (xRelative === undefined || chartRelativeY === undefined) {
|
|
706
|
-
return undefined;
|
|
707
|
-
}
|
|
740
|
+
} else if (xCoordinateType === 'relative' && yCoordinateType === 'relative') {
|
|
708
741
|
coordinates = {
|
|
709
742
|
type: 'relative',
|
|
710
|
-
x:
|
|
711
|
-
y:
|
|
743
|
+
x: normalizedX,
|
|
744
|
+
y: normalizedY
|
|
712
745
|
};
|
|
713
|
-
} else if (
|
|
714
|
-
const xValue = toFiniteNumber(annotation.x);
|
|
715
|
-
const yValue = toFiniteNumber(annotation.y);
|
|
716
|
-
if (xValue === undefined || yValue === undefined) {
|
|
717
|
-
return undefined;
|
|
718
|
-
}
|
|
746
|
+
} else if (xCoordinateType === 'pixel' && yCoordinateType === 'pixel') {
|
|
719
747
|
coordinates = {
|
|
720
748
|
type: 'pixel',
|
|
721
|
-
x:
|
|
722
|
-
y:
|
|
749
|
+
x: normalizedX,
|
|
750
|
+
y: normalizedY
|
|
723
751
|
};
|
|
724
752
|
} else {
|
|
725
|
-
|
|
753
|
+
coordinates = {
|
|
754
|
+
type: 'mixed',
|
|
755
|
+
xCoordinateType,
|
|
756
|
+
yCoordinateType,
|
|
757
|
+
x: normalizedX,
|
|
758
|
+
y: normalizedY,
|
|
759
|
+
...yAxisProps !== null && yAxisProps !== void 0 ? yAxisProps : {}
|
|
760
|
+
};
|
|
726
761
|
}
|
|
727
762
|
const textValue = annotation.text;
|
|
728
763
|
const rawText = textValue === undefined || textValue === null ? '' : String(textValue);
|
|
@@ -879,14 +914,82 @@ const mapArrowDashToPattern = (value)=>{
|
|
|
879
914
|
}
|
|
880
915
|
return chartAnnotation;
|
|
881
916
|
};
|
|
882
|
-
const getChartAnnotationsFromLayout = (
|
|
917
|
+
const getChartAnnotationsFromLayout = (data, layout, isMultiPlot)=>{
|
|
883
918
|
if (isMultiPlot || !(layout === null || layout === void 0 ? void 0 : layout.annotations)) {
|
|
884
919
|
return undefined;
|
|
885
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
|
+
})();
|
|
886
989
|
const annotationsArray = Array.isArray(layout.annotations) ? layout.annotations : [
|
|
887
990
|
layout.annotations
|
|
888
991
|
];
|
|
889
|
-
const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation,
|
|
992
|
+
const converted = annotationsArray.map((annotation, index)=>convertPlotlyAnnotation(annotation, inferredLayout, index)).filter((annotation)=>annotation !== undefined);
|
|
890
993
|
return converted.length > 0 ? converted : undefined;
|
|
891
994
|
};
|
|
892
995
|
const normalizeObjectArrayForGVBC = (data, xLabels)=>{
|
|
@@ -963,7 +1066,7 @@ const normalizeObjectArrayForGVBC = (data, xLabels)=>{
|
|
|
963
1066
|
const transformPlotlyJsonToAnnotationChartProps = (input, isMultiPlot, _colorMap, _colorwayType, _isDarkTheme)=>{
|
|
964
1067
|
var _layoutWithMeta_meta, _input_layout, _input_layout1, _input_layout2, _input_layout3, _input_layout_font, _input_layout4, _input_layout_font1, _input_layout5, _input_layout6;
|
|
965
1068
|
var _getChartAnnotationsFromLayout;
|
|
966
|
-
const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.
|
|
1069
|
+
const annotations = (_getChartAnnotationsFromLayout = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot)) !== null && _getChartAnnotationsFromLayout !== void 0 ? _getChartAnnotationsFromLayout : [];
|
|
967
1070
|
const titles = getTitles(input.layout);
|
|
968
1071
|
const layoutTitle = titles.chartTitle || undefined;
|
|
969
1072
|
const layoutWithMeta = input.layout;
|
|
@@ -1038,12 +1141,13 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
1038
1141
|
const hideLabels = firstData.textinfo ? ![
|
|
1039
1142
|
'value',
|
|
1040
1143
|
'percent',
|
|
1041
|
-
'label+percent'
|
|
1144
|
+
'label+percent',
|
|
1145
|
+
'percent+label'
|
|
1042
1146
|
].includes(firstData.textinfo) : false;
|
|
1043
1147
|
const donutMarginHorizontal = hideLabels ? 0 : 80;
|
|
1044
1148
|
const donutMarginVertical = 40 + (hideLabels ? 0 : 40);
|
|
1045
1149
|
const innerRadius = firstData.hole ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2) : _utilities.MIN_DONUT_RADIUS;
|
|
1046
|
-
const { chartTitle } = getTitles(input.layout);
|
|
1150
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
1047
1151
|
// Build anticlockwise order by keeping the first item, reversing the rest
|
|
1048
1152
|
const legends = Object.keys(mapLegendToDataPoint);
|
|
1049
1153
|
const reorderedEntries = legends.length > 1 ? [
|
|
@@ -1071,14 +1175,18 @@ const transformPlotlyJsonToDonutProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
1071
1175
|
hideLabels,
|
|
1072
1176
|
showLabelsInPercent: firstData.textinfo ? [
|
|
1073
1177
|
'percent',
|
|
1074
|
-
'label+percent'
|
|
1178
|
+
'label+percent',
|
|
1179
|
+
'percent+label'
|
|
1075
1180
|
].includes(firstData.textinfo) : true,
|
|
1076
1181
|
roundCorners: true,
|
|
1077
|
-
order: 'sorted'
|
|
1182
|
+
order: 'sorted',
|
|
1183
|
+
...titleStyles ? {
|
|
1184
|
+
titleStyles
|
|
1185
|
+
} : {}
|
|
1078
1186
|
};
|
|
1079
1187
|
};
|
|
1080
1188
|
const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme, fallbackVSBC)=>{
|
|
1081
|
-
var _input_layout, _input_layout1, _input_layout2
|
|
1189
|
+
var _input_layout, _input_layout1, _input_layout2;
|
|
1082
1190
|
const mapXToDataPoints = {};
|
|
1083
1191
|
let yMaxValue = 0;
|
|
1084
1192
|
let yMinValue = 0;
|
|
@@ -1098,6 +1206,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1098
1206
|
validXYRanges.forEach(([rangeStart, rangeEnd], rangeIdx)=>{
|
|
1099
1207
|
const rangeXValues = series.x.slice(rangeStart, rangeEnd);
|
|
1100
1208
|
const rangeYValues = series.y.slice(rangeStart, rangeEnd);
|
|
1209
|
+
const textValues = Array.isArray(series.text) ? series.text.slice(rangeStart, rangeEnd) : typeof series.text === 'string' ? series.text : undefined;
|
|
1101
1210
|
rangeXValues.forEach((x, index2)=>{
|
|
1102
1211
|
var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout;
|
|
1103
1212
|
if (!mapXToDataPoints[x]) {
|
|
@@ -1113,6 +1222,11 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1113
1222
|
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index2);
|
|
1114
1223
|
const yVal = rangeYValues[index2];
|
|
1115
1224
|
const yAxisCalloutData = getFormattedCalloutYData(yVal, yAxisTickFormat);
|
|
1225
|
+
let barLabel = Array.isArray(textValues) ? textValues[index2] : textValues;
|
|
1226
|
+
// Apply texttemplate formatting if specified
|
|
1227
|
+
if (barLabel && series.texttemplate) {
|
|
1228
|
+
barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index2);
|
|
1229
|
+
}
|
|
1116
1230
|
if (series.type === 'bar') {
|
|
1117
1231
|
var _rgb_copy_formatHex8;
|
|
1118
1232
|
mapXToDataPoints[x].chartData.push({
|
|
@@ -1121,7 +1235,10 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1121
1235
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
1122
1236
|
opacity
|
|
1123
1237
|
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
1124
|
-
yAxisCalloutData
|
|
1238
|
+
yAxisCalloutData,
|
|
1239
|
+
...barLabel ? {
|
|
1240
|
+
barLabel: String(barLabel)
|
|
1241
|
+
} : {}
|
|
1125
1242
|
});
|
|
1126
1243
|
if (typeof yVal === 'number') {
|
|
1127
1244
|
yMaxValue = Math.max(yMaxValue, yVal);
|
|
@@ -1219,7 +1336,7 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1219
1336
|
}
|
|
1220
1337
|
});
|
|
1221
1338
|
const vsbcData = Object.values(mapXToDataPoints);
|
|
1222
|
-
const annotations = getChartAnnotationsFromLayout(input.
|
|
1339
|
+
const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
|
|
1223
1340
|
var _input_layout_height;
|
|
1224
1341
|
return {
|
|
1225
1342
|
data: vsbcData,
|
|
@@ -1230,7 +1347,6 @@ const transformPlotlyJsonToVSBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1230
1347
|
yMinValue,
|
|
1231
1348
|
mode: 'plotly',
|
|
1232
1349
|
...secondaryYAxisValues,
|
|
1233
|
-
wrapXAxisLables: typeof ((_vsbcData_ = vsbcData[0]) === null || _vsbcData_ === void 0 ? void 0 : _vsbcData_.xAxisPoint) === 'string',
|
|
1234
1350
|
hideTickOverlap: true,
|
|
1235
1351
|
barGapMax: 2,
|
|
1236
1352
|
hideLegend,
|
|
@@ -1308,6 +1424,12 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1308
1424
|
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[xIndex % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedBarColors, xIndex, legend, colorMap, (_processedInput_layout = processedInput.layout) === null || _processedInput_layout === void 0 ? void 0 : (_processedInput_layout_template = _processedInput_layout.template) === null || _processedInput_layout_template === void 0 ? void 0 : (_processedInput_layout_template_layout = _processedInput_layout_template.layout) === null || _processedInput_layout_template_layout === void 0 ? void 0 : _processedInput_layout_template_layout.colorway, isDarkTheme);
|
|
1309
1425
|
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, xIndex);
|
|
1310
1426
|
const yVal = series.y[xIndex];
|
|
1427
|
+
// Extract text value for barLabel
|
|
1428
|
+
let barLabel = Array.isArray(series.text) ? series.text[xIndex] : series.text;
|
|
1429
|
+
// Apply texttemplate formatting if specified
|
|
1430
|
+
if (barLabel && series.texttemplate) {
|
|
1431
|
+
barLabel = formatTextWithTemplate(barLabel, series.texttemplate, xIndex);
|
|
1432
|
+
}
|
|
1311
1433
|
var _rgb_copy_formatHex8;
|
|
1312
1434
|
return {
|
|
1313
1435
|
x: x.toString(),
|
|
@@ -1315,7 +1437,10 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1315
1437
|
yAxisCalloutData: getFormattedCalloutYData(yVal, yAxisTickFormat),
|
|
1316
1438
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
1317
1439
|
opacity
|
|
1318
|
-
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color
|
|
1440
|
+
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
1441
|
+
...barLabel ? {
|
|
1442
|
+
barLabel: String(barLabel)
|
|
1443
|
+
} : {}
|
|
1319
1444
|
};
|
|
1320
1445
|
}).filter((item)=>typeof item !== 'undefined'),
|
|
1321
1446
|
useSecondaryYScale: usesSecondaryYScale(series, processedInput.layout)
|
|
@@ -1356,7 +1481,7 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1356
1481
|
});
|
|
1357
1482
|
}
|
|
1358
1483
|
});
|
|
1359
|
-
const annotations = getChartAnnotationsFromLayout(processedInput.
|
|
1484
|
+
const annotations = getChartAnnotationsFromLayout(processedInput.data, processedInput.layout, isMultiPlot);
|
|
1360
1485
|
var _processedInput_layout_height;
|
|
1361
1486
|
return {
|
|
1362
1487
|
dataV2: gvbcDataV2,
|
|
@@ -1366,7 +1491,6 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1366
1491
|
mode: 'plotly',
|
|
1367
1492
|
...secondaryYAxisValues,
|
|
1368
1493
|
hideTickOverlap: true,
|
|
1369
|
-
wrapXAxisLables: true,
|
|
1370
1494
|
hideLegend,
|
|
1371
1495
|
roundCorners: true,
|
|
1372
1496
|
showYAxisLables: true,
|
|
@@ -1385,7 +1509,7 @@ const transformPlotlyJsonToGVBCProps = (input, isMultiPlot, colorMap, colorwayTy
|
|
|
1385
1509
|
};
|
|
1386
1510
|
};
|
|
1387
1511
|
const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1388
|
-
var _input_layout, _input_layout1
|
|
1512
|
+
var _input_layout, _input_layout1;
|
|
1389
1513
|
const vbcData = [];
|
|
1390
1514
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
1391
1515
|
let colorScale = undefined;
|
|
@@ -1432,6 +1556,11 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
|
|
|
1432
1556
|
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[index % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, index, 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);
|
|
1433
1557
|
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, index);
|
|
1434
1558
|
const yVal = calculateHistNorm(series.histnorm, y[index], total, isXString ? bin.length : getBinSize(bin));
|
|
1559
|
+
// Handle text values and texttemplate formatting for histogram bins
|
|
1560
|
+
let barLabel = Array.isArray(series.text) ? series.text[index] : series.text;
|
|
1561
|
+
if (barLabel && series.texttemplate) {
|
|
1562
|
+
barLabel = formatTextWithTemplate(barLabel, series.texttemplate, index);
|
|
1563
|
+
}
|
|
1435
1564
|
var _rgb_copy_formatHex8;
|
|
1436
1565
|
vbcData.push({
|
|
1437
1566
|
x: isXString ? bin.join(', ') : getBinCenter(bin),
|
|
@@ -1442,11 +1571,14 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
|
|
|
1442
1571
|
}).formatHex8()) !== null && _rgb_copy_formatHex8 !== void 0 ? _rgb_copy_formatHex8 : color,
|
|
1443
1572
|
...isXString ? {} : {
|
|
1444
1573
|
xAxisCalloutData: `[${bin.x0} - ${bin.x1})`
|
|
1445
|
-
}
|
|
1574
|
+
},
|
|
1575
|
+
...barLabel ? {
|
|
1576
|
+
barLabel: String(barLabel)
|
|
1577
|
+
} : {}
|
|
1446
1578
|
});
|
|
1447
1579
|
});
|
|
1448
1580
|
});
|
|
1449
|
-
const annotations = getChartAnnotationsFromLayout(input.
|
|
1581
|
+
const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
|
|
1450
1582
|
var _input_layout_height;
|
|
1451
1583
|
return {
|
|
1452
1584
|
data: vbcData,
|
|
@@ -1454,7 +1586,6 @@ const transformPlotlyJsonToVBCProps = (input, isMultiPlot, colorMap, colorwayTyp
|
|
|
1454
1586
|
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 : 350,
|
|
1455
1587
|
mode: 'histogram',
|
|
1456
1588
|
hideTickOverlap: true,
|
|
1457
|
-
wrapXAxisLables: typeof ((_vbcData_ = vbcData[0]) === null || _vbcData_ === void 0 ? void 0 : _vbcData_.x) === 'string',
|
|
1458
1589
|
maxBarWidth: 50,
|
|
1459
1590
|
hideLegend,
|
|
1460
1591
|
roundCorners: true,
|
|
@@ -1517,9 +1648,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
1517
1648
|
let mode = 'tonexty';
|
|
1518
1649
|
const { legends, hideLegend } = getLegendProps(input.data, input.layout, isMultiPlot);
|
|
1519
1650
|
const yAxisTickFormat = getYAxisTickFormat(input.data[0], input.layout);
|
|
1520
|
-
const
|
|
1521
|
-
const resolveXValue = getAxisValueResolver(xAxisType);
|
|
1522
|
-
const shouldWrapLabels = xAxisType === 'category';
|
|
1651
|
+
const resolveXValue = getAxisValueResolver(getAxisType(input.data, getAxisObjects(input.data, input.layout).x));
|
|
1523
1652
|
const chartData = input.data.map((series, index)=>{
|
|
1524
1653
|
var _series_mode, _series_line, _series_marker, _series_line1, _input_layout_template_layout, _input_layout_template, _input_layout, _input_layout_template_layout1, _input_layout_template1, _input_layout1, _series_mode1;
|
|
1525
1654
|
const colors = isScatterMarkers ? (series === null || series === void 0 ? void 0 : (_series_mode = series.mode) === null || _series_mode === void 0 ? void 0 : _series_mode.includes('line')) ? (_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 : (_series_line1 = series.line) === null || _series_line1 === void 0 ? void 0 : _series_line1.color;
|
|
@@ -1668,7 +1797,7 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
1668
1797
|
...lineShape
|
|
1669
1798
|
]
|
|
1670
1799
|
};
|
|
1671
|
-
const annotations = getChartAnnotationsFromLayout(input.
|
|
1800
|
+
const annotations = getChartAnnotationsFromLayout(input.data, input.layout, isMultiPlot);
|
|
1672
1801
|
var _input_layout_height;
|
|
1673
1802
|
const commonProps = {
|
|
1674
1803
|
supportNegativeData: true,
|
|
@@ -1678,7 +1807,6 @@ const transformPlotlyJsonToScatterTraceProps = (input, isMultiPlot, chartType, c
|
|
|
1678
1807
|
hideTickOverlap: true,
|
|
1679
1808
|
hideLegend,
|
|
1680
1809
|
useUTC: false,
|
|
1681
|
-
wrapXAxisLabels: shouldWrapLabels,
|
|
1682
1810
|
optimizeLargeData: numDataPoints > 1000,
|
|
1683
1811
|
showYAxisLables: true,
|
|
1684
1812
|
roundedTicks: true,
|
|
@@ -1727,7 +1855,7 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
|
|
|
1727
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);
|
|
1728
1856
|
const legend = legends[index];
|
|
1729
1857
|
return series.y.map((yValue, i)=>{
|
|
1730
|
-
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;
|
|
1731
1859
|
if ((0, _chartutilities.isInvalidValue)(yValue)) {
|
|
1732
1860
|
return null;
|
|
1733
1861
|
}
|
|
@@ -1741,7 +1869,10 @@ const transformPlotlyJsonToHorizontalBarWithAxisProps = (input, isMultiPlot, col
|
|
|
1741
1869
|
legend,
|
|
1742
1870
|
color: (_rgb_copy_formatHex8 = (0, _d3color.rgb)(color).copy({
|
|
1743
1871
|
opacity
|
|
1744
|
-
}).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
|
+
} : {}
|
|
1745
1876
|
};
|
|
1746
1877
|
}).filter((point)=>point !== null);
|
|
1747
1878
|
}).flat();
|
|
@@ -1797,14 +1928,14 @@ const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colo
|
|
|
1797
1928
|
// extract colors for each series only once
|
|
1798
1929
|
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);
|
|
1799
1930
|
series.y.forEach((yVal, i)=>{
|
|
1800
|
-
var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout,
|
|
1931
|
+
var _series_marker, _series_marker1, _series_marker_color, _series_marker2, _input_layout_template_layout, _input_layout_template, _input_layout, _series_x;
|
|
1801
1932
|
if ((0, _chartutilities.isInvalidValue)(yVal)) {
|
|
1802
1933
|
return;
|
|
1803
1934
|
}
|
|
1804
1935
|
// resolve color for each legend's bars from the colorscale or extracted colors
|
|
1805
1936
|
const color = colorScale ? colorScale((0, _chartutilities.isArrayOrTypedArray)((_series_marker = series.marker) === null || _series_marker === void 0 ? void 0 : _series_marker.color) ? (_series_marker2 = series.marker) === null || _series_marker2 === void 0 ? void 0 : (_series_marker_color = _series_marker2.color) === null || _series_marker_color === void 0 ? void 0 : _series_marker_color[i % ((_series_marker1 = series.marker) === null || _series_marker1 === void 0 ? void 0 : _series_marker1.color).length] : 0) : (0, _PlotlyColorAdapter.resolveColor)(extractedColors, i, 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);
|
|
1806
1937
|
const opacity = (0, _PlotlyColorAdapter.getOpacity)(series, i);
|
|
1807
|
-
const base = +resolveGanttXValue((
|
|
1938
|
+
const base = +resolveGanttXValue((0, _chartutilities.isArrayOrTypedArray)(series.base) ? series.base[i] : series.base);
|
|
1808
1939
|
const xVal = +resolveGanttXValue((_series_x = series.x) === null || _series_x === void 0 ? void 0 : _series_x[i]);
|
|
1809
1940
|
var _rgb_copy_formatHex8;
|
|
1810
1941
|
ganttData.push({
|
|
@@ -1859,11 +1990,53 @@ const transformPlotlyJsonToGanttChartProps = (input, isMultiPlot, colorMap, colo
|
|
|
1859
1990
|
};
|
|
1860
1991
|
};
|
|
1861
1992
|
const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1862
|
-
var _input_layout, _input_layout_coloraxis,
|
|
1993
|
+
var _input_layout, _input_layout1, _input_layout_coloraxis, _input_layout2, _input_layout_template_layout, _input_layout_template, _input_layout3, _input_layout_template_data_histogram2d_, _input_layout_template_data_histogram2d, _input_layout_template_data, _input_layout_template1, _input_layout4, _input_layout_template_data_heatmap_, _input_layout_template_data_heatmap, _input_layout_template_data1, _input_layout_template2, _input_layout5, _input_layout6, _input_layout7;
|
|
1863
1994
|
const firstData = input.data[0];
|
|
1864
1995
|
const heatmapDataPoints = [];
|
|
1865
1996
|
let zMin = Number.POSITIVE_INFINITY;
|
|
1866
1997
|
let zMax = Number.NEGATIVE_INFINITY;
|
|
1998
|
+
// Build a 2D array of annotations based on their grid position
|
|
1999
|
+
const annotationGrid = [];
|
|
2000
|
+
const rawAnnotations = (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.annotations;
|
|
2001
|
+
if (rawAnnotations) {
|
|
2002
|
+
const annotationsArray = Array.isArray(rawAnnotations) ? rawAnnotations : [
|
|
2003
|
+
rawAnnotations
|
|
2004
|
+
];
|
|
2005
|
+
// Collect all unique x and y values from valid annotations
|
|
2006
|
+
const xSet = new Set();
|
|
2007
|
+
const ySet = new Set();
|
|
2008
|
+
const validAnnotations = [];
|
|
2009
|
+
annotationsArray.forEach((a)=>{
|
|
2010
|
+
if (a && typeof a.x === 'number' && typeof a.y === 'number' && typeof a.text === 'string' && (a.xref === 'x' || a.xref === undefined) && (a.yref === 'y' || a.yref === undefined)) {
|
|
2011
|
+
xSet.add(a.x);
|
|
2012
|
+
ySet.add(a.y);
|
|
2013
|
+
validAnnotations.push({
|
|
2014
|
+
x: a.x,
|
|
2015
|
+
y: a.y,
|
|
2016
|
+
text: cleanText(a.text)
|
|
2017
|
+
});
|
|
2018
|
+
}
|
|
2019
|
+
});
|
|
2020
|
+
if (validAnnotations.length > 0) {
|
|
2021
|
+
// Get sorted unique x and y values
|
|
2022
|
+
const xValues = Array.from(xSet).sort((a, b)=>a - b);
|
|
2023
|
+
const yValues = Array.from(ySet).sort((a, b)=>a - b);
|
|
2024
|
+
// Initialize 2D grid and populate
|
|
2025
|
+
validAnnotations.forEach((annotation)=>{
|
|
2026
|
+
const xIdx = xValues.indexOf(annotation.x);
|
|
2027
|
+
const yIdx = yValues.indexOf(annotation.y);
|
|
2028
|
+
if (!annotationGrid[yIdx]) {
|
|
2029
|
+
annotationGrid[yIdx] = [];
|
|
2030
|
+
}
|
|
2031
|
+
annotationGrid[yIdx][xIdx] = annotation.text;
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
// Helper function to get annotation from 2D grid by index
|
|
2036
|
+
const getAnnotationByIndex = (xIdx, yIdx)=>{
|
|
2037
|
+
var _annotationGrid_yIdx;
|
|
2038
|
+
return (_annotationGrid_yIdx = annotationGrid[yIdx]) === null || _annotationGrid_yIdx === void 0 ? void 0 : _annotationGrid_yIdx[xIdx];
|
|
2039
|
+
};
|
|
1867
2040
|
if (firstData.type === 'histogram2d') {
|
|
1868
2041
|
var _firstData_x, _firstData_xbins, _firstData_xbins1, _firstData_xbins2, _firstData_ybins, _firstData_ybins1, _firstData_ybins2;
|
|
1869
2042
|
const xValues = [];
|
|
@@ -1903,11 +2076,12 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
1903
2076
|
xBins.forEach((xBin, xIdx)=>{
|
|
1904
2077
|
yBins.forEach((yBin, yIdx)=>{
|
|
1905
2078
|
const zVal = calculateHistNorm(firstData.histnorm, z[yIdx][xIdx], total, isXString ? xBin.length : getBinSize(xBin), isYString ? yBin.length : getBinSize(yBin));
|
|
2079
|
+
const annotationText = getAnnotationByIndex(xIdx, yIdx);
|
|
1906
2080
|
heatmapDataPoints.push({
|
|
1907
2081
|
x: isXString ? xBin.join(', ') : getBinCenter(xBin),
|
|
1908
2082
|
y: isYString ? yBin.join(', ') : getBinCenter(yBin),
|
|
1909
2083
|
value: zVal,
|
|
1910
|
-
rectText: zVal
|
|
2084
|
+
rectText: annotationText || zVal
|
|
1911
2085
|
});
|
|
1912
2086
|
if (typeof zVal === 'number') {
|
|
1913
2087
|
zMin = Math.min(zMin, zVal);
|
|
@@ -1916,17 +2090,34 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
1916
2090
|
});
|
|
1917
2091
|
});
|
|
1918
2092
|
} else {
|
|
1919
|
-
var
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
2093
|
+
var _zArray_;
|
|
2094
|
+
// If x and y are not provided, generate indices based on z dimensions
|
|
2095
|
+
const zArray = firstData.z;
|
|
2096
|
+
const xValues = firstData.x;
|
|
2097
|
+
const yValues = firstData.y;
|
|
2098
|
+
var _zArray_length;
|
|
2099
|
+
// Determine the dimensions from z array
|
|
2100
|
+
const yLength = (_zArray_length = zArray === null || zArray === void 0 ? void 0 : zArray.length) !== null && _zArray_length !== void 0 ? _zArray_length : 0;
|
|
2101
|
+
var _zArray__length;
|
|
2102
|
+
const xLength = (_zArray__length = zArray === null || zArray === void 0 ? void 0 : (_zArray_ = zArray[0]) === null || _zArray_ === void 0 ? void 0 : _zArray_.length) !== null && _zArray__length !== void 0 ? _zArray__length : 0;
|
|
2103
|
+
// Use provided x/y values or generate indices
|
|
2104
|
+
const xData = xValues !== null && xValues !== void 0 ? xValues : Array.from({
|
|
2105
|
+
length: xLength
|
|
2106
|
+
}, (_, i)=>i);
|
|
2107
|
+
const yData = yValues !== null && yValues !== void 0 ? yValues : Array.from({
|
|
2108
|
+
length: yLength
|
|
2109
|
+
}, (_, i)=>yLength - 1 - i);
|
|
2110
|
+
xData.forEach((xVal, xIdx)=>{
|
|
2111
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2112
|
+
yData.forEach((yVal, yIdx)=>{
|
|
2113
|
+
var _zArray_yIdx, _input_layout_xaxis, _input_layout, _input_layout_yaxis, _input_layout1;
|
|
2114
|
+
const zVal = zArray === null || zArray === void 0 ? void 0 : (_zArray_yIdx = zArray[yIdx]) === null || _zArray_yIdx === void 0 ? void 0 : _zArray_yIdx[xIdx];
|
|
2115
|
+
const annotationText = getAnnotationByIndex(xIdx, yIdx);
|
|
1925
2116
|
heatmapDataPoints.push({
|
|
1926
2117
|
x: ((_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : (_input_layout_xaxis = _input_layout.xaxis) === null || _input_layout_xaxis === void 0 ? void 0 : _input_layout_xaxis.type) === 'date' ? xVal : xVal !== null && xVal !== void 0 ? xVal : 0,
|
|
1927
2118
|
y: ((_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : (_input_layout_yaxis = _input_layout1.yaxis) === null || _input_layout_yaxis === void 0 ? void 0 : _input_layout_yaxis.type) === 'date' ? yVal : yVal,
|
|
1928
2119
|
value: zVal,
|
|
1929
|
-
rectText: zVal
|
|
2120
|
+
rectText: annotationText || zVal
|
|
1930
2121
|
});
|
|
1931
2122
|
if (typeof zVal === 'number') {
|
|
1932
2123
|
zMin = Math.min(zMin, zVal);
|
|
@@ -1953,7 +2144,7 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
1953
2144
|
(0, _colors.getColorFromToken)(_colors.DataVizPalette.color3)
|
|
1954
2145
|
];
|
|
1955
2146
|
var _firstData_colorscale, _ref, _ref1, _ref2, _ref3;
|
|
1956
|
-
let colorscale = (_ref3 = (_ref2 = (_ref1 = (_ref = (_firstData_colorscale = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _firstData_colorscale !== void 0 ? _firstData_colorscale : (
|
|
2147
|
+
let colorscale = (_ref3 = (_ref2 = (_ref1 = (_ref = (_firstData_colorscale = firstData === null || firstData === void 0 ? void 0 : firstData.colorscale) !== null && _firstData_colorscale !== void 0 ? _firstData_colorscale : (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.colorscale) !== null && _ref !== void 0 ? _ref : (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : (_input_layout_coloraxis = _input_layout2.coloraxis) === null || _input_layout_coloraxis === void 0 ? void 0 : _input_layout_coloraxis.colorscale) !== null && _ref1 !== void 0 ? _ref1 : (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : (_input_layout_template = _input_layout3.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.colorscale) !== null && _ref2 !== void 0 ? _ref2 : firstData.type === 'histogram2d' && ((_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : (_input_layout_template1 = _input_layout4.template) === null || _input_layout_template1 === void 0 ? void 0 : (_input_layout_template_data = _input_layout_template1.data) === null || _input_layout_template_data === void 0 ? void 0 : (_input_layout_template_data_histogram2d = _input_layout_template_data.histogram2d) === null || _input_layout_template_data_histogram2d === void 0 ? void 0 : (_input_layout_template_data_histogram2d_ = _input_layout_template_data_histogram2d[0]) === null || _input_layout_template_data_histogram2d_ === void 0 ? void 0 : _input_layout_template_data_histogram2d_.colorscale)) !== null && _ref3 !== void 0 ? _ref3 : (_input_layout5 = input.layout) === null || _input_layout5 === void 0 ? void 0 : (_input_layout_template2 = _input_layout5.template) === null || _input_layout_template2 === void 0 ? void 0 : (_input_layout_template_data1 = _input_layout_template2.data) === null || _input_layout_template_data1 === void 0 ? void 0 : (_input_layout_template_data_heatmap = _input_layout_template_data1.heatmap) === null || _input_layout_template_data_heatmap === void 0 ? void 0 : (_input_layout_template_data_heatmap_ = _input_layout_template_data_heatmap[0]) === null || _input_layout_template_data_heatmap_ === void 0 ? void 0 : _input_layout_template_data_heatmap_.colorscale;
|
|
1957
2148
|
// determine if the types diverging, sequential or sequentialminus are present in colorscale
|
|
1958
2149
|
if (colorscale && typeof colorscale === 'object' && ('diverging' in colorscale || 'sequential' in colorscale || 'sequentialminus' in colorscale)) {
|
|
1959
2150
|
const isDivergent = zMin < 0 && zMax > 0; // Data spans both positive and negative values
|
|
@@ -1979,12 +2170,11 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
1979
2170
|
hideLegend: true,
|
|
1980
2171
|
showYAxisLables: true,
|
|
1981
2172
|
sortOrder: 'none',
|
|
1982
|
-
width: (
|
|
1983
|
-
height: (_input_layout_height = (
|
|
2173
|
+
width: (_input_layout6 = input.layout) === null || _input_layout6 === void 0 ? void 0 : _input_layout6.width,
|
|
2174
|
+
height: (_input_layout_height = (_input_layout7 = input.layout) === null || _input_layout7 === void 0 ? void 0 : _input_layout7.height) !== null && _input_layout_height !== void 0 ? _input_layout_height : 350,
|
|
1984
2175
|
hideTickOverlap: true,
|
|
1985
2176
|
noOfCharsToTruncate: 20,
|
|
1986
2177
|
showYAxisLablesTooltip: true,
|
|
1987
|
-
wrapXAxisLables: true,
|
|
1988
2178
|
...getTitles(input.layout),
|
|
1989
2179
|
...getAxisCategoryOrderProps([
|
|
1990
2180
|
firstData
|
|
@@ -1993,7 +2183,7 @@ const transformPlotlyJsonToHeatmapProps = (input, isMultiPlot, colorMap, colorwa
|
|
|
1993
2183
|
};
|
|
1994
2184
|
};
|
|
1995
2185
|
const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
1996
|
-
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;
|
|
1997
2187
|
const { link, node } = input.data[0];
|
|
1998
2188
|
var _link_value;
|
|
1999
2189
|
const validLinks = ((_link_value = link === null || link === void 0 ? void 0 : link.value) !== null && _link_value !== void 0 ? _link_value : []).map((val, index)=>{
|
|
@@ -2035,7 +2225,7 @@ const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorway
|
|
|
2035
2225
|
// ...(input.layout?.font?.size ? { fontSize: input.layout.font?.size } : {}),
|
|
2036
2226
|
// },
|
|
2037
2227
|
// };
|
|
2038
|
-
const { chartTitle } = getTitles(input.layout);
|
|
2228
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2039
2229
|
var _input_layout_height;
|
|
2040
2230
|
return {
|
|
2041
2231
|
data: {
|
|
@@ -2043,7 +2233,13 @@ const transformPlotlyJsonToSankeyProps = (input, isMultiPlot, colorMap, colorway
|
|
|
2043
2233
|
SankeyChartData: sankeyChartData
|
|
2044
2234
|
},
|
|
2045
2235
|
width: (_input_layout2 = input.layout) === null || _input_layout2 === void 0 ? void 0 : _input_layout2.width,
|
|
2046
|
-
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
|
+
} : {}
|
|
2047
2243
|
};
|
|
2048
2244
|
};
|
|
2049
2245
|
const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
@@ -2094,7 +2290,7 @@ const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
2094
2290
|
const styles = {
|
|
2095
2291
|
sublabel: sublabelColor
|
|
2096
2292
|
};
|
|
2097
|
-
const { chartTitle } = getTitles(input.layout);
|
|
2293
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2098
2294
|
var _firstData_value2, _input_layout_height;
|
|
2099
2295
|
return {
|
|
2100
2296
|
segments,
|
|
@@ -2115,7 +2311,10 @@ const transformPlotlyJsonToGaugeProps = (input, isMultiPlot, colorMap, colorwayT
|
|
|
2115
2311
|
// styles,
|
|
2116
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',
|
|
2117
2313
|
styles,
|
|
2118
|
-
roundCorners: true
|
|
2314
|
+
roundCorners: true,
|
|
2315
|
+
...titleStyles ? {
|
|
2316
|
+
titleStyles
|
|
2317
|
+
} : {}
|
|
2119
2318
|
};
|
|
2120
2319
|
};
|
|
2121
2320
|
const cleanText = (text)=>{
|
|
@@ -2258,13 +2457,18 @@ const transformPlotlyJsonToChartTableProps = (input, isMultiPlot, colorMap, colo
|
|
|
2258
2457
|
},
|
|
2259
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 : []
|
|
2260
2459
|
};
|
|
2460
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2261
2461
|
var _tableData_header_values;
|
|
2262
2462
|
return {
|
|
2263
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),
|
|
2264
2464
|
rows,
|
|
2265
2465
|
width: (_input_layout3 = input.layout) === null || _input_layout3 === void 0 ? void 0 : _input_layout3.width,
|
|
2266
2466
|
height: (_input_layout4 = input.layout) === null || _input_layout4 === void 0 ? void 0 : _input_layout4.height,
|
|
2267
|
-
styles
|
|
2467
|
+
styles,
|
|
2468
|
+
chartTitle,
|
|
2469
|
+
...titleStyles ? {
|
|
2470
|
+
titleStyles
|
|
2471
|
+
} : {}
|
|
2268
2472
|
};
|
|
2269
2473
|
};
|
|
2270
2474
|
function getCategoriesAndValues(series) {
|
|
@@ -2408,151 +2612,90 @@ const transformPlotlyJsonToFunnelChartProps = (input, isMultiPlot, colorMap, col
|
|
|
2408
2612
|
});
|
|
2409
2613
|
});
|
|
2410
2614
|
}
|
|
2615
|
+
const { chartTitle, titleStyles } = getTitles(input.layout);
|
|
2411
2616
|
return {
|
|
2412
2617
|
data: funnelData,
|
|
2618
|
+
chartTitle,
|
|
2413
2619
|
width: (_input_layout = input.layout) === null || _input_layout === void 0 ? void 0 : _input_layout.width,
|
|
2414
2620
|
height: (_input_layout1 = input.layout) === null || _input_layout1 === void 0 ? void 0 : _input_layout1.height,
|
|
2415
2621
|
orientation: ((_input_data_ = input.data[0]) === null || _input_data_ === void 0 ? void 0 : _input_data_.orientation) === 'v' ? 'horizontal' : 'vertical',
|
|
2416
|
-
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
|
+
} : {}
|
|
2417
2626
|
};
|
|
2418
2627
|
};
|
|
2419
|
-
const
|
|
2628
|
+
const transformPlotlyJsonToPolarChartProps = (input, isMultiPlot, colorMap, colorwayType, isDarkTheme)=>{
|
|
2420
2629
|
var _input_layout, _input_layout1;
|
|
2421
|
-
const
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
let categorical = false;
|
|
2475
|
-
if (!(0, _chartutilities.isNumberArray)(thetas)) {
|
|
2476
|
-
uniqueTheta = Array.from(new Set(thetas));
|
|
2477
|
-
categorical = true;
|
|
2478
|
-
}
|
|
2479
|
-
for(let ptindex = 0; ptindex < rVals.length; ptindex++){
|
|
2480
|
-
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])) {
|
|
2481
|
-
continue;
|
|
2482
|
-
}
|
|
2483
|
-
// Map theta to angle in radians
|
|
2484
|
-
let thetaRad;
|
|
2485
|
-
if (categorical) {
|
|
2486
|
-
const idx = uniqueTheta.indexOf(thetas[ptindex]);
|
|
2487
|
-
const step = 2 * Math.PI / uniqueTheta.length;
|
|
2488
|
-
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
|
+
});
|
|
2489
2683
|
} else {
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
const polarRadius = rawRadius + radiusShift; // Only for projection
|
|
2495
|
-
// Calculate cartesian coordinates (with shifted polar origin)
|
|
2496
|
-
const x = polarRadius * Math.cos(thetaRad);
|
|
2497
|
-
const y = polarRadius * Math.sin(thetaRad);
|
|
2498
|
-
// Calculate the cartesian coordinates of the original polar origin (0,0)
|
|
2499
|
-
// This is the point that should be mapped to (0,0) in cartesian coordinates
|
|
2500
|
-
if (sindex === 0 && ptindex === 0) {
|
|
2501
|
-
// For polar origin (r=0, θ=0), cartesian coordinates are (0,0)
|
|
2502
|
-
// But since we shifted the radius by radiusShift, the cartesian origin is at (radiusShift, 0)
|
|
2503
|
-
originX = radiusShift;
|
|
2504
|
-
}
|
|
2505
|
-
series.x.push(x);
|
|
2506
|
-
series.y.push(y);
|
|
2507
|
-
allX.push(x);
|
|
2508
|
-
allY.push(y);
|
|
2509
|
-
}
|
|
2510
|
-
// Map text to each data point for downstream chart rendering
|
|
2511
|
-
if (series.x && series.y) {
|
|
2512
|
-
series.data = series.x.map((xVal, idx)=>({
|
|
2513
|
-
x: xVal,
|
|
2514
|
-
y: series.y[idx],
|
|
2515
|
-
...series.text ? {
|
|
2516
|
-
text: series.text[idx]
|
|
2517
|
-
} : {}
|
|
2518
|
-
}));
|
|
2519
|
-
}
|
|
2520
|
-
projection.data[sindex] = series;
|
|
2521
|
-
}
|
|
2522
|
-
// 7. Recenter all cartesian coordinates
|
|
2523
|
-
if (originX !== null) {
|
|
2524
|
-
for(let sindex = 0; sindex < projection.data.length; sindex++){
|
|
2525
|
-
const series = projection.data[sindex];
|
|
2526
|
-
if (series.x && series.y) {
|
|
2527
|
-
series.x = series.x.map((v)=>v - originX);
|
|
2684
|
+
polarData.push({
|
|
2685
|
+
type: 'scatterpolar',
|
|
2686
|
+
...commonProps
|
|
2687
|
+
});
|
|
2528
2688
|
}
|
|
2529
2689
|
}
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
// 9. Rescale all points so that the largest |x| or |y| is 0.5
|
|
2539
|
-
for(let sindex = 0; sindex < projection.data.length; sindex++){
|
|
2540
|
-
const series = projection.data[sindex];
|
|
2541
|
-
if (series.x && series.y) {
|
|
2542
|
-
series.x = series.x.map((v)=>v / (2 * maxAbs));
|
|
2543
|
-
series.y = series.y.map((v)=>v / (2 * maxAbs));
|
|
2544
|
-
}
|
|
2545
|
-
}
|
|
2546
|
-
// 10. Customize layout for perfect square with absolute positioning
|
|
2547
|
-
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;
|
|
2548
|
-
projection.layout = {
|
|
2549
|
-
...projection.layout,
|
|
2550
|
-
width: size,
|
|
2551
|
-
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)
|
|
2552
2698
|
};
|
|
2553
|
-
// Attach originX as custom properties
|
|
2554
|
-
projection.layout.__polarOriginX = originX !== null && originX !== void 0 ? originX : undefined;
|
|
2555
|
-
return projection;
|
|
2556
2699
|
};
|
|
2557
2700
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2558
2701
|
function isPlainObject(obj) {
|
|
@@ -2829,7 +2972,10 @@ const isNonPlotType = (chartType)=>{
|
|
|
2829
2972
|
'donut',
|
|
2830
2973
|
'sankey',
|
|
2831
2974
|
'pie',
|
|
2832
|
-
'annotation'
|
|
2975
|
+
'annotation',
|
|
2976
|
+
'table',
|
|
2977
|
+
'gauge',
|
|
2978
|
+
'funnel'
|
|
2833
2979
|
].includes(chartType);
|
|
2834
2980
|
};
|
|
2835
2981
|
const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
@@ -2862,7 +3008,8 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
2862
3008
|
const xAxisLayout = layout[key];
|
|
2863
3009
|
const domainXInfo = {
|
|
2864
3010
|
start: (xAxisLayout === null || xAxisLayout === void 0 ? void 0 : xAxisLayout.domain) ? xAxisLayout.domain[0] : 0,
|
|
2865
|
-
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}`
|
|
2866
3013
|
};
|
|
2867
3014
|
domainX.push(domainXInfo);
|
|
2868
3015
|
} else if (key.startsWith('yaxis')) {
|
|
@@ -2885,7 +3032,8 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
2885
3032
|
const yAxisLayout = layout[key];
|
|
2886
3033
|
const domainYInfo = {
|
|
2887
3034
|
start: (yAxisLayout === null || yAxisLayout === void 0 ? void 0 : yAxisLayout.domain) ? yAxisLayout.domain[0] : 0,
|
|
2888
|
-
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}`
|
|
2889
3037
|
};
|
|
2890
3038
|
domainY.push(domainYInfo);
|
|
2891
3039
|
}
|
|
@@ -2898,11 +3046,13 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
2898
3046
|
const series = schema === null || schema === void 0 ? void 0 : (_schema_data = schema.data) === null || _schema_data === void 0 ? void 0 : _schema_data[index];
|
|
2899
3047
|
const domainXInfo = {
|
|
2900
3048
|
start: ((_series_domain = series.domain) === null || _series_domain === void 0 ? void 0 : _series_domain.x) ? series.domain.x[0] : 0,
|
|
2901
|
-
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}`
|
|
2902
3051
|
};
|
|
2903
3052
|
const domainYInfo = {
|
|
2904
3053
|
start: ((_series_domain2 = series.domain) === null || _series_domain2 === void 0 ? void 0 : _series_domain2.y) ? series.domain.y[0] : 0,
|
|
2905
|
-
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}`
|
|
2906
3056
|
};
|
|
2907
3057
|
domainX.push(domainXInfo);
|
|
2908
3058
|
domainY.push(domainYInfo);
|
|
@@ -2910,6 +3060,24 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
2910
3060
|
});
|
|
2911
3061
|
if (layout !== undefined && layout !== null && Object.keys(layout).length > 0) {
|
|
2912
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
|
+
});
|
|
2913
3081
|
(_layout_annotations = layout.annotations) === null || _layout_annotations === void 0 ? void 0 : _layout_annotations.forEach((annotation)=>{
|
|
2914
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 ? [
|
|
2915
3083
|
idx
|
|
@@ -2938,7 +3106,6 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
2938
3106
|
const sortedXStart = Array.from(uniqueXIntervals.values()).map((interval)=>interval.start).sort();
|
|
2939
3107
|
templateColumns = `repeat(${sortedXStart.length}, 1fr)`;
|
|
2940
3108
|
domainX.forEach((interval, index)=>{
|
|
2941
|
-
const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
|
|
2942
3109
|
const columnIndex = sortedXStart.findIndex((start)=>start === interval.start);
|
|
2943
3110
|
const columnNumber = columnIndex + 1; // Column numbers are 1-based
|
|
2944
3111
|
const annotationProps = annotations[index];
|
|
@@ -2953,7 +3120,7 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
2953
3120
|
end: 1
|
|
2954
3121
|
}
|
|
2955
3122
|
};
|
|
2956
|
-
gridLayout[cellName] = row;
|
|
3123
|
+
gridLayout[interval.cellName] = row;
|
|
2957
3124
|
});
|
|
2958
3125
|
}
|
|
2959
3126
|
if (domainY.length > 0) {
|
|
@@ -2968,12 +3135,11 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
2968
3135
|
const numberOfRows = sortedYStart.length;
|
|
2969
3136
|
templateRows = `repeat(${numberOfRows}, 1fr)`;
|
|
2970
3137
|
domainY.forEach((interval, index)=>{
|
|
2971
|
-
const cellName = index >= cartesianDomains ? `${NON_PLOT_KEY_PREFIX}${index - cartesianDomains + 1}` : `x${index === 0 ? '' : index + 1}`;
|
|
2972
3138
|
const rowIndex = sortedYStart.findIndex((start)=>start === interval.start);
|
|
2973
3139
|
const rowNumber = numberOfRows - rowIndex; // Rows are 1-based and we need to reverse the order for CSS grid
|
|
2974
3140
|
const annotationProps = annotations[index];
|
|
2975
3141
|
const yAnnotation = annotationProps === null || annotationProps === void 0 ? void 0 : annotationProps.yAnnotation;
|
|
2976
|
-
const cell = gridLayout[cellName];
|
|
3142
|
+
const cell = gridLayout[interval.cellName];
|
|
2977
3143
|
if (cell !== undefined) {
|
|
2978
3144
|
cell.row = rowNumber;
|
|
2979
3145
|
cell.yAnnotation = yAnnotation;
|
|
@@ -3015,7 +3181,7 @@ const getGridProperties = (schema, isMultiPlot, validTracesInfo)=>{
|
|
|
3015
3181
|
}
|
|
3016
3182
|
const isValidArray = (0, _chartutilities.isArrayOrTypedArray)(ax === null || ax === void 0 ? void 0 : ax.categoryarray) && ax.categoryarray.length > 0;
|
|
3017
3183
|
if (isValidArray && (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'array')) {
|
|
3018
|
-
result[propName] = ax.categoryarray;
|
|
3184
|
+
result[propName] = (ax === null || ax === void 0 ? void 0 : ax.autorange) === 'reversed' ? ax.categoryarray.slice().reverse() : ax.categoryarray;
|
|
3019
3185
|
return;
|
|
3020
3186
|
}
|
|
3021
3187
|
if (!(ax === null || ax === void 0 ? void 0 : ax.categoryorder) || ax.categoryorder === 'trace' || ax.categoryorder === 'array') {
|
|
@@ -3092,16 +3258,23 @@ const getAxisScaleTypeProps = (data, layout)=>{
|
|
|
3092
3258
|
return;
|
|
3093
3259
|
}
|
|
3094
3260
|
const axType = getAxisType(data, ax);
|
|
3261
|
+
if (axId === 'x' && axType === 'category') {
|
|
3262
|
+
props.xAxis = {
|
|
3263
|
+
tickLayout: 'auto'
|
|
3264
|
+
};
|
|
3265
|
+
}
|
|
3095
3266
|
if ((!ax.tickmode || ax.tickmode === 'array') && (0, _chartutilities.isArrayOrTypedArray)(ax.tickvals)) {
|
|
3096
3267
|
const tickValues = axType === 'date' ? ax.tickvals.map((v)=>new Date(v)) : ax.tickvals;
|
|
3097
3268
|
if (axId === 'x') {
|
|
3098
3269
|
props.tickValues = tickValues;
|
|
3099
3270
|
props.xAxis = {
|
|
3271
|
+
...props.xAxis,
|
|
3100
3272
|
tickText: ax.ticktext
|
|
3101
3273
|
};
|
|
3102
3274
|
} else if (axId === 'y') {
|
|
3103
3275
|
props.yAxisTickValues = tickValues;
|
|
3104
3276
|
props.yAxis = {
|
|
3277
|
+
...props.yAxis,
|
|
3105
3278
|
tickText: ax.ticktext
|
|
3106
3279
|
};
|
|
3107
3280
|
}
|
|
@@ -3112,11 +3285,13 @@ const getAxisScaleTypeProps = (data, layout)=>{
|
|
|
3112
3285
|
const tick0 = plotlyTick0(ax.tick0, axType, dtick);
|
|
3113
3286
|
if (axId === 'x') {
|
|
3114
3287
|
props.xAxis = {
|
|
3288
|
+
...props.xAxis,
|
|
3115
3289
|
tickStep: dtick,
|
|
3116
3290
|
tick0
|
|
3117
3291
|
};
|
|
3118
3292
|
} else if (axId === 'y') {
|
|
3119
3293
|
props.yAxis = {
|
|
3294
|
+
...props.yAxis,
|
|
3120
3295
|
tickStep: dtick,
|
|
3121
3296
|
tick0
|
|
3122
3297
|
};
|
|
@@ -3296,3 +3471,109 @@ const getAxisValueResolver = (axType, dateParser)=>{
|
|
|
3296
3471
|
}
|
|
3297
3472
|
return new Date(value);
|
|
3298
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
|
+
};
|