onesight-charts 1.4.0 → 1.4.1
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.
|
@@ -46,7 +46,9 @@ function StackedBar(props) {
|
|
|
46
46
|
_props$yAxisLabelWidt = props.yAxisLabelWidth,
|
|
47
47
|
yAxisLabelWidth = _props$yAxisLabelWidt === void 0 ? true : _props$yAxisLabelWidt,
|
|
48
48
|
_props$showAllLegends = props.showAllLegends,
|
|
49
|
-
showAllLegends = _props$showAllLegends === void 0 ? false : _props$showAllLegends
|
|
49
|
+
showAllLegends = _props$showAllLegends === void 0 ? false : _props$showAllLegends,
|
|
50
|
+
_props$xAxisMaxMultip = props.xAxisMaxMultiplier,
|
|
51
|
+
xAxisMaxMultiplier = _props$xAxisMaxMultip === void 0 ? 1.1 : _props$xAxisMaxMultip;
|
|
50
52
|
var chartRef = useRef();
|
|
51
53
|
var legendMoreBtnRef = useRef(null);
|
|
52
54
|
var dropdownRef = useRef(null);
|
|
@@ -332,8 +334,8 @@ function StackedBar(props) {
|
|
|
332
334
|
finalMax = maxTotal + overflowPx * unitPerPx;
|
|
333
335
|
}
|
|
334
336
|
|
|
335
|
-
// 确保最终值不小于 maxTotal * 1.3
|
|
336
|
-
finalMax = Math.max(finalMax, maxTotal * 1.3) *
|
|
337
|
+
// 确保最终值不小于 maxTotal * 1.3,并应用额外的倍率以确保标签完全显示
|
|
338
|
+
finalMax = Math.max(finalMax, maxTotal * 1.3) * xAxisMaxMultiplier;
|
|
337
339
|
}
|
|
338
340
|
}
|
|
339
341
|
|
|
@@ -56,8 +56,10 @@ function StackedBar(props) {
|
|
|
56
56
|
legendNum = 4,
|
|
57
57
|
legendDropdownRight = -98,
|
|
58
58
|
yAxisLabelWidth = true,
|
|
59
|
-
showAllLegends = false
|
|
59
|
+
showAllLegends = false,
|
|
60
60
|
// 是否显示所有图例
|
|
61
|
+
xAxisMaxMultiplier = 1.1
|
|
62
|
+
// X 轴最大值的额外倍率,用于确保标签完全显示
|
|
61
63
|
} = props;
|
|
62
64
|
const chartRef = (0, import_react.useRef)();
|
|
63
65
|
const legendMoreBtnRef = (0, import_react.useRef)(null);
|
|
@@ -298,7 +300,7 @@ function StackedBar(props) {
|
|
|
298
300
|
const unitPerPx = maxTotal / barAreaWidth;
|
|
299
301
|
finalMax = maxTotal + overflowPx * unitPerPx;
|
|
300
302
|
}
|
|
301
|
-
finalMax = Math.max(finalMax, maxTotal * 1.3) *
|
|
303
|
+
finalMax = Math.max(finalMax, maxTotal * 1.3) * xAxisMaxMultiplier;
|
|
302
304
|
}
|
|
303
305
|
}
|
|
304
306
|
const lastNonZeroSeriesIdxPerRow = yAxisData.map((_, rowIdx) => {
|