# Add Trendline

### Overview

This procedure adds a mathematical trendline to an existing **scatter plot** to help visualize data trends. You can choose between linear *(straight line)* or quadratic *(curved line)* trendlines.

### Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

<details>

<summary><code>add a {linear|quadratic} trendline to the plot</code></summary>

#### What does it do?

Adds a straight-line trendline to the scatter plot.

#### Where does it go?

This phrase should be written on a **new line**.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — A reference to **the plot** must be defined in the automation. Replace the adjective with `linear` to add a linear trendline or `quadratic` to add a quadratic trendline. The default is `linear`.

#### Example

```
add a linear trendline to the plot
```

</details>

### Examples

#### 1. Linear Trendline

```
create a scatter plot where
    the x values are [1, 2, 3, 4, 5, 6]
    the y values are [65, 72, 78, 85, 91, 97]
    the title is "Score vs Study Time"
    the x label is "Study Hours"
    the y label is "Test Score"
    the style is "white"
add a linear trendline to the plot
show the plot
```

#### 2. Quadratic Trendline

```
create a scatter plot where
    the x values are [1, 2, 3, 4, 5]
    the y values are [2, 8, 18, 32, 50]
    the title is "Quadratic Growth Pattern"
add a quadratic trendline to the plot
show the plot
```


---

# 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.kognitos.com/legacy/legacy-experience/automation-areas/charts/add-trendline.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.
