@fluentui/react-charts 9.2.1 → 9.2.3
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 +57 -2
- package/dist/index.d.ts +168 -15
- package/lib/ChartTable.js +1 -0
- package/lib/ChartTable.js.map +1 -0
- package/lib/components/AreaChart/AreaChart.js +4 -1
- package/lib/components/AreaChart/AreaChart.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ChartTable/ChartTable.js +58 -0
- package/lib/components/ChartTable/ChartTable.js.map +1 -0
- package/lib/components/ChartTable/ChartTable.types.js +1 -0
- package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib/components/ChartTable/index.js +3 -0
- package/lib/components/ChartTable/index.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js +93 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +55 -0
- package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +170 -100
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib/components/DeclarativeChart/DeclarativeChart.js +180 -102
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +100 -0
- package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +890 -211
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.js +2 -2
- package/lib/components/DonutChart/DonutChart.js.map +1 -1
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
- package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib/components/GanttChart/GanttChart.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +185 -144
- package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
- package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
- package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
- package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib/components/Legends/Legends.js.map +1 -1
- package/lib/components/Legends/OverflowMenu.js.map +1 -1
- package/lib/components/LineChart/LineChart.js +251 -78
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/LineChart/LineChart.types.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.js +10 -3
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +56 -37
- 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 +21 -4
- package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +16 -3
- package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalBarChart/VerticalBarChart.js +38 -14
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +214 -96
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js.map +1 -1
- package/lib/utilities/utilities.js +41 -42
- package/lib/utilities/utilities.js.map +1 -1
- package/lib/utilities/vbc-utils.js +24 -0
- package/lib/utilities/vbc-utils.js.map +1 -1
- package/lib-commonjs/ChartTable.js +6 -0
- package/lib-commonjs/ChartTable.js.map +1 -0
- package/lib-commonjs/components/AreaChart/AreaChart.js +4 -1
- package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ChartTable/ChartTable.js +69 -0
- package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js +6 -0
- package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
- package/lib-commonjs/components/ChartTable/index.js +8 -0
- package/lib-commonjs/components/ChartTable/index.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +196 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +69 -0
- package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +169 -98
- 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/ChartPopover.types.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +176 -100
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +128 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +909 -209
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
- package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
- 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/Pie/Pie.js.map +1 -1
- package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +183 -142
- package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
- package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
- package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/Legends/Legends.js.map +1 -1
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.js +250 -78
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +12 -3
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +56 -37
- 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 +30 -3
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +15 -2
- package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +37 -13
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +213 -95
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
- package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/types/DataPoint.js.map +1 -1
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +44 -41
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/lib-commonjs/utilities/vbc-utils.js +27 -0
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
- package/package.json +10 -10
|
@@ -36,15 +36,20 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
36
36
|
let _xScale;
|
|
37
37
|
let isIntegralDataset = true;
|
|
38
38
|
let _tooltipId = (0, _reactutilities.useId)('tooltip_');
|
|
39
|
+
/* Used for when WrapXAxisLabels props appeared.
|
|
40
|
+
* To display the total word (space separated words), Need to have more space than usual.
|
|
41
|
+
* This height will get total height need to disaply total word.
|
|
42
|
+
* These value need to be removed from actual svg height/graph height.
|
|
43
|
+
* Defalut value is 0. And this values calculted when 'wrapXAxisLables' or 'showXAxisLablesTooltip' is true.
|
|
44
|
+
*/ let _removalValueForTextTuncate = 0;
|
|
39
45
|
const [containerWidth, setContainerWidth] = _react.useState(0);
|
|
40
46
|
const [containerHeight, setContainerHeight] = _react.useState(0);
|
|
41
|
-
const [isRemoveValCalculated, setIsRemoveValCalculated] = _react.useState(true);
|
|
42
|
-
const [removalValueForTextTuncate, setRemovalValueForTextTuncate] = _react.useState(0);
|
|
43
47
|
const [startFromX, setStartFromX] = _react.useState(0);
|
|
44
48
|
const [prevProps, setPrevProps] = _react.useState(null);
|
|
45
|
-
const
|
|
49
|
+
const chartTypesWithStringYAxis = [
|
|
46
50
|
_index.ChartTypes.HorizontalBarChartWithAxis,
|
|
47
51
|
_index.ChartTypes.HeatMapChart,
|
|
52
|
+
_index.ChartTypes.VerticalStackedBarChart,
|
|
48
53
|
_index.ChartTypes.GanttChart
|
|
49
54
|
];
|
|
50
55
|
var _props_margins_top, _props_margins_bottom, _props_margins_left, _props_margins_right, _props_margins_right1, _props_margins_left1;
|
|
@@ -60,17 +65,34 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
60
65
|
right: _useRtl ? (_props_margins_left = (_props_margins2 = props.margins) === null || _props_margins2 === void 0 ? void 0 : _props_margins2.left) !== null && _props_margins_left !== void 0 ? _props_margins_left : 40 : ((_props_margins_right = (_props_margins3 = props.margins) === null || _props_margins3 === void 0 ? void 0 : _props_margins3.right) !== null && _props_margins_right !== void 0 ? _props_margins_right : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20,
|
|
61
66
|
left: _useRtl ? ((_props_margins_right1 = (_props_margins4 = props.margins) === null || _props_margins4 === void 0 ? void 0 : _props_margins4.right) !== null && _props_margins_right1 !== void 0 ? _props_margins_right1 : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20 : (_props_margins_left1 = (_props_margins5 = props.margins) === null || _props_margins5 === void 0 ? void 0 : _props_margins5.left) !== null && _props_margins_left1 !== void 0 ? _props_margins_left1 : 40
|
|
62
67
|
};
|
|
68
|
+
const TITLE_MARGIN = 20;
|
|
63
69
|
if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {
|
|
64
70
|
var _props_margins6;
|
|
65
71
|
var _props_margins_bottom1;
|
|
66
|
-
margins.bottom = (_props_margins_bottom1 = (_props_margins6 = props.margins) === null || _props_margins6 === void 0 ? void 0 : _props_margins6.bottom) !== null && _props_margins_bottom1 !== void 0 ? _props_margins_bottom1 :
|
|
72
|
+
margins.bottom = (_props_margins_bottom1 = (_props_margins6 = props.margins) === null || _props_margins6 === void 0 ? void 0 : _props_margins6.bottom) !== null && _props_margins_bottom1 !== void 0 ? _props_margins_bottom1 : margins.bottom + TITLE_MARGIN;
|
|
67
73
|
}
|
|
68
74
|
if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {
|
|
69
75
|
var _props_margins7, _props_margins8, _props_margins9, _props_margins10;
|
|
70
76
|
var _props_margins_right2, _props_margins_left2;
|
|
71
|
-
margins.left = _useRtl ? ((_props_margins_right2 = (_props_margins7 = props.margins) === null || _props_margins7 === void 0 ? void 0 : _props_margins7.right) !== null && _props_margins_right2 !== void 0 ? _props_margins_right2 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ?
|
|
77
|
+
margins.left = _useRtl ? ((_props_margins_right2 = (_props_margins7 = props.margins) === null || _props_margins7 === void 0 ? void 0 : _props_margins7.right) !== null && _props_margins_right2 !== void 0 ? _props_margins_right2 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? margins.right + 2 * TITLE_MARGIN : margins.right + TITLE_MARGIN : (_props_margins_left2 = (_props_margins8 = props.margins) === null || _props_margins8 === void 0 ? void 0 : _props_margins8.left) !== null && _props_margins_left2 !== void 0 ? _props_margins_left2 : margins.left + TITLE_MARGIN;
|
|
72
78
|
var _props_margins_left3, _props_margins_right3;
|
|
73
|
-
margins.right = _useRtl ? (_props_margins_left3 = (_props_margins9 = props.margins) === null || _props_margins9 === void 0 ? void 0 : _props_margins9.left) !== null && _props_margins_left3 !== void 0 ? _props_margins_left3 :
|
|
79
|
+
margins.right = _useRtl ? (_props_margins_left3 = (_props_margins9 = props.margins) === null || _props_margins9 === void 0 ? void 0 : _props_margins9.left) !== null && _props_margins_left3 !== void 0 ? _props_margins_left3 : margins.left + TITLE_MARGIN : ((_props_margins_right3 = (_props_margins10 = props.margins) === null || _props_margins10 === void 0 ? void 0 : _props_margins10.right) !== null && _props_margins_right3 !== void 0 ? _props_margins_right3 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? margins.right + 2 * TITLE_MARGIN : margins.right + TITLE_MARGIN;
|
|
80
|
+
}
|
|
81
|
+
if (props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '') {
|
|
82
|
+
var _props_margins11;
|
|
83
|
+
var _props_margins_top1;
|
|
84
|
+
margins.top = (_props_margins_top1 = (_props_margins11 = props.margins) === null || _props_margins11 === void 0 ? void 0 : _props_margins11.top) !== null && _props_margins_top1 !== void 0 ? _props_margins_top1 : margins.top + TITLE_MARGIN;
|
|
85
|
+
}
|
|
86
|
+
if (props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '')) {
|
|
87
|
+
if (_useRtl) {
|
|
88
|
+
var _props_margins12;
|
|
89
|
+
var _props_margins_right4;
|
|
90
|
+
margins.left = (_props_margins_right4 = (_props_margins12 = props.margins) === null || _props_margins12 === void 0 ? void 0 : _props_margins12.right) !== null && _props_margins_right4 !== void 0 ? _props_margins_right4 : margins.right + TITLE_MARGIN;
|
|
91
|
+
} else {
|
|
92
|
+
var _props_margins13;
|
|
93
|
+
var _props_margins_right5;
|
|
94
|
+
margins.right = (_props_margins_right5 = (_props_margins13 = props.margins) === null || _props_margins13 === void 0 ? void 0 : _props_margins13.right) !== null && _props_margins_right5 !== void 0 ? _props_margins_right5 : margins.right + TITLE_MARGIN;
|
|
95
|
+
}
|
|
74
96
|
}
|
|
75
97
|
const classes = (0, _useCartesianChartStylesstyles.useCartesianChartStyles)(props);
|
|
76
98
|
const focusAttributes = (0, _reacttabster.useFocusableGroup)();
|
|
@@ -83,8 +105,8 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
83
105
|
if (props !== null) {
|
|
84
106
|
setPrevProps(props);
|
|
85
107
|
}
|
|
86
|
-
if (
|
|
87
|
-
const maxYAxisLabelLength = calculateMaxYAxisLabelLength(
|
|
108
|
+
if (chartTypesWithStringYAxis.includes(props.chartType) && props.showYAxisLables && yAxisElement && props.yAxisType === _index.YAxisType.StringAxis) {
|
|
109
|
+
const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis);
|
|
88
110
|
if (startFromX !== maxYAxisLabelLength) {
|
|
89
111
|
setStartFromX(maxYAxisLabelLength);
|
|
90
112
|
}
|
|
@@ -106,8 +128,8 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
106
128
|
_fitParentContainer();
|
|
107
129
|
}
|
|
108
130
|
}
|
|
109
|
-
if (
|
|
110
|
-
const maxYAxisLabelLength = calculateMaxYAxisLabelLength(
|
|
131
|
+
if (chartTypesWithStringYAxis.includes(props.chartType) && props.showYAxisLables && yAxisElement && props.yAxisType === _index.YAxisType.StringAxis) {
|
|
132
|
+
const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis);
|
|
111
133
|
if (startFromX !== maxYAxisLabelLength) {
|
|
112
134
|
setStartFromX(maxYAxisLabelLength);
|
|
113
135
|
}
|
|
@@ -122,19 +144,6 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
122
144
|
props,
|
|
123
145
|
prevProps
|
|
124
146
|
]);
|
|
125
|
-
_react.useEffect(()=>{
|
|
126
|
-
if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType === _index.XAxisTypes.StringAxis) {
|
|
127
|
-
const rotateLabelProps = {
|
|
128
|
-
node: xAxisElement.current,
|
|
129
|
-
xAxis: _xScale
|
|
130
|
-
};
|
|
131
|
-
const rotatedHeight = (0, _index.rotateXAxisLabels)(rotateLabelProps);
|
|
132
|
-
if (isRemoveValCalculated && removalValueForTextTuncate !== rotatedHeight + margins.bottom && rotatedHeight > 0) {
|
|
133
|
-
setRemovalValueForTextTuncate(rotatedHeight + margins.bottom);
|
|
134
|
-
setIsRemoveValCalculated(false);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
147
|
_react.useImperativeHandle(props.componentRef, ()=>{
|
|
139
148
|
var _chartContainer_current;
|
|
140
149
|
return {
|
|
@@ -151,19 +160,14 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
151
160
|
function _generateCallout(calloutProps) {
|
|
152
161
|
return /*#__PURE__*/ _react.createElement(_ChartPopover.ChartPopover, calloutProps);
|
|
153
162
|
}
|
|
154
|
-
function calculateMaxYAxisLabelLength(
|
|
163
|
+
function calculateMaxYAxisLabelLength(className) {
|
|
155
164
|
const formatTickLabel = (str)=>{
|
|
156
165
|
if (props.showYAxisLablesTooltip) {
|
|
157
166
|
return (0, _index.truncateString)(str, props.noOfCharsToTruncate || 4);
|
|
158
167
|
}
|
|
159
168
|
return str;
|
|
160
169
|
};
|
|
161
|
-
|
|
162
|
-
var _points__data, _points_;
|
|
163
|
-
return (0, _index.calculateLongestLabelWidth)((_points_ = points[0]) === null || _points_ === void 0 ? void 0 : (_points__data = _points_.data) === null || _points__data === void 0 ? void 0 : _points__data.map((point)=>formatTickLabel(`${point.y}`)), `.${className} text`);
|
|
164
|
-
} else {
|
|
165
|
-
return (0, _index.calculateLongestLabelWidth)(points === null || points === void 0 ? void 0 : points.map((point)=>formatTickLabel(`${point.y}`)), `.${className} text`);
|
|
166
|
-
}
|
|
170
|
+
return (0, _index.calculateLongestLabelWidth)(props.stringDatasetForYAxisDomain.map((label)=>formatTickLabel(label)), `.${className} text`);
|
|
167
171
|
}
|
|
168
172
|
const { calloutProps, points, chartType, svgProps, culture, dateLocalizeOptions, timeFormatLocale, customDateTimeFormatter } = props;
|
|
169
173
|
if (props.parentRef) {
|
|
@@ -172,7 +176,8 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
172
176
|
const margin = {
|
|
173
177
|
...margins
|
|
174
178
|
};
|
|
175
|
-
|
|
179
|
+
// Note: This check is unnecessary since startFromX is only set for charts with string y-axis.
|
|
180
|
+
if (chartTypesWithStringYAxis.includes(props.chartType)) {
|
|
176
181
|
if (!_useRtl) {
|
|
177
182
|
margin.left += startFromX;
|
|
178
183
|
} else {
|
|
@@ -188,7 +193,13 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
188
193
|
var _props_showRoundOffXTickValues;
|
|
189
194
|
const XAxisParams = {
|
|
190
195
|
domainNRangeValues: props.getDomainNRangeValues(points, props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins, containerWidth, chartType, _useRtl, props.xAxisType, props.barwidth, props.tickValues, startFromX),
|
|
191
|
-
|
|
196
|
+
// FIXME: In XAxisParams, containerHeight is used by HBWA to generate vertical gridlines.
|
|
197
|
+
// Since the x-axis in HBWA is numeric, it typically doesn't require transformation.
|
|
198
|
+
// However, if transformation props are enabled, the updated _removalValueForTextTuncate
|
|
199
|
+
// will only be available in the next render, as it's set after the axis is created.
|
|
200
|
+
// Solution: Delay the creation of gridlines until after the transformation has been applied,
|
|
201
|
+
// or precompute the required height for transformed labels (_removalValueForTextTuncate).
|
|
202
|
+
containerHeight: containerHeight - _removalValueForTextTuncate,
|
|
192
203
|
margins: margins,
|
|
193
204
|
xAxisElement: xAxisElement.current,
|
|
194
205
|
showRoundOffXTickValues: (_props_showRoundOffXTickValues = props.showRoundOffXTickValues) !== null && _props_showRoundOffXTickValues !== void 0 ? _props_showRoundOffXTickValues : true,
|
|
@@ -199,24 +210,8 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
199
210
|
xAxisInnerPadding: props.xAxisInnerPadding,
|
|
200
211
|
xAxisOuterPadding: props.xAxisOuterPadding,
|
|
201
212
|
containerWidth: containerWidth,
|
|
202
|
-
hideTickOverlap: props.
|
|
203
|
-
|
|
204
|
-
const YAxisParams = {
|
|
205
|
-
margins: props.getYDomainMargins ? props.getYDomainMargins(containerHeight) : margins,
|
|
206
|
-
containerWidth: containerWidth,
|
|
207
|
-
containerHeight: containerHeight - removalValueForTextTuncate,
|
|
208
|
-
yAxisElement: yAxisElement.current,
|
|
209
|
-
yAxisTickFormat: props.yAxisTickFormat,
|
|
210
|
-
yAxisTickCount: props.yAxisTickCount,
|
|
211
|
-
yMinValue: props.yMinValue || 0,
|
|
212
|
-
yMaxValue: props.yMaxValue || 0,
|
|
213
|
-
tickPadding: props.showYAxisLablesTooltip ? 15 : 10,
|
|
214
|
-
maxOfYVal: props.maxOfYVal,
|
|
215
|
-
yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType),
|
|
216
|
-
// please note these padding default values must be consistent in here
|
|
217
|
-
// and the parent chart(HBWA/Vertical etc..) for more details refer example
|
|
218
|
-
// http://using-d3js.com/04_07_ordinal_scales.html
|
|
219
|
-
yAxisPadding: props.yAxisPadding || 0
|
|
213
|
+
hideTickOverlap: props.rotateXAxisLables ? false : props.hideTickOverlap,
|
|
214
|
+
calcMaxLabelWidth: _calcMaxLabelWidthWithTransform
|
|
220
215
|
};
|
|
221
216
|
/**
|
|
222
217
|
* These scales used for 2 purposes.
|
|
@@ -241,25 +236,24 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
241
236
|
}
|
|
242
237
|
_xScale = xScale;
|
|
243
238
|
_tickValues = tickValues;
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
239
|
+
_transformXAxisLabels();
|
|
240
|
+
const YAxisParams = {
|
|
241
|
+
margins: props.getYDomainMargins ? props.getYDomainMargins(containerHeight) : margins,
|
|
242
|
+
containerWidth: containerWidth,
|
|
243
|
+
containerHeight: containerHeight - _removalValueForTextTuncate,
|
|
244
|
+
yAxisElement: yAxisElement.current,
|
|
245
|
+
yAxisTickFormat: props.yAxisTickFormat,
|
|
246
|
+
yAxisTickCount: props.yAxisTickCount,
|
|
247
|
+
yMinValue: props.yMinValue || 0,
|
|
248
|
+
yMaxValue: props.yMaxValue || 0,
|
|
249
|
+
tickPadding: 10,
|
|
250
|
+
maxOfYVal: props.maxOfYVal,
|
|
251
|
+
yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType),
|
|
252
|
+
// please note these padding default values must be consistent in here
|
|
253
|
+
// and the parent chart(HBWA/Vertical etc..) for more details refer example
|
|
254
|
+
// http://using-d3js.com/04_07_ordinal_scales.html
|
|
255
|
+
yAxisPadding: props.yAxisPadding || 0
|
|
256
|
+
};
|
|
263
257
|
/**
|
|
264
258
|
* These scales used for 2 purposes.
|
|
265
259
|
* 1. To create x and y axis
|
|
@@ -273,7 +267,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
273
267
|
yAxisDomainValues: []
|
|
274
268
|
};
|
|
275
269
|
if (props.yAxisType && props.yAxisType === _index.YAxisType.StringAxis) {
|
|
276
|
-
yScalePrimary = props.createStringYAxis(YAxisParams, props.stringDatasetForYAxisDomain, _useRtl, props.barwidth);
|
|
270
|
+
yScalePrimary = props.createStringYAxis(YAxisParams, props.stringDatasetForYAxisDomain, _useRtl, props.barwidth, props.chartType);
|
|
277
271
|
} else {
|
|
278
272
|
// TODO: Since the scale domain values are now computed independently for both the primary and
|
|
279
273
|
// secondary y-axes, the yMinValue and yMaxValue props are no longer necessary for accurately
|
|
@@ -286,7 +280,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
286
280
|
const YAxisParamsSecondary = {
|
|
287
281
|
margins: margins,
|
|
288
282
|
containerWidth: containerWidth,
|
|
289
|
-
containerHeight: containerHeight -
|
|
283
|
+
containerHeight: containerHeight - _removalValueForTextTuncate,
|
|
290
284
|
yAxisElement: yAxisElementSecondary.current,
|
|
291
285
|
yAxisTickFormat: props.yAxisTickFormat,
|
|
292
286
|
yAxisTickCount: props.yAxisTickCount,
|
|
@@ -300,7 +294,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
300
294
|
}
|
|
301
295
|
yScalePrimary = props.createYAxis(YAxisParams, _useRtl, axisData, isIntegralDataset, chartType, false, props.roundedTicks);
|
|
302
296
|
}
|
|
303
|
-
if (
|
|
297
|
+
if (chartTypesWithStringYAxis.includes(props.chartType) && props.yAxisType === _index.YAxisType.StringAxis) {
|
|
304
298
|
// Removing un wanted tooltip div from DOM, when prop not provided, for proper cleanup
|
|
305
299
|
// of unwanted DOM elements, to prevent flacky behaviour in tooltips , that might occur
|
|
306
300
|
// in creating tooltips when tooltips are enabled( as we try to recreate a tspan with _tooltipId)
|
|
@@ -333,7 +327,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
333
327
|
// Call back to the chart.
|
|
334
328
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
335
329
|
const _getData = (xScale, yScalePrimary, yScaleSecondary)=>{
|
|
336
|
-
props.getGraphData && props.getGraphData(xScale, yScalePrimary, containerHeight -
|
|
330
|
+
props.getGraphData && props.getGraphData(xScale, yScalePrimary, containerHeight - _removalValueForTextTuncate, containerWidth, xAxisElement.current, yAxisElement.current, yScaleSecondary);
|
|
337
331
|
};
|
|
338
332
|
props.getAxisData && props.getAxisData(axisData);
|
|
339
333
|
// Callback function for chart, returns axis
|
|
@@ -354,7 +348,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
354
348
|
height: containerHeight
|
|
355
349
|
};
|
|
356
350
|
const xAxisTitleMaximumAllowedWidth = svgDimensions.width - margins.left - margins.right - startFromX;
|
|
357
|
-
const yAxisTitleMaximumAllowedHeight = svgDimensions.height - margins.bottom - margins.top -
|
|
351
|
+
const yAxisTitleMaximumAllowedHeight = svgDimensions.height - margins.bottom - margins.top - _removalValueForTextTuncate - titleMargin;
|
|
358
352
|
/**
|
|
359
353
|
* When screen resizes, along with screen, chart also auto adjusted.
|
|
360
354
|
* This method used to adjust height and width of the charts.
|
|
@@ -385,39 +379,88 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
385
379
|
props.onChartMouseLeave && props.onChartMouseLeave();
|
|
386
380
|
}
|
|
387
381
|
function _calculateChartMinWidth() {
|
|
388
|
-
|
|
382
|
+
// Adding 10px for padding on both sides
|
|
383
|
+
const labelWidth = _calcMaxLabelWidthWithTransform(_tickValues) + 10;
|
|
384
|
+
let minChartWidth = margins.left + margins.right + labelWidth * (_tickValues.length - 1);
|
|
385
|
+
if ([
|
|
386
|
+
_index.ChartTypes.GroupedVerticalBarChart,
|
|
387
|
+
_index.ChartTypes.VerticalBarChart,
|
|
388
|
+
_index.ChartTypes.VerticalStackedBarChart
|
|
389
|
+
].includes(props.chartType)) {
|
|
390
|
+
const minDomainMargin = 8;
|
|
391
|
+
minChartWidth += minDomainMargin * 2;
|
|
392
|
+
}
|
|
393
|
+
return minChartWidth;
|
|
394
|
+
}
|
|
395
|
+
function _calcMaxLabelWidthWithTransform(x) {
|
|
389
396
|
// Case: rotated labels
|
|
390
397
|
if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType === _index.XAxisTypes.StringAxis) {
|
|
391
|
-
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
|
|
398
|
+
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(x, `.${classes.xAxis} text`);
|
|
399
|
+
return Math.ceil(longestLabelWidth * Math.cos(Math.PI / 4));
|
|
400
|
+
}
|
|
401
|
+
// Case: truncated labels
|
|
402
|
+
if (props.showXAxisLablesTooltip) {
|
|
403
|
+
const tickValues = x.map((val)=>{
|
|
395
404
|
const numChars = props.noOfCharsToTruncate || 4;
|
|
396
405
|
return val.toString().length > numChars ? `${val.toString().slice(0, numChars)}...` : val;
|
|
397
406
|
});
|
|
398
407
|
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(tickValues, `.${classes.xAxis} text`);
|
|
399
|
-
|
|
400
|
-
}
|
|
408
|
+
return Math.ceil(longestLabelWidth);
|
|
409
|
+
}
|
|
410
|
+
// Case: wrapped labels
|
|
411
|
+
if (props.wrapXAxisLables) {
|
|
412
|
+
// FIXME: Calculate the max width of lines instead of words. This requires applying
|
|
413
|
+
// the wrapping transformation earlier to obtain the actual rendered lines.
|
|
401
414
|
const words = [];
|
|
402
|
-
|
|
415
|
+
x.forEach((val)=>{
|
|
403
416
|
words.push(...val.toString().split(/\s+/));
|
|
404
417
|
});
|
|
418
|
+
// This approach works well in most cases, since overflow typically occurs only when
|
|
419
|
+
// a single word exceeds the specified width — otherwise, the text will wrap as expected.
|
|
405
420
|
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(words, `.${classes.xAxis} text`);
|
|
406
|
-
|
|
407
|
-
} else {
|
|
408
|
-
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(_tickValues, `.${classes.xAxis} text`);
|
|
409
|
-
labelWidth += Math.ceil(longestLabelWidth);
|
|
421
|
+
return Math.max(Math.ceil(longestLabelWidth), _index.DEFAULT_WRAP_WIDTH);
|
|
410
422
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
423
|
+
// Default case
|
|
424
|
+
const longestLabelWidth = (0, _index.calculateLongestLabelWidth)(x, `.${classes.xAxis} text`);
|
|
425
|
+
return Math.ceil(longestLabelWidth);
|
|
426
|
+
}
|
|
427
|
+
function _transformXAxisLabels() {
|
|
428
|
+
_removalValueForTextTuncate = 0;
|
|
429
|
+
/*
|
|
430
|
+
* To enable wrapping of x axis tick values or to display complete x axis tick values,
|
|
431
|
+
* we need to calculate how much space it needed to render the text.
|
|
432
|
+
* No need to re-calculate every time the chart renders and same time need to get an update. So using setState.
|
|
433
|
+
* Required space will be calculated first time chart rendering and if any width/height of chart updated.
|
|
434
|
+
* */ if (props.wrapXAxisLables || props.showXAxisLablesTooltip) {
|
|
435
|
+
let maxXAxisLabelWidth;
|
|
436
|
+
if (props.xAxisType === _index.XAxisTypes.StringAxis) {
|
|
437
|
+
var _props_datasetForXAxisDomain;
|
|
438
|
+
if ((((_props_datasetForXAxisDomain = props.datasetForXAxisDomain) === null || _props_datasetForXAxisDomain === void 0 ? void 0 : _props_datasetForXAxisDomain.length) || 0) > 1) {
|
|
439
|
+
maxXAxisLabelWidth = _xScale.step();
|
|
440
|
+
} else {
|
|
441
|
+
maxXAxisLabelWidth = containerWidth;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
const wrapLabelProps = {
|
|
445
|
+
node: xAxisElement.current,
|
|
446
|
+
xAxis: _xScale,
|
|
447
|
+
showXAxisLablesTooltip: props.showXAxisLablesTooltip || false,
|
|
448
|
+
noOfCharsToTruncate: props.noOfCharsToTruncate || 4,
|
|
449
|
+
width: maxXAxisLabelWidth
|
|
450
|
+
};
|
|
451
|
+
var _createWrapOfXLabels;
|
|
452
|
+
_removalValueForTextTuncate = (_createWrapOfXLabels = (0, _index.createWrapOfXLabels)(wrapLabelProps)) !== null && _createWrapOfXLabels !== void 0 ? _createWrapOfXLabels : 0;
|
|
453
|
+
}
|
|
454
|
+
if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType === _index.XAxisTypes.StringAxis) {
|
|
455
|
+
const rotateLabelProps = {
|
|
456
|
+
node: xAxisElement.current,
|
|
457
|
+
xAxis: _xScale
|
|
458
|
+
};
|
|
459
|
+
var _rotateXAxisLabels;
|
|
460
|
+
const rotatedHeight = (_rotateXAxisLabels = (0, _index.rotateXAxisLabels)(rotateLabelProps)) !== null && _rotateXAxisLabels !== void 0 ? _rotateXAxisLabels : 0;
|
|
461
|
+
// margins.bottom is used as padding here
|
|
462
|
+
_removalValueForTextTuncate = rotatedHeight + margins.bottom;
|
|
419
463
|
}
|
|
420
|
-
return minChartWidth;
|
|
421
464
|
}
|
|
422
465
|
/**
|
|
423
466
|
* We have use the {@link defaultTabbableElement } to fix
|
|
@@ -462,7 +505,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
462
505
|
},
|
|
463
506
|
id: `xAxisGElement${idForGraph}`,
|
|
464
507
|
// To add wrap of x axis lables feature, need to remove word height from svg height.
|
|
465
|
-
transform: `translate(0, ${svgDimensions.height - margins.bottom -
|
|
508
|
+
transform: `translate(0, ${svgDimensions.height - margins.bottom - _removalValueForTextTuncate})`,
|
|
466
509
|
className: classes.xAxis
|
|
467
510
|
}), props.xAxisTitle !== undefined && props.xAxisTitle !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
468
511
|
content: props.xAxisTitle,
|
|
@@ -476,6 +519,19 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
476
519
|
wrapContent: _index.wrapContent,
|
|
477
520
|
showBackground: true,
|
|
478
521
|
className: classes.svgTooltip
|
|
522
|
+
}), props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
523
|
+
content: props.xAxisAnnotation,
|
|
524
|
+
textProps: {
|
|
525
|
+
x: margins.left + startFromX + xAxisTitleMaximumAllowedWidth / 2,
|
|
526
|
+
y: titleMargin + 3,
|
|
527
|
+
className: classes.axisAnnotation,
|
|
528
|
+
textAnchor: 'middle',
|
|
529
|
+
'aria-hidden': true
|
|
530
|
+
},
|
|
531
|
+
maxWidth: xAxisTitleMaximumAllowedWidth,
|
|
532
|
+
wrapContent: _index.wrapContent,
|
|
533
|
+
showBackground: true,
|
|
534
|
+
className: classes.svgTooltip
|
|
479
535
|
}), /*#__PURE__*/ _react.createElement("g", {
|
|
480
536
|
ref: (e)=>{
|
|
481
537
|
yAxisElement.current = e;
|
|
@@ -493,7 +549,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
493
549
|
}), props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
494
550
|
content: props.secondaryYAxistitle,
|
|
495
551
|
textProps: {
|
|
496
|
-
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 +
|
|
552
|
+
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
|
|
497
553
|
y: _useRtl ? startFromX - titleMargin : svgDimensions.width - margins.right,
|
|
498
554
|
textAnchor: 'middle',
|
|
499
555
|
transform: `translate(${_useRtl ? margins.right / 2 - titleMargin : margins.right / 2 + titleMargin},
|
|
@@ -507,7 +563,7 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
507
563
|
})), children, props.yAxisTitle !== undefined && props.yAxisTitle !== '' && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
508
564
|
content: props.yAxisTitle,
|
|
509
565
|
textProps: {
|
|
510
|
-
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 +
|
|
566
|
+
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
|
|
511
567
|
y: _useRtl ? svgDimensions.width - margins.right / 2 + titleMargin : margins.left / 2 - titleMargin,
|
|
512
568
|
textAnchor: 'middle',
|
|
513
569
|
transform: `translate(0,
|
|
@@ -518,6 +574,21 @@ const CartesianChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
|
518
574
|
wrapContent: _index.wrapContent,
|
|
519
575
|
showBackground: true,
|
|
520
576
|
className: classes.svgTooltip
|
|
577
|
+
}), props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '') && /*#__PURE__*/ _react.createElement(_SVGTooltipText.SVGTooltipText, {
|
|
578
|
+
content: props.yAxisAnnotation,
|
|
579
|
+
textProps: {
|
|
580
|
+
x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
|
|
581
|
+
y: _useRtl ? startFromX - titleMargin : svgDimensions.width - margins.right,
|
|
582
|
+
textAnchor: 'middle',
|
|
583
|
+
transform: `translate(${_useRtl ? margins.right / 2 - titleMargin : margins.right / 2 + titleMargin},
|
|
584
|
+
${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
|
|
585
|
+
className: classes.axisAnnotation,
|
|
586
|
+
'aria-hidden': true
|
|
587
|
+
},
|
|
588
|
+
maxWidth: yAxisTitleMaximumAllowedHeight,
|
|
589
|
+
wrapContent: _index.wrapContent,
|
|
590
|
+
showBackground: true,
|
|
591
|
+
className: classes.svgTooltip
|
|
521
592
|
}))), !props.hideLegend && /*#__PURE__*/ _react.createElement("div", {
|
|
522
593
|
ref: (e)=>legendContainer = e,
|
|
523
594
|
className: classes.legendContainer
|