+ Generates a pie chart from an array of data, each datum must have an id and a
+ value property.
+ Note that margin object does not take radial labels into account, so you
+ should adjust it to leave enough room for it.
+
+ The responsive alternative of this component is
+ ResponsivePie
.
+
+ This component is available in the{' '} + + nivo-api + , see{' '} + + sample + {' '} + or try it using the API client. You can also see more + example usages in{' '} + + the storybook + . +
++ See the dedicated guide on how to setup + legends for this component. +
+defs
and fill
properties to use patterns, see{' '}
+ dedicated guide for further information.
+
+ ),
+ type: '{boolean}',
+ controlType: 'switch',
+ controlGroup: 'Style',
+ },
{
key: 'borderWidth',
description: 'Slices border width.',
diff --git a/website/src/components/charts/pie/propsMapper.js b/website/src/components/charts/pie/propsMapper.js
index 41eb2287d..e37c6585f 100644
--- a/website/src/components/charts/pie/propsMapper.js
+++ b/website/src/components/charts/pie/propsMapper.js
@@ -8,6 +8,7 @@
*/
import React from 'react'
import styled from 'styled-components'
+import { patternDotsDef, patternLinesDef } from '@nivo/core'
import { settingsMapper, mapInheritedColor } from '../../../lib/settings'
const TooltipWrapper = styled.div`
@@ -71,8 +72,42 @@ export default settingsMapper(
},
}
},
+ defs: (value, values) => {
+ if (!values['showcase pattern usage']) return
+
+ return [
+ patternDotsDef('dots', {
+ background: 'inherit',
+ color: 'rgba(255, 255, 255, 0.3)',
+ size: 4,
+ padding: 1,
+ stagger: true,
+ }),
+ patternLinesDef('lines', {
+ background: 'inherit',
+ color: 'rgba(255, 255, 255, 0.3)',
+ rotation: -45,
+ lineWidth: 6,
+ spacing: 10,
+ }),
+ ]
+ },
+ fill: (value, values) => {
+ if (!values['showcase pattern usage']) return
+
+ return [
+ { match: { id: 'ruby' }, id: 'dots' },
+ { match: { id: 'c' }, id: 'dots' },
+ { match: { id: 'go' }, id: 'dots' },
+ { match: { id: 'python' }, id: 'dots' },
+ { match: { id: 'scala' }, id: 'lines' },
+ { match: { id: 'lisp' }, id: 'lines' },
+ { match: { id: 'elixir' }, id: 'lines' },
+ { match: { id: 'javascript' }, id: 'lines' },
+ ]
+ },
},
{
- exclude: ['custom tooltip example'],
+ exclude: ['custom tooltip example', 'showcase pattern usage'],
}
)
diff --git a/website/src/components/pages/Home.js b/website/src/components/pages/Home.js
index 7fc854afd..e2d3db846 100644
--- a/website/src/components/pages/Home.js
+++ b/website/src/components/pages/Home.js
@@ -352,6 +352,7 @@ class Home extends Component {
nodePadding={12}
nodeBorderWidth={0}
linkOpacity={0.2}
+ linkBlendMode="normal"
linkContract={1}
labelTextColor="inherit"
/>
diff --git a/website/src/lib/generateChartCode.js b/website/src/lib/generateChartCode.js
index b1b114040..be73af81e 100644
--- a/website/src/lib/generateChartCode.js
+++ b/website/src/lib/generateChartCode.js
@@ -61,6 +61,7 @@ const generate = (
``,
`// make sure parent container have a defined height when using responsive component,`,
`// otherwise height will be 0 and no chart will be rendered.`,
+ `// website examples showcase many properties, you'll often use just a few of them.`,
].join('\n')
}