# CircleGraph

A circular graph component.

## Usage <a href="#usage" id="usage"></a>

```jsx
import { CircleGraph } from '@aragon/ui'

const App = () => <CircleGraph value={1 / 3} />
```

## Demonstration

![](/files/P9t0JRonATLTElBrtJkV)

## Props <a href="#props" id="props"></a>

#### `color` <a href="#color" id="color"></a>

| TYPE                   | DEFAULT VALUE |
| ---------------------- | ------------- |
| `Function` or `String` | None          |

The color representing the active part in the circle. When a function is passed, it takes the interpolated `value` as a unique parameter, and is expected to return a color. Avoid doing anything slow in this function as it gets called 60 times per second.

#### `label` <a href="#label" id="label"></a>

| TYPE                 | DEFAULT VALUE |
| -------------------- | ------------- |
| `Function` or `Node` | None          |

If a React node is passed, it gets rendered directly.

If a function is passed, it gets called to generate the label displayed on the graph. It takes two parameters: the animated value and the static value. The animated value should be enough in most cases, but the second parameter can be helpful in certain cases. This function should return an object containing the following nodes:

* `value`: the main number (defaults to `Math.round(value * 100)`).
* `suffix`: the suffix to display (defaults to `%`).
* `prefix`: the optional prefix to display (defaults to `<` when `value` is below 1).
* `secondary`: a secondary label to display below the main one.

Avoid doing anything slow in this function as it gets called 60 times per second.

#### **Example:**

```jsx
<CircleGraph label={value => Math.round(value)} />
```

#### `size` <a href="#size" id="size"></a>

| TYPE     | DEFAULT VALUE |
| -------- | ------------- |
| `Number` | `80`          |

The size (width and height) of the graph.

#### `strokeWidth` <a href="#strokewidth" id="strokewidth"></a>

| TYPE     | DEFAULT VALUE |
| -------- | ------------- |
| `Number` | `4`           |

Width of the circle stroke, in `px`.

#### `value` <a href="#value" id="value"></a>

| TYPE     | DEFAULT VALUE   |
| -------- | --------------- |
| `Number` | None (required) |

The value represented by the graph, between 0 and 1.


---

# 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://legacy-docs.aragon.org/developers/tools/aragonui/visualization/circlegraph.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.
