CircleGraph
A circular graph component.
Usage
Demonstration
![](https://legacy-docs.aragon.org/~gitbook/image?url=https%3A%2F%2F1303901111-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FqkA65ZBta5cBbldyxyst%252Fuploads%252Fgit-blob-4649277f1716d42f1cad8959100dd699be9d0c98%252FSchermata%25202022-06-26%2520alle%252020.34.34.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=e34bca18&sv=1)
Props
color
color
TYPE | DEFAULT VALUE |
---|---|
| 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
label
TYPE | DEFAULT VALUE |
---|---|
| 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 toMath.round(value * 100)
).suffix
: the suffix to display (defaults to%
).prefix
: the optional prefix to display (defaults to<
whenvalue
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:
size
size
TYPE | DEFAULT VALUE |
---|---|
|
|
The size (width and height) of the graph.
strokeWidth
strokeWidth
TYPE | DEFAULT VALUE |
---|---|
|
|
Width of the circle stroke, in px
.
value
value
TYPE | DEFAULT VALUE |
---|---|
| None (required) |
The value represented by the graph, between 0 and 1.
Last updated