@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
|
+
CARTESIAN_XAXIS_CLASSNAME: function() {
|
|
14
|
+
return CARTESIAN_XAXIS_CLASSNAME;
|
|
15
|
+
},
|
|
13
16
|
ChartTypes: function() {
|
|
14
17
|
return ChartTypes;
|
|
15
18
|
},
|
|
@@ -49,6 +52,9 @@ _export(exports, {
|
|
|
49
52
|
areArraysEqual: function() {
|
|
50
53
|
return areArraysEqual;
|
|
51
54
|
},
|
|
55
|
+
autoLayoutXAxisLabels: function() {
|
|
56
|
+
return autoLayoutXAxisLabels;
|
|
57
|
+
},
|
|
52
58
|
calculateLongestLabelWidth: function() {
|
|
53
59
|
return calculateLongestLabelWidth;
|
|
54
60
|
},
|
|
@@ -67,9 +73,6 @@ _export(exports, {
|
|
|
67
73
|
createDateXAxis: function() {
|
|
68
74
|
return createDateXAxis;
|
|
69
75
|
},
|
|
70
|
-
createMeasurementSpan: function() {
|
|
71
|
-
return createMeasurementSpan;
|
|
72
|
-
},
|
|
73
76
|
createNumericXAxis: function() {
|
|
74
77
|
return createNumericXAxis;
|
|
75
78
|
},
|
|
@@ -142,12 +145,18 @@ _export(exports, {
|
|
|
142
145
|
formatScientificLimitWidth: function() {
|
|
143
146
|
return formatScientificLimitWidth;
|
|
144
147
|
},
|
|
148
|
+
generateDateTicks: function() {
|
|
149
|
+
return generateDateTicks;
|
|
150
|
+
},
|
|
145
151
|
generateLinearTicks: function() {
|
|
146
152
|
return generateLinearTicks;
|
|
147
153
|
},
|
|
148
154
|
generateMonthlyTicks: function() {
|
|
149
155
|
return generateMonthlyTicks;
|
|
150
156
|
},
|
|
157
|
+
generateNumericTicks: function() {
|
|
158
|
+
return generateNumericTicks;
|
|
159
|
+
},
|
|
151
160
|
getAccessibleDataObject: function() {
|
|
152
161
|
return getAccessibleDataObject;
|
|
153
162
|
},
|
|
@@ -175,6 +184,9 @@ _export(exports, {
|
|
|
175
184
|
getSecureProps: function() {
|
|
176
185
|
return getSecureProps;
|
|
177
186
|
},
|
|
187
|
+
getTextSize: function() {
|
|
188
|
+
return getTextSize;
|
|
189
|
+
},
|
|
178
190
|
getTypeOfAxis: function() {
|
|
179
191
|
return getTypeOfAxis;
|
|
180
192
|
},
|
|
@@ -202,6 +214,9 @@ _export(exports, {
|
|
|
202
214
|
isValidDomainValue: function() {
|
|
203
215
|
return isValidDomainValue;
|
|
204
216
|
},
|
|
217
|
+
measureTextWithDOM: function() {
|
|
218
|
+
return measureTextWithDOM;
|
|
219
|
+
},
|
|
205
220
|
pointTypes: function() {
|
|
206
221
|
return pointTypes;
|
|
207
222
|
},
|
|
@@ -252,6 +267,8 @@ const _chartutilities = require("@fluentui/chart-utilities");
|
|
|
252
267
|
const MIN_DOMAIN_MARGIN = 8;
|
|
253
268
|
const MIN_DONUT_RADIUS = 1;
|
|
254
269
|
const DEFAULT_DATE_STRING = '2000-01-01';
|
|
270
|
+
const CARTESIAN_XAXIS_CLASSNAME = 'fui-cart__xAxis';
|
|
271
|
+
const CARTESIAN_XAXIS_TEXT_SELECTOR = `.${CARTESIAN_XAXIS_CLASSNAME} text`;
|
|
255
272
|
var ChartTypes = /*#__PURE__*/ function(ChartTypes) {
|
|
256
273
|
ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
|
|
257
274
|
ChartTypes[ChartTypes["LineChart"] = 1] = "LineChart";
|
|
@@ -321,7 +338,7 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleTy
|
|
|
321
338
|
const xAxisValue = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
|
|
322
339
|
return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(xAxisValue)) === '' ? '' : (0, _chartutilities.formatToLocaleString)(xAxisValue, culture);
|
|
323
340
|
};
|
|
324
|
-
if (hideTickOverlap
|
|
341
|
+
if (hideTickOverlap) {
|
|
325
342
|
const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map((v, i)=>tickFormat(v, i))) + 20;
|
|
326
343
|
const [start, end] = xAxisScale.range();
|
|
327
344
|
tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
@@ -345,10 +362,12 @@ function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleTy
|
|
|
345
362
|
if (xAxisElement) {
|
|
346
363
|
(0, _d3selection.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true').style('direction', 'ltr').style('unicode-bidi', 'isolate');
|
|
347
364
|
}
|
|
348
|
-
const tickValues =
|
|
365
|
+
const tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount);
|
|
366
|
+
const tickLabels = tickValues.map(xAxis.tickFormat());
|
|
349
367
|
return {
|
|
350
368
|
xScale: xAxisScale,
|
|
351
|
-
tickValues
|
|
369
|
+
tickValues,
|
|
370
|
+
tickLabels
|
|
352
371
|
};
|
|
353
372
|
}
|
|
354
373
|
/**
|
|
@@ -536,7 +555,7 @@ function getDateFormatLevel(date, useUTC) {
|
|
|
536
555
|
return (_matchedFormat_formatLevel = matchedFormat === null || matchedFormat === void 0 ? void 0 : matchedFormat.formatLevel) !== null && _matchedFormat_formatLevel !== void 0 ? _matchedFormat_formatLevel : 7;
|
|
537
556
|
}
|
|
538
557
|
function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
|
|
539
|
-
const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, calcMaxLabelWidth, tickStep, tick0, tickText } = xAxisParams;
|
|
558
|
+
const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, hideTickOverlap, calcMaxLabelWidth, tickStep, tick0, tickText } = xAxisParams;
|
|
540
559
|
const isUtcSet = useUTC === true || useUTC === 'utc';
|
|
541
560
|
const xAxisScale = isUtcSet ? (0, _d3scale.scaleUtc)() : (0, _d3scale.scaleTime)();
|
|
542
561
|
xAxisScale.domain([
|
|
@@ -580,10 +599,11 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
580
599
|
}
|
|
581
600
|
return (0, _chartutilities.formatDateToLocaleString)(domainValue, culture, useUTC ? true : false, false, formatOptions);
|
|
582
601
|
};
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
602
|
+
if (hideTickOverlap) {
|
|
603
|
+
const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 40;
|
|
604
|
+
const [start, end] = xAxisScale.range();
|
|
605
|
+
tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
|
|
606
|
+
}
|
|
587
607
|
const xAxis = (0, _d3axis.axisBottom)(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat(tickFormat);
|
|
588
608
|
if ([
|
|
589
609
|
8
|
|
@@ -602,10 +622,12 @@ function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLo
|
|
|
602
622
|
if (xAxisElement) {
|
|
603
623
|
(0, _d3selection.select)(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
|
|
604
624
|
}
|
|
605
|
-
const tickValues =
|
|
625
|
+
const tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount);
|
|
626
|
+
const tickLabels = tickValues.map(xAxis.tickFormat());
|
|
606
627
|
return {
|
|
607
628
|
xScale: xAxisScale,
|
|
608
|
-
tickValues
|
|
629
|
+
tickValues,
|
|
630
|
+
tickLabels
|
|
609
631
|
};
|
|
610
632
|
}
|
|
611
633
|
function createStringXAxis(xAxisParams, tickParams, dataset, culture, _useRtl) {
|
|
@@ -654,7 +676,8 @@ function createStringXAxis(xAxisParams, tickParams, dataset, culture, _useRtl) {
|
|
|
654
676
|
}
|
|
655
677
|
return {
|
|
656
678
|
xScale: xAxisScale,
|
|
657
|
-
tickValues
|
|
679
|
+
tickValues,
|
|
680
|
+
tickLabels: tickValues.map(xAxis.tickFormat())
|
|
658
681
|
};
|
|
659
682
|
}
|
|
660
683
|
function useRtl() {
|
|
@@ -949,14 +972,14 @@ function silceOrAppendToArray(array, value) {
|
|
|
949
972
|
}
|
|
950
973
|
const DEFAULT_WRAP_WIDTH = 10;
|
|
951
974
|
function createWrapOfXLabels(wrapLabelProps) {
|
|
952
|
-
const { node, xAxis, noOfCharsToTruncate, showXAxisLablesTooltip, width = DEFAULT_WRAP_WIDTH } = wrapLabelProps;
|
|
975
|
+
const { node, xAxis, noOfCharsToTruncate, showXAxisLablesTooltip, width = DEFAULT_WRAP_WIDTH, container } = wrapLabelProps;
|
|
953
976
|
if (node === null) {
|
|
954
977
|
return;
|
|
955
978
|
}
|
|
956
979
|
const axisNode = (0, _d3selection.select)(node).call(xAxis);
|
|
957
980
|
let removeVal = 0;
|
|
958
981
|
let maxLines = 1;
|
|
959
|
-
axisNode.selectAll('.tick text').each(function() {
|
|
982
|
+
axisNode.selectAll('.tick text').each(function(_, tickIndex) {
|
|
960
983
|
const text = (0, _d3selection.select)(this);
|
|
961
984
|
const totalWord = text.text();
|
|
962
985
|
const truncatedWord = `${text.text().slice(0, noOfCharsToTruncate)}...`;
|
|
@@ -968,33 +991,33 @@ function createWrapOfXLabels(wrapLabelProps) {
|
|
|
968
991
|
const lineHeight = 1.1; // ems
|
|
969
992
|
const y = text.attr('y');
|
|
970
993
|
const dy = parseFloat(text.attr('dy'));
|
|
971
|
-
let tspan = text.text(null).append('tspan').attr('x', 0).attr('y', y).attr('
|
|
972
|
-
if (showXAxisLablesTooltip
|
|
973
|
-
tspan
|
|
974
|
-
} else if (showXAxisLablesTooltip && totalWordLength <= noOfCharsToTruncate) {
|
|
975
|
-
tspan = text.append('tspan').attr('id', 'LessLength').attr('x', 0).attr('y', y).attr('dy', dy + 'em').text(totalWord);
|
|
994
|
+
let tspan = text.text(null).attr('data-full', totalWord).append('tspan').attr('x', 0).attr('y', y).attr('dy', dy + 'em');
|
|
995
|
+
if (showXAxisLablesTooltip) {
|
|
996
|
+
tspan.text(totalWordLength > noOfCharsToTruncate ? truncatedWord : totalWord);
|
|
976
997
|
} else {
|
|
998
|
+
const maxWidth = Array.isArray(width) ? width[tickIndex] : width;
|
|
977
999
|
while(word = words.pop()){
|
|
978
1000
|
line.push(word);
|
|
979
|
-
|
|
980
|
-
|
|
1001
|
+
const label = line.join(' ');
|
|
1002
|
+
tspan.text(label);
|
|
1003
|
+
const labelWidth = getTextSize(label, CARTESIAN_XAXIS_TEXT_SELECTOR, container).width;
|
|
1004
|
+
if (labelWidth > maxWidth && line.length > 1) {
|
|
981
1005
|
line.pop();
|
|
982
1006
|
tspan.text(line.join(' '));
|
|
983
1007
|
line = [
|
|
984
1008
|
word
|
|
985
1009
|
];
|
|
986
|
-
tspan = text.append('tspan').attr('
|
|
1010
|
+
tspan = text.append('tspan').attr('x', 0).attr('y', y).attr('dy', ++lineNumber * lineHeight + dy + 'em').text(word);
|
|
987
1011
|
}
|
|
988
1012
|
}
|
|
989
1013
|
}
|
|
990
1014
|
maxLines = Math.max(maxLines, lineNumber + 1);
|
|
991
1015
|
});
|
|
992
1016
|
if (!showXAxisLablesTooltip) {
|
|
1017
|
+
var _querySelector;
|
|
993
1018
|
let maxHeight = 12; // intial value to render corretly first time
|
|
994
|
-
|
|
995
|
-
const
|
|
996
|
-
const BoxCordinates = outerHTMLElement && outerHTMLElement.getBoundingClientRect();
|
|
997
|
-
const boxHeight = BoxCordinates && BoxCordinates.height;
|
|
1019
|
+
var _querySelector_getBoundingClientRect_height;
|
|
1020
|
+
const boxHeight = (_querySelector_getBoundingClientRect_height = (_querySelector = (container !== null && container !== void 0 ? container : document).querySelector(`.${CARTESIAN_XAXIS_CLASSNAME} tspan`)) === null || _querySelector === void 0 ? void 0 : _querySelector.getBoundingClientRect().height) !== null && _querySelector_getBoundingClientRect_height !== void 0 ? _querySelector_getBoundingClientRect_height : 0;
|
|
998
1021
|
if (boxHeight > maxHeight) {
|
|
999
1022
|
maxHeight = boxHeight;
|
|
1000
1023
|
}
|
|
@@ -1006,24 +1029,18 @@ function createYAxisLabels(node, yAxis, noOfCharsToTruncate, truncateLabel, isRt
|
|
|
1006
1029
|
if (node === null) {
|
|
1007
1030
|
return;
|
|
1008
1031
|
}
|
|
1009
|
-
let tickIndex = 0;
|
|
1010
1032
|
const axisNode = (0, _d3selection.select)(node).call(yAxis);
|
|
1011
1033
|
axisNode.selectAll('.tick text').each(function() {
|
|
1012
1034
|
const text = (0, _d3selection.select)(this);
|
|
1013
1035
|
const totalWord = text.text();
|
|
1014
1036
|
const truncatedWord = isRtl ? `...${text.text().slice(0, noOfCharsToTruncate)}` : `${text.text().slice(0, noOfCharsToTruncate)}...`;
|
|
1015
1037
|
const totalWordLength = text.text().length;
|
|
1016
|
-
const padding = 0; // ems
|
|
1017
1038
|
const y = text.attr('y');
|
|
1018
1039
|
const x = text.attr('x');
|
|
1019
1040
|
const dy = parseFloat(text.attr('dy'));
|
|
1020
|
-
const
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
if (truncateLabel && totalWordLength > noOfCharsToTruncate) {
|
|
1024
|
-
text.append('tspan').attr('id', `showDots-${uid}`).attr('x', x).attr('y', y).attr('dy', dy + 'em').attr('dx', padding + dx + 'em').text(truncatedWord);
|
|
1025
|
-
} else {
|
|
1026
|
-
text.append('tspan').attr('id', `LessLength-${uid}`).attr('x', x).attr('y', y).attr('dx', padding + dx + 'em').text(totalWord);
|
|
1041
|
+
const tspan = text.text(null).attr('data-full', totalWord).append('tspan').attr('x', x).attr('y', y).attr('dy', dy + 'em');
|
|
1042
|
+
if (truncateLabel) {
|
|
1043
|
+
tspan.text(totalWordLength > noOfCharsToTruncate ? truncatedWord : totalWord);
|
|
1027
1044
|
}
|
|
1028
1045
|
});
|
|
1029
1046
|
}
|
|
@@ -1065,30 +1082,30 @@ const calculateLongestLabelWidth = (labels, query = 'none')=>{
|
|
|
1065
1082
|
return maxLabelWidth;
|
|
1066
1083
|
};
|
|
1067
1084
|
function tooltipOfAxislabels(axistooltipProps) {
|
|
1068
|
-
const { tooltipCls, axis, id } = axistooltipProps;
|
|
1085
|
+
const { tooltipCls, axis, id, container } = axistooltipProps;
|
|
1069
1086
|
if (axis === null) {
|
|
1070
1087
|
return null;
|
|
1071
1088
|
}
|
|
1072
|
-
const div = (0, _d3selection.select)('body').append('div').attr('id', id).attr('class', tooltipCls).style('opacity', 0);
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
const tickObjectLength = tickObject && Object.keys(tickObject).length;
|
|
1082
|
-
for(let i = 0; i < tickObjectLength; i++){
|
|
1083
|
-
const d1 = tickObject[i];
|
|
1084
|
-
(0, _d3selection.select)(d1) // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1089
|
+
const div = (container ? (0, _d3selection.select)(container) : (0, _d3selection.select)('body')).append('div').attr('id', id).attr('class', tooltipCls).style('opacity', 0);
|
|
1090
|
+
axis.selectAll('.tick text').each(function() {
|
|
1091
|
+
const tickSelection = (0, _d3selection.select)(this);
|
|
1092
|
+
const fullLabel = tickSelection.attr('data-full');
|
|
1093
|
+
if (tickSelection.text() === fullLabel) {
|
|
1094
|
+
return;
|
|
1095
|
+
}
|
|
1096
|
+
const tickEl = this;
|
|
1097
|
+
tickSelection // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1085
1098
|
.on('mouseover', (event, d)=>{
|
|
1086
|
-
|
|
1087
|
-
|
|
1099
|
+
const containerBounds = container === null || container === void 0 ? void 0 : container.getBoundingClientRect();
|
|
1100
|
+
const tickBounds = tickEl.getBoundingClientRect();
|
|
1101
|
+
const tooltipBottom = containerBounds ? containerBounds.bottom - (tickBounds.top - 4) : tickBounds.top - 4;
|
|
1102
|
+
var _containerBounds_left;
|
|
1103
|
+
const tooltipLeft = (tickBounds.left + tickBounds.right) / 2 - ((_containerBounds_left = containerBounds === null || containerBounds === void 0 ? void 0 : containerBounds.left) !== null && _containerBounds_left !== void 0 ? _containerBounds_left : 0);
|
|
1104
|
+
div.text(fullLabel).style('bottom', `${tooltipBottom}px`).style('left', `${tooltipLeft}px`).style('transform', 'translateX(-50%)').style('opacity', 0.9);
|
|
1088
1105
|
}).on('mouseout', (d)=>{
|
|
1089
1106
|
div.style('opacity', 0);
|
|
1090
1107
|
});
|
|
1091
|
-
}
|
|
1108
|
+
});
|
|
1092
1109
|
}
|
|
1093
1110
|
function getXAxisType(points) {
|
|
1094
1111
|
let isXAxisDateType = false;
|
|
@@ -1102,11 +1119,11 @@ function getXAxisType(points) {
|
|
|
1102
1119
|
}
|
|
1103
1120
|
return isXAxisDateType;
|
|
1104
1121
|
}
|
|
1105
|
-
function domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, scaleType, hasMarkersMode) {
|
|
1122
|
+
function domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, scaleType, hasMarkersMode, xMinVal, xMaxVal) {
|
|
1106
1123
|
const isScatterPolar = isScatterPolarSeries(points);
|
|
1107
1124
|
let [xMin, xMax] = getScatterXDomainExtent(points, scaleType);
|
|
1108
1125
|
if (hasMarkersMode) {
|
|
1109
|
-
const xPadding = getDomainPaddingForMarkers(xMin, xMax, scaleType);
|
|
1126
|
+
const xPadding = getDomainPaddingForMarkers(xMin, xMax, scaleType, xMinVal, xMaxVal);
|
|
1110
1127
|
xMin = xMin - xPadding.start;
|
|
1111
1128
|
xMax = xMax + xPadding.end;
|
|
1112
1129
|
}
|
|
@@ -1513,8 +1530,8 @@ function areArraysEqual(arr1, arr2) {
|
|
|
1513
1530
|
return true;
|
|
1514
1531
|
}
|
|
1515
1532
|
const cssVarRegExp = /var\((--[a-zA-Z0-9\-]+)\)/g;
|
|
1516
|
-
function resolveCSSVariables(
|
|
1517
|
-
const containerStyles = getComputedStyle(
|
|
1533
|
+
function resolveCSSVariables(container, styleRules) {
|
|
1534
|
+
const containerStyles = getComputedStyle(container);
|
|
1518
1535
|
return styleRules.replace(cssVarRegExp, (match, group1)=>{
|
|
1519
1536
|
return containerStyles.getPropertyValue(group1);
|
|
1520
1537
|
});
|
|
@@ -1614,11 +1631,6 @@ function copyStyle(properties, fromEl, toEl) {
|
|
|
1614
1631
|
});
|
|
1615
1632
|
}
|
|
1616
1633
|
}
|
|
1617
|
-
let measurementSpanCounter = 0;
|
|
1618
|
-
function getUniqueMeasurementSpanId() {
|
|
1619
|
-
measurementSpanCounter++;
|
|
1620
|
-
return `measurement_span_${measurementSpanCounter}`;
|
|
1621
|
-
}
|
|
1622
1634
|
const MEASUREMENT_SPAN_STYLE = {
|
|
1623
1635
|
position: 'absolute',
|
|
1624
1636
|
visibility: 'hidden',
|
|
@@ -1629,23 +1641,60 @@ const MEASUREMENT_SPAN_STYLE = {
|
|
|
1629
1641
|
border: 'none',
|
|
1630
1642
|
whiteSpace: 'pre'
|
|
1631
1643
|
};
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1644
|
+
const MEASUREMENT_SPAN_ID = 'fui_measurement_span';
|
|
1645
|
+
const TEXT_STYLE_PROPERTIES = [
|
|
1646
|
+
'font-size',
|
|
1647
|
+
'font-family',
|
|
1648
|
+
'font-weight',
|
|
1649
|
+
'font-style',
|
|
1650
|
+
'letter-spacing',
|
|
1651
|
+
'text-transform'
|
|
1652
|
+
];
|
|
1653
|
+
const measureTextWithDOM = (text, cssSelector, container)=>{
|
|
1634
1654
|
let measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
|
|
1635
1655
|
if (!measurementSpan) {
|
|
1636
1656
|
measurementSpan = document.createElement('span');
|
|
1637
1657
|
measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);
|
|
1638
1658
|
measurementSpan.setAttribute('aria-hidden', 'true');
|
|
1639
|
-
|
|
1640
|
-
parentElement.appendChild(measurementSpan);
|
|
1641
|
-
} else {
|
|
1642
|
-
document.body.appendChild(measurementSpan);
|
|
1643
|
-
}
|
|
1659
|
+
(container !== null && container !== void 0 ? container : document.body).appendChild(measurementSpan);
|
|
1644
1660
|
}
|
|
1645
|
-
measurementSpan.setAttribute('class', className);
|
|
1646
1661
|
Object.assign(measurementSpan.style, MEASUREMENT_SPAN_STYLE);
|
|
1662
|
+
const refEl = (container !== null && container !== void 0 ? container : document).querySelector(cssSelector);
|
|
1663
|
+
if (refEl) {
|
|
1664
|
+
copyStyle(TEXT_STYLE_PROPERTIES, refEl, measurementSpan);
|
|
1665
|
+
}
|
|
1647
1666
|
measurementSpan.textContent = `${text}`;
|
|
1648
|
-
|
|
1667
|
+
const rect = measurementSpan.getBoundingClientRect();
|
|
1668
|
+
return {
|
|
1669
|
+
node: measurementSpan,
|
|
1670
|
+
width: rect.width,
|
|
1671
|
+
height: rect.height
|
|
1672
|
+
};
|
|
1673
|
+
};
|
|
1674
|
+
const CACHE_SIZE = 2000;
|
|
1675
|
+
const textSizeCache = new Map();
|
|
1676
|
+
const getTextSize = (text, cssSelector, container)=>{
|
|
1677
|
+
const cacheKey = `${text}|${cssSelector}`;
|
|
1678
|
+
const cachedResult = textSizeCache.get(cacheKey);
|
|
1679
|
+
if (cachedResult) {
|
|
1680
|
+
return cachedResult;
|
|
1681
|
+
}
|
|
1682
|
+
const { width, height } = measureTextWithDOM(text, cssSelector, container);
|
|
1683
|
+
// TODO: Improve cache eviction strategy if needed (e.g., LRU)
|
|
1684
|
+
if (textSizeCache.size >= CACHE_SIZE) {
|
|
1685
|
+
const firstKey = textSizeCache.keys().next().value;
|
|
1686
|
+
if (!(0, _chartutilities.isInvalidValue)(firstKey)) {
|
|
1687
|
+
textSizeCache.delete(firstKey);
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1690
|
+
textSizeCache.set(cacheKey, {
|
|
1691
|
+
width,
|
|
1692
|
+
height
|
|
1693
|
+
});
|
|
1694
|
+
return {
|
|
1695
|
+
width,
|
|
1696
|
+
height
|
|
1697
|
+
};
|
|
1649
1698
|
};
|
|
1650
1699
|
function isScatterPolarSeries(points) {
|
|
1651
1700
|
return points.some((item)=>{
|
|
@@ -1667,17 +1716,26 @@ const createNumericScale = (scaleType)=>{
|
|
|
1667
1716
|
return (0, _d3scale.scaleLinear)();
|
|
1668
1717
|
}
|
|
1669
1718
|
};
|
|
1670
|
-
const getDomainPaddingForMarkers = (minVal, maxVal, scaleType)=>{
|
|
1719
|
+
const getDomainPaddingForMarkers = (minVal, maxVal, scaleType, userMinVal, userMaxVal)=>{
|
|
1671
1720
|
if (scaleType === 'log') {
|
|
1672
1721
|
return {
|
|
1673
1722
|
start: minVal * 0.5,
|
|
1674
1723
|
end: maxVal
|
|
1675
1724
|
};
|
|
1676
1725
|
}
|
|
1677
|
-
|
|
1726
|
+
/* if user explicitly sets userMinVal or userMaxVal, we will check that to avoid excessive padding on either side.
|
|
1727
|
+
If the difference between minVal and userMinVal is more than 10% of the data range, we set padding to 0 on that side.
|
|
1728
|
+
this is to avoid cases where userMinVal is significantly smaller than minVal or userMaxVal is significantly larger than
|
|
1729
|
+
maxVal, which would lead to excessive padding. In other cases, we apply the default 10% padding on both sides.
|
|
1730
|
+
*/ const rangePadding = (maxVal - minVal) * 0.1;
|
|
1731
|
+
// If explicit bounds are set and they're far from the data range, don't add extra padding
|
|
1732
|
+
const paddingAlreadySatisfiedAtMin = userMinVal !== undefined && rangePadding > Math.abs(minVal - Math.min(minVal, userMinVal));
|
|
1733
|
+
const paddingAlreadySatisfiedAtMax = userMaxVal !== undefined && rangePadding > Math.abs(maxVal - Math.max(maxVal, userMaxVal));
|
|
1734
|
+
const startPadding = paddingAlreadySatisfiedAtMin ? 0 : rangePadding;
|
|
1735
|
+
const endPadding = paddingAlreadySatisfiedAtMax ? 0 : rangePadding;
|
|
1678
1736
|
return {
|
|
1679
|
-
start:
|
|
1680
|
-
end:
|
|
1737
|
+
start: startPadding,
|
|
1738
|
+
end: endPadding
|
|
1681
1739
|
};
|
|
1682
1740
|
};
|
|
1683
1741
|
const isValidDomainValue = (value, scaleType)=>{
|
|
@@ -1770,7 +1828,7 @@ const generateNumericTicks = (scaleType, tickStep, tick0, scaleDomain)=>{
|
|
|
1770
1828
|
const refTick = typeof tick0 === 'number' ? tick0 : 0;
|
|
1771
1829
|
if (scaleType === 'log') {
|
|
1772
1830
|
if (typeof tickStep === 'number' && tickStep > 0) {
|
|
1773
|
-
return generateLinearTicks(refTick, tickStep, scaleDomain.map((d)=>Math.log10(d))).map((t)=>
|
|
1831
|
+
return generateLinearTicks(refTick, tickStep, scaleDomain.map((d)=>Math.log10(d))).map((t)=>10 ** t);
|
|
1774
1832
|
}
|
|
1775
1833
|
if (typeof tickStep === 'string') {
|
|
1776
1834
|
const prefix = tickStep[0];
|
|
@@ -1817,7 +1875,7 @@ function calculatePrecision(value) {
|
|
|
1817
1875
|
return 0;
|
|
1818
1876
|
}
|
|
1819
1877
|
function precisionRound(value, precision, base = 10) {
|
|
1820
|
-
const exp =
|
|
1878
|
+
const exp = base ** precision;
|
|
1821
1879
|
return Math.round(value * exp) / exp;
|
|
1822
1880
|
}
|
|
1823
1881
|
const findCalloutPoints = (calloutPointsByX, x)=>{
|
|
@@ -1833,3 +1891,102 @@ const findCalloutPoints = (calloutPointsByX, x)=>{
|
|
|
1833
1891
|
values: calloutPointsByX[key]
|
|
1834
1892
|
};
|
|
1835
1893
|
};
|
|
1894
|
+
const autoLayoutXAxisLabels = (tickValues, tickLabels, scale, axisNode, containerWidth, container)=>{
|
|
1895
|
+
let requiresWrap = false;
|
|
1896
|
+
let requiresTruncate = false;
|
|
1897
|
+
const maxWidths = [];
|
|
1898
|
+
const [rangeStart, rangeEnd] = scale.range();
|
|
1899
|
+
const isRTL = rangeEnd - rangeStart < 0;
|
|
1900
|
+
const start = isRTL ? containerWidth : 0;
|
|
1901
|
+
const end = isRTL ? 0 : containerWidth;
|
|
1902
|
+
const getTickPosition = (index)=>{
|
|
1903
|
+
var _scale;
|
|
1904
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1905
|
+
return ((_scale = scale(tickValues[index])) !== null && _scale !== void 0 ? _scale : 0) + ('bandwidth' in scale ? scale.bandwidth() / 2 : 0);
|
|
1906
|
+
};
|
|
1907
|
+
const getLabelWidth = (text)=>{
|
|
1908
|
+
return getTextSize(text, CARTESIAN_XAXIS_TEXT_SELECTOR, container).width;
|
|
1909
|
+
};
|
|
1910
|
+
for(let i = 0; i < tickValues.length; i++){
|
|
1911
|
+
const position = getTickPosition(i);
|
|
1912
|
+
const leftSpace = Math.abs(i > 0 ? (position - getTickPosition(i - 1)) / 2 : position - start);
|
|
1913
|
+
const rightSpace = Math.abs(i + 1 < tickValues.length ? (getTickPosition(i + 1) - position) / 2 : end - position);
|
|
1914
|
+
const maxAvailableWidth = Math.min(leftSpace, rightSpace) * 2 - 8; // 4px padding on both sides
|
|
1915
|
+
const label = tickLabels[i];
|
|
1916
|
+
const labelWidth = getLabelWidth(label);
|
|
1917
|
+
maxWidths.push(maxAvailableWidth);
|
|
1918
|
+
if (labelWidth > maxAvailableWidth) {
|
|
1919
|
+
const longestWordWidth = Math.max(...label.split(/\s+/).map((word)=>getLabelWidth(word)));
|
|
1920
|
+
if (longestWordWidth <= maxAvailableWidth) {
|
|
1921
|
+
requiresWrap = true;
|
|
1922
|
+
} else {
|
|
1923
|
+
requiresTruncate = true;
|
|
1924
|
+
}
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
if (requiresTruncate) {
|
|
1928
|
+
return truncateAndStaggerXAxisLabels(tickValues, tickLabels, scale, axisNode, containerWidth, container);
|
|
1929
|
+
}
|
|
1930
|
+
if (requiresWrap) {
|
|
1931
|
+
var _createWrapOfXLabels;
|
|
1932
|
+
return (_createWrapOfXLabels = createWrapOfXLabels({
|
|
1933
|
+
node: axisNode,
|
|
1934
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1935
|
+
xAxis: scale,
|
|
1936
|
+
noOfCharsToTruncate: 100,
|
|
1937
|
+
showXAxisLablesTooltip: false,
|
|
1938
|
+
width: maxWidths,
|
|
1939
|
+
container
|
|
1940
|
+
})) !== null && _createWrapOfXLabels !== void 0 ? _createWrapOfXLabels : 0;
|
|
1941
|
+
}
|
|
1942
|
+
return 0;
|
|
1943
|
+
};
|
|
1944
|
+
const truncateAndStaggerXAxisLabels = (tickValues, tickLabels, scale, axisNode, containerWidth, container)=>{
|
|
1945
|
+
if (!axisNode) {
|
|
1946
|
+
return 0;
|
|
1947
|
+
}
|
|
1948
|
+
let maxHeight = 12;
|
|
1949
|
+
const [rangeStart, rangeEnd] = scale.range();
|
|
1950
|
+
const isRTL = rangeEnd - rangeStart < 0;
|
|
1951
|
+
const start = isRTL ? containerWidth : 0;
|
|
1952
|
+
const end = isRTL ? 0 : containerWidth;
|
|
1953
|
+
const getTickPosition = (index)=>{
|
|
1954
|
+
var _scale;
|
|
1955
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1956
|
+
return ((_scale = scale(tickValues[index])) !== null && _scale !== void 0 ? _scale : 0) + ('bandwidth' in scale ? scale.bandwidth() / 2 : 0);
|
|
1957
|
+
};
|
|
1958
|
+
const getLabelSize = (text)=>{
|
|
1959
|
+
return getTextSize(text, CARTESIAN_XAXIS_TEXT_SELECTOR, container);
|
|
1960
|
+
};
|
|
1961
|
+
(0, _d3selection.select)(axisNode).selectAll('.tick text').each(function(_, i) {
|
|
1962
|
+
const position = getTickPosition(i);
|
|
1963
|
+
const leftSpace = Math.abs(i > 0 ? position - getTickPosition(i - 1) : position - start);
|
|
1964
|
+
const rightSpace = Math.abs(i + 1 < tickValues.length ? getTickPosition(i + 1) - position : end - position);
|
|
1965
|
+
const maxAvailableWidth = Math.min(leftSpace, rightSpace) * 2 - 8; // 4px padding on both sides
|
|
1966
|
+
const label = tickLabels[i];
|
|
1967
|
+
const textNode = (0, _d3selection.select)(this).text(null).attr('data-full', label);
|
|
1968
|
+
const lineHeight = 1.1; // ems
|
|
1969
|
+
const y = textNode.attr('y');
|
|
1970
|
+
const dy = parseFloat(textNode.attr('dy'));
|
|
1971
|
+
textNode.append('tspan').attr('x', 0).attr('y', y).attr('dy', (i % 2 === 1 ? lineHeight : 0) + dy + 'em').text(truncateTextToFitWidth(label, maxAvailableWidth, (s)=>getLabelSize(s).width));
|
|
1972
|
+
maxHeight = Math.max(maxHeight, getLabelSize(label).height);
|
|
1973
|
+
});
|
|
1974
|
+
return tickValues.length > 1 ? maxHeight : 0;
|
|
1975
|
+
};
|
|
1976
|
+
const truncateTextToFitWidth = (text, maxWidth, measure)=>{
|
|
1977
|
+
if (measure(text) <= maxWidth) {
|
|
1978
|
+
return text;
|
|
1979
|
+
}
|
|
1980
|
+
let lo = 1;
|
|
1981
|
+
let hi = text.length;
|
|
1982
|
+
while(lo < hi){
|
|
1983
|
+
const mid = Math.floor((lo + hi + 1) / 2);
|
|
1984
|
+
const candidate = text.slice(0, mid) + '...';
|
|
1985
|
+
if (measure(candidate) <= maxWidth) {
|
|
1986
|
+
lo = mid;
|
|
1987
|
+
} else {
|
|
1988
|
+
hi = mid - 1;
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
return text.slice(0, lo) + '...';
|
|
1992
|
+
};
|