Preview Updated 2026-05-10

LineChart

Multi-series line chart with smooth curves, gridlines, and x/y axis labels.

Basic usage

Data is passed via props; pure SVG rendering with no third-party chart library. Colors come from the --viz-1..8 tokens and are color-blind friendly.

2036536985000204060810121416182022
<CfLineChart ... />
<CfLineChart ... />

Smooth curves

smooth = true uses Catmull-Rom-style cubic Bezier curves with a tension of 0.2 from neighbor differences, without overshooting (no “half-circle” bulges at corners).

smooth = false
203653698501234567891011
smooth = true(Catmull-Rom)
203653698501234567891011
<CfLineChart :series="series" smooth />
<CfLineChart series={series} smooth />

Multiple series

Up to 8 simultaneous series; colors cycle through --viz-1..8.

52545658501234567891011
<CfLineChart :series="series" smooth />
<CfLineChart series={series} smooth />

API

PropTypeDefaultDescription
seriesLineSeries[]{ name?, data: number[] }[]
labelsstring[]auto 0..n-1x-axis labels
width / heightnumber480 / 240
smoothbooleanfalseSmooth curves
showGrid / showLabelsbooleantrue
yLabelFn(v) => stringv.toFixed(0)y-axis label formatter

反馈与讨论

LineChart · Discussion

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