Pie HTTP API

POST /charts/pie

The Piecomponent is available in the nivo HTTP rendering API. The API generates a SVG and return a path to this SVG which can then be easily embedded.

The api accepts almost the same properties as the regular component, in json, however it's not interactive and you cannot use code in properties (functions).

Please note that the demo API server is installed on heroku using a free plan, so it might be unavailable from times to times.

Click the generate button in order to generate the chart.
You can customize settings by using dedicated controls.
generate
Response n/a
no response available
Base
object[]required

Chart data, which should be immutable.

string | (datum: RawDatum): string | numberoptionaldefault:'id'

ID accessor which should return a unique value for the whole dataset.

string | (datum: RawDatum): numberoptionaldefault:'value'

Value accessor.

string | (value: number) => string | numberoptional
open editor

Optional formatter for values.

numberrequired
px

Chart width.

numberrequired
px

Chart height.

numberoptionaldefault:'Depends on device'

Adjust pixel ratio, useful for HiDPI screens.

supportsvgcanvasapi
objectoptional
px
px
px
px

Chart margin.

numberoptionaldefault:0
°

Start angle (in degrees), useful to make gauges for example.

numberoptionaldefault:360
°

End angle (in degrees), useful to make gauges for example.

booleanoptionaldefault:true
   

If 'true', pie will be optimized to occupy more space when using partial pie.

numberoptionaldefault:0

Donut chart if greater than 0. Value should be between 0~1 as it's a ratio from original radius.

numberoptionaldefault:0
°

Padding between each pie slice.

numberoptionaldefault:0
px

Rounded slices.

booleanoptionaldefault:false
   

If 'true', arcs will be ordered according to their associated value.

Style
Themeoptional

Define style for common elements such as labels, axes…

OrdinalColorScaleConfigoptionaldefault:{"scheme":"nivo"}
Categorical: Nivo

Define chart's colors.

object[]optional

Define patterns and gradients.

supportsvgcanvasapi
object[]optional

Define rules to apply patterns and gradients

supportsvgcanvasapi
booleanoptional

Patterns.

supportsvgcanvasapi
numberoptionaldefault:0
px

Slices border width.

string | object | Functionoptionaldefault:{"from":"color","modifiers":[["darker",1]]}
inheritthemecustom
inherited property
color
modifiers
darker

Method to compute border color.

Arc labels
booleanoptionaldefault:true
   

Enable/disable arc labels.

string | Functionoptionaldefault:'formattedValue'
value

Defines how to get label text, can be a string (used to access current node data property) or a function which will receive the actual node data.

numberoptionaldefault:0.5

Define the radius to use to determine the label position, starting from inner radius, this is expressed as a ratio.

numberoptionaldefault:0
°

Skip label if corresponding arc's angle is lower than provided value.

string | object | Functionoptionaldefault:{"theme":"labels.text.fill"}
inheritthemecustom
#333333

Defines how to compute arc label text color.

Arc link labels
Customization
Array<string | Function>optionaldefault:['arcs', 'arcLinkLabels', 'arcLabels', 'legends']

Defines the order of layers and add custom layers.

Interactivity
booleanoptionaldefault:true

Enable/disable interactivity.

supportsvgcanvasapi
numberoptionaldefault:0

Extends active slice inner radius.

supportsvgcanvasapi
numberoptionaldefault:0

Extends active slice outer radius.

supportsvgcanvasapi
string | number | nulloptional

Programmatically control the activeId.

supportsvgcanvasapi
(id: string | number | null) => voidoptional

Programmatically control the activeId.

supportsvgcanvasapi
string | number | nulloptional

Default activeId.

supportsvgcanvasapi
(node, event) => voidoptional

onMouseEnter handler, it receives target node data and mouse event.

supportsvgcanvasapi
(node, event) => voidoptional

onMouseMove handler, it receives target node data and mouse event.

supportsvgcanvasapi
(node, event) => voidoptional

onMouseLeave handler, it receives target node data and mouse event.

supportsvgcanvasapi
(node, event) => voidoptional

onClick handler, it receives target node data and mouse event.

supportsvgcanvasapi
Componentoptional

Custom tooltip component

supportsvgcanvasapi
booleanoptional

Showcase custom tooltip.

supportsvgcanvasapi
Motion
booleanoptionaldefault:true

Enable/disable transitions.

supportsvgcanvasapi
string | objectoptionaldefault:'gentle'

Motion config for react-spring, either a preset or a custom configuration.

supportsvgcanvasapi
stringoptionaldefault:'innerRadius'

Define how transitions behave.

supportsvgcanvasapi
Legends
Legend[]optional

Optional chart's legends.

supportsvgcanvasapi