Added moving average computation

This commit is contained in:
2025-07-27 16:00:23 +02:00
parent 0093eda1d6
commit 60d505935b
3 changed files with 30 additions and 13 deletions

View File

@@ -16,17 +16,18 @@ Lightweight, canvasbased charting library written in TypeScript, designed for
The `createChartElement(seriesList, options)` function supports the following options:
| Option | Type | Description |
|------------------|-------------------------------------|-----------------------------------------------------------------------------|
| `width` | `number` | Fixed chart width in pixels (optional, defaults to container width) |
| `height` | `number` | Fixed chart height in pixels (optional, defaults to container height) |
| `min` | `number` | Minimum Y-axis value (optional, auto-computed if not set) |
| `max` | `number` | Maximum Y-axis value (optional, auto-computed if not set) |
| `showYAxis` | `boolean` | Whether to render Y-axis ticks and labels |
| `yTicks` | `number` | Number of Y-axis ticks (default: `5`) |
| `backgroundColor`| `string` | Optional background fill color |
| `maxTimeDelta` | `number \| null` | Gap in ms that breaks line continuity (default: `600`) |
| `dateFormat` | `(ts: number) => string` | Custom formatter for the cursor timestamp label |
| Option | Type | Description |
|-------------------|--------------------------|----------------------------------------------------------------------------|
| `width` | `number` | Fixed chart width in pixels (optional, defaults to container width) |
| `height` | `number` | Fixed chart height in pixels (optional, defaults to container height) |
| `min` | `number` | Minimum Y-axis value (optional, auto-computed if not set) |
| `max` | `number` | Maximum Y-axis value (optional, auto-computed if not set) |
| `showYAxis` | `boolean` | Whether to render Y-axis ticks and labels |
| `yTicks` | `number` | Number of Y-axis ticks (default: `5`) |
| `backgroundColor` | `string` | Optional background fill color |
| `maxTimeDelta` | `number \| null` | Gap in ms that breaks line continuity (default: `600`) |
| `dateFormat` | `(ts: number) => string` | Custom formatter for the cursor timestamp label |
| `averageData` | `number` | Compute simple moving average of lasy n data to smooth out line (optional) |
```ts
// Example: format timestamp to full Czech date+time