diff --git a/packages/f2/src/components/tooltip/tooltipView.tsx b/packages/f2/src/components/tooltip/tooltipView.tsx
index e74474b0f..ce319d1ce 100644
--- a/packages/f2/src/components/tooltip/tooltipView.tsx
+++ b/packages/f2/src/components/tooltip/tooltipView.tsx
@@ -14,6 +14,11 @@ const defaultStyle = {
lineWidth: '2px',
},
showTooltipMarker: false,
+ markerBackgroundStyle: {
+ fill: '#CCD6EC',
+ opacity: 0.3,
+ padding: '6px',
+ },
tooltipMarkerStyle: {
fill: '#fff',
lineWidth: '3px',
@@ -87,9 +92,9 @@ function directionEnabled(mode: string, dir: string) {
}
const RenderItemMarker = (props) => {
- const { records, coord, context } = props;
+ const { records, coord, context, markerBackgroundStyle } = props;
const point = coord.convertPoint({ x: 1, y: 1 });
- const padding = context.px2hd('6px');
+ const padding = context.px2hd(markerBackgroundStyle.padding || '6px');
const xPoints = [
...records.map((record) => record.xMin),
...records.map((record) => record.xMax),
@@ -122,8 +127,7 @@ const RenderItemMarker = (props) => {
y,
width,
height,
- fill: '#CCD6EC',
- opacity: 0.3,
+ ...markerBackgroundStyle
}}
/>
);
@@ -243,6 +247,7 @@ export default class TooltipView extends Component {
// showTitle,
// titleStyle,
showTooltipMarker = defaultStyle.showTooltipMarker,
+ markerBackgroundStyle = defaultStyle.markerBackgroundStyle,
showItemMarker = defaultStyle.showItemMarker,
itemMarkerStyle: customItemMarkerStyle,
nameStyle,
@@ -377,7 +382,7 @@ export default class TooltipView extends Component {
)}
{showTooltipMarker ? (
-
+
) : null}
{/* 辅助线 */}
{showCrosshairs ? (
diff --git "a/packages/f2/test/chart/__image_snapshots__/landscape-test-tsx-\346\250\252\345\261\217-\346\250\252\345\261\217\346\230\276\347\244\272-1-snap.png" "b/packages/f2/test/chart/__image_snapshots__/landscape-test-tsx-\346\250\252\345\261\217-\346\250\252\345\261\217\346\230\276\347\244\272-1-snap.png"
index c4676b519..6bffc801f 100644
Binary files "a/packages/f2/test/chart/__image_snapshots__/landscape-test-tsx-\346\250\252\345\261\217-\346\250\252\345\261\217\346\230\276\347\244\272-1-snap.png" and "b/packages/f2/test/chart/__image_snapshots__/landscape-test-tsx-\346\250\252\345\261\217-\346\250\252\345\261\217\346\230\276\347\244\272-1-snap.png" differ
diff --git a/packages/f2/test/chart/landscape.test.tsx b/packages/f2/test/chart/landscape.test.tsx
index 83be378ea..05b30c9ea 100644
--- a/packages/f2/test/chart/landscape.test.tsx
+++ b/packages/f2/test/chart/landscape.test.tsx
@@ -30,7 +30,7 @@ describe('横屏', () => {
-
+
);