# Time-based

{% hint style="success" %}
This is the official documentation of the `forestadmin/laravel-forestadmin` v2+ and `forestadmin/symfony-forestadmin` PHP agents.
{% endhint %}

![Time-based Chart example](/files/tudsohPKJCnNYSNW6cX4)

Time-based charts are very similar to distribution charts, the only differences being that:

* An additional parameter tells the frontend if the dates should be displayed by `Day`, `Week`, `Month`, or `Year`,
* The keys of the returned object must be ISO-8601 compliant dates.

```php
use ForestAdmin\AgentPHP\DatasourceCustomizer\Context\AgentCustomizationContext;
use ForestAdmin\AgentPHP\DatasourceCustomizer\Decorators\Chart\ResultBuilder;

$forestAgent->addChart(
    'transactionVolume',
    fn(AgentCustomizationContext $context, ResultBuilder $resultBuilder) => $resultBuilder->timeBased(
        'Month',
        [
            '2017-02-01' => 636,
            '2017-03-01' => 740,
            '2017-04-01' => 648,
            '2017-05-01' => 726,
        ]
    )
);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forestadmin.com/developer-guide-agents-php/agent-customization/charts/time.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
