Preview Updated 2026-05-10

ChartCrosshair

Crosshair locator + tooltip helper that can be embedded inside any SVG chart.

Basic usage

Data is passed in via props and rendered as plain SVG — no third-party charting library. Colors come from the --viz-1..8 tokens and are color-blind friendly.

y=60
Demo source
src/App.vue vue
<CfChartCrosshair ... />
src/App.tsx tsx
<CfChartCrosshair ... />

API

PropTypeDefaultDescription
visiblebooleantrue
x / ynumberPixel coordinates (within the parent SVG coordinate system)
width / heightnumberTotal parent SVG size (used to size the lines)
showVertical / showHorizontalbooleantrue / false
tooltipstringValue label that follows the cursor

反馈与讨论

ChartCrosshair · Discussion

0
0 / 600
一键发送
正在加载评论...