# TimelineRenderer

> Renders the shared Timeline summary, filters, empty hint, and positioned span chart.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Panel](/docs/extensions/debug-core/reference/panel/index.md) › [Timeline](/docs/extensions/debug-core/reference/panel/timeline/index.md) › TimelineRenderer

| final class | `PHPForge\Debug\Panel\Timeline\TimelineRenderer` |
| --- | --- |
| Source | [`src/Panel/Timeline/TimelineRenderer.php`](https://github.com/php-forge/debug-core/blob/main/src/Panel/Timeline/TimelineRenderer.php#L25) |

Renders the shared Timeline summary, filters, empty hint, and positioned span chart.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`renderChart()`](#method-renderChart) static | Renders the complete timeline chart from prepared spans and ruler offsets. | `TimelineRenderer` |
| [`renderEmptyHint()`](#method-renderEmptyHint) static | Renders the empty-state hint linking to the sortable Profiling panel. | `TimelineRenderer` |
| [`renderFilterForm()`](#method-renderFilterForm) static | Renders the filter form while preserving adapter-owned route parameters. | `TimelineRenderer` |
| [`renderSummary()`](#method-renderSummary) static | Renders total duration, peak memory, and visible span count. | `TimelineRenderer` |

## Method details

### renderChart() <span id="method-renderChart"></span>

```php
public static function renderChart(list<PHPForge\Debug\Panel\Timeline\TimelineSpanRow> $rows, array<int, float> $rulers, string $memorySvg = '', int $memory = 0, int $memoryHeight = 40): string
```

Renders the complete timeline chart from prepared spans and ruler offsets.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$rows` | `list<`[`TimelineSpanRow`](/docs/extensions/debug-core/reference/panel/timeline/timelinespanrow/index.md)`>` | Positioned timeline spans. |
| `$rulers` | `array<int, float>` | Ruler offsets keyed by milliseconds. |
| `$memorySvg` | `string` | Inline memory graph markup, or an empty string to omit the footer. |
| `$memory` | `int` | Peak memory reported in the footer, in bytes. |
| `$memoryHeight` | `int` | Memory graph track height, in pixels. |

**Returns**

`string`: Chart markup, or an empty string when no span survived filtering.

### renderEmptyHint() <span id="method-renderEmptyHint"></span>

```php
public static function renderEmptyHint(bool $hasRows, string $profilingUrl): string
```

Renders the empty-state hint linking to the sortable Profiling panel.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$hasRows` | `bool` | Whether any span survived filtering. |
| `$profilingUrl` | `string` | URL of the Profiling panel for the same request. |

**Returns**

`string`: Hint markup, or an empty string when spans are present.

### renderFilterForm() <span id="method-renderFilterForm"></span>

```php
public static function renderFilterForm(string $action, array<string, string> $hiddenParams, string $duration, string $category): string
```

Renders the filter form while preserving adapter-owned route parameters.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$action` | `string` | Form action URL owned by the adapter. |
| `$hiddenParams` | `array<string, string>` | Hidden route and theme parameters. |
| `$duration` | `string` | Minimum duration filter, in milliseconds. |
| `$category` | `string` | Category filter matched against span names. |

**Returns**

`string`: Filter form markup.

### renderSummary() <span id="method-renderSummary"></span>

```php
public static function renderSummary(float $duration, int $memory, int $spanCount): string
```

Renders total duration, peak memory, and visible span count.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$duration` | `float` | Total request duration, in milliseconds. |
| `$memory` | `int` | Peak memory, in bytes. |
| `$spanCount` | `int` | Number of spans left after filtering. |

**Returns**

`string`: Summary header markup.