Line Chart
Eine oder mehrere Reihen über Kategorien oder Zeit: gerade oder geglättete Linien, eine Werteachse mit runden Teilstrichen, Punkte, Legende und Tooltip, mit wanderndem Fokus und einer verborgenen Datentabelle.
Angular: verfügbar Vue: verfügbar React: verfügbar React Native: verfügbar
Verwendung
- Desktop
- Mobile
| Month | Desktop | Mobile |
|---|---|---|
| Jan | 186 | 80 |
| Feb | 305 | 200 |
| Mar | 237 | 120 |
| Apr | 73 | 190 |
| May | 209 | 130 |
| Jun | 214 | 140 |
<div class="demo-stack" style="padding-top: var(--space-4)">
<sone-line-chart
[data]="visitors"
[series]="series"
xKey="month"
curve="smooth"
ariaLabel="Visitors, January to June 2026"
categoryHeader="Month"
/>
</div>Import
import {
SoneLineChartComponent,
} from "@surface-one/angular/line-chart";API-Referenz
SoneLineChartComponentKomponente
`<sone-line-chart>` — one or more series over categories or time (shadcn/ui Line Chart): a value axis with round ticks and grid lines, straight or smoothed (`curve="smooth"`, monotone) lines that break at a missing value, dots, a legend and a tooltip. `area` fills under the lines and `stacked` stacks them (what `<sone-area-chart>` draws). One Tab stop with a roving focus over the x values (Left/Right/Home/End, Escape hides the tooltip); each is an image named by its values, and a visually hidden table carries the data for screen-reader browsing.
| Name | Typ | Standard |
|---|---|---|
dataThe rows, left to right: each holds the x value (`xKey`) and one value per series. | readonly T[] | [] |
seriesThe series: `{ key, label, tone }`, `key` naming the row property of its values. | readonly SoneLineChartSeries[] | [] |
xKeyThe row property of the x value. | string | "x" |
xScale`category` — evenly spaced; `time` — spaced by date (`Date`, epoch ms or ISO string). | SoneLineChartXScale | "category" |
xFormatThe label of an x value (axis, tooltip, table); default: the text, or a short date. | SoneLineChartXFormat | null | null |
xTicksAt most this many x-axis labels (stepped back from the last one); 0 hides the axis. | number | 6 |
yTicksAbout this many value-axis steps. | number | 4 |
yMinThe bottom of the value axis; default: 0, or the lowest value when negative. | number | null | null |
yMaxThe top of the value axis; default: a round step above the highest value. | number | null | null |
heightThe plot height in CSS pixels (the x labels sit below it). | number | 200 |
curve`linear` — straight segments; `smooth` — a monotone curve. | SoneLineChartCurve | "linear" |
areaFills under each line. | boolean | false |
stackedStacks the series on one another (with `area`, each fills down to the one below). | boolean | false |
dotsDraws a dot on every value (the hovered or focused x value always shows its dots). | boolean | true |
legendShows the legend under the plot. | boolean | true |
ariaLabelNames the chart and captions its data table (“Visitors, January to June”). | string | "" |
valueFormatFormats values on the axis, in the tooltip and in the data table. | SoneLineChartFormat | defaultFormat |
categoryHeaderThe data table's category column header. | — | $localize`Category` |