diff --git a/common/changes/@visactor/vchart/fix-crosshair-line-width_2024-03-20-09-47.json b/common/changes/@visactor/vchart/fix-crosshair-line-width_2024-03-20-09-47.json new file mode 100644 index 0000000000..c477e705a2 --- /dev/null +++ b/common/changes/@visactor/vchart/fix-crosshair-line-width_2024-03-20-09-47.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vchart", + "comment": "fix: `lineWidth` is invalid in rect-type-crosshair, related #2432", + "type": "none" + } + ], + "packageName": "@visactor/vchart" +} \ No newline at end of file diff --git a/packages/vchart/src/component/crosshair/base.ts b/packages/vchart/src/component/crosshair/base.ts index 8e33568761..224a615b6f 100644 --- a/packages/vchart/src/component/crosshair/base.ts +++ b/packages/vchart/src/component/crosshair/base.ts @@ -375,10 +375,12 @@ export abstract class BaseCrossHair ({ style: { fill: { type: 'palette', key: 'axisGridColor' }, opacity: 0.7, - lineDash: [] + lineWidth: 0, // 默认不显示边线 + // 此处设置 stroke 和 lineDash 是为了用户想要 line 形式的 crosshair 时,可以直接复用颜色和配置 + stroke: { type: 'palette', key: 'markLineStrokeColor' }, + lineDash: [2, 3] } } as ICrosshairRectSpec, label: getLabelSpec() @@ -50,7 +53,7 @@ const getLinearField = (): ICrosshairValueFieldSpec => ({ visible: true, style: { stroke: { type: 'palette', key: 'markLineStrokeColor' }, - fill: { type: 'palette', key: 'axisGridColor' }, + fill: 'transparent', opacity: 0.7, lineDash: [2, 3] }