# Time series chart

Dates on the x axis, a comparison line and a crosshair tooltip.

Section: Charts / Cartesian
Page: https://ui.heyramzi.com/components/time-series-chart
Import path: `@heyramzi/ui/charts`

## Import

```ts
import { TimeSeriesChart } from "@heyramzi/ui/charts";
```

## Usage

```svelte
<TimeSeriesChart
  data={[{ date: "2026-07-01", value: 1200, value2: 900 }]}
  label="This period"
  label2="Previous"
  height={280}
/>
```

## Demo

```svelte
<script lang="ts">
	import { TimeSeriesChart } from "@heyramzi/ui/charts";

	const data = Array.from({ length: 60 }, (_, i) => {
		const d = new Date(2026, 6, 1 + i);
		const wave = Math.sin(i / 6) * 220 + i * 18;
		return {
			date: d.toISOString().slice(0, 10),
			value: Math.round(1200 + wave + (i % 7) * 40),
			value2: Math.round(900 + wave * 0.6),
		};
	});
</script>

<TimeSeriesChart {data} label="This period" label2="Previous" height={280} />
```

## API

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `data` | `DataPoint[]` |  | required |
| `label` | `string` | `"Value"` |  |
| `label2` | `string` |  |  |
| `color` | `string` | `"var(--chart-series-1)"` |  |
| `color2` | `string` | `"var(--chart-series-2)"` |  |
| `formatValue` | `(v: number) => string` | `(v) => v.toLocaleString()` |  |
| `formatValue2` | `(v: number) => string` |  |  |
| `height` | `number` | `280` |  |
| `softMax` | `boolean` | `false` | Clamp Y-axis to 95th percentile so outlier spikes don't flatten normal data |
| `yMin` | `number` | `0` | Y-axis floor. Raise above 0 to frame variation around a baseline. |
| `edgeFade` | `boolean \| number` | `true` | Softens the left and right ends of the filled area instead of cutting them off at the plot edge. |
| `ariaLabel` | `string` | `label` | The chart's accessible name. Its date range and values are read after it. |
