diff --git a/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-chromium-linux.png b/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-chromium-linux.png index 8ab6d45587..cecb65eefb 100644 Binary files a/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-chromium-linux.png and b/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-chromium-linux.png differ diff --git a/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-firefox-linux.png b/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-firefox-linux.png index 9e536e4832..a573d82f3c 100644 Binary files a/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-firefox-linux.png and b/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-firefox-linux.png differ diff --git a/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-webkit-linux.png b/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-webkit-linux.png index 44f9738568..f9f6aae1dc 100644 Binary files a/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-webkit-linux.png and b/semcore/d3-chart/__tests__/d3-chart-base.browser-test.tsx-snapshots/-visual-Reference-Lines-Verify-attributes-reference-lines-1-webkit-linux.png differ diff --git a/semcore/d3-chart/src/Reference.jsx b/semcore/d3-chart/src/Reference.jsx index 8326b6cb80..1bb41295da 100644 --- a/semcore/d3-chart/src/Reference.jsx +++ b/semcore/d3-chart/src/Reference.jsx @@ -6,6 +6,10 @@ import createElement from './createElement'; import style from './style/reference.shadow.css'; import { scaleOfBandwidth } from './utils'; +const STROKE_WIDTH = 1; +const NOTCH_WIDTH = 9; +const NOTCH_DELTA = NOTCH_WIDTH / 2 - STROKE_WIDTH / 4; + const side2direction = { left: 'vertical', right: 'vertical', @@ -22,6 +26,18 @@ const lineDirection2props = { x2: x, y1: yRange[0], y2: yRange[1], + notchFirst: { + x1: x - NOTCH_DELTA, + x2: x + NOTCH_DELTA, + y1: yRange[0], + y2: yRange[0], + }, + notchLast: { + x1: x - NOTCH_DELTA, + x2: x + NOTCH_DELTA, + y1: yRange[1], + y2: yRange[1], + }, }; }, horizontal: ([xScale, yScale], value) => { @@ -32,6 +48,18 @@ const lineDirection2props = { x2: xRange[1], y1: y, y2: y, + notchFirst: { + x1: xRange[0], + x2: xRange[0], + y1: y - NOTCH_DELTA, + y2: y + NOTCH_DELTA, + }, + notchLast: { + x1: xRange[1], + x2: xRange[1], + y1: y - NOTCH_DELTA, + y2: y + NOTCH_DELTA, + }, }; }, }; @@ -118,15 +146,19 @@ class ReferenceLineRoot extends Component { const SReferenceLine = this.Element; const { title, scale, position, value, color, resolveColor, styles } = this.asProps; const positionProps = lineDirection2props[side2direction[position]]; + const { notchFirst, notchLast, ...line } = positionProps(scale, value); return sstyled(styles)( <> + > + + + + {title && {title}} , );