diff --git a/docs/arc-series.md b/docs/arc-series.md index 69b3a6f02..c777f1c27 100644 --- a/docs/arc-series.md +++ b/docs/arc-series.md @@ -76,6 +76,10 @@ Type: `string|number` Default: 1 The opacity of an arc in the series, from 0 (transparent) to 1 (opaque). +#### padAngle (optional) +Type: `number|function` +The padding to be applied between arcs. + ## Series API Reference diff --git a/docs/radial-chart.md b/docs/radial-chart.md index 04481491f..982e3dbe7 100644 --- a/docs/radial-chart.md +++ b/docs/radial-chart.md @@ -67,6 +67,10 @@ SVG paths (which is what the arc series is made up of) have numerous manipulable Type: `string` The className to be added to an individual arc in the series. +#### padAngle (optional) +Type: `number|function` +The padding to be applied between arcs. See above donut chart for an example of a padded angle. + ## Api ##### angleDomain, angleRange, angleType diff --git a/docs/sunburst.md b/docs/sunburst.md index ae6166f58..aee48dfc2 100644 --- a/docs/sunburst.md +++ b/docs/sunburst.md @@ -159,3 +159,7 @@ Type: `function` - Should accept arguments (arc node, domEvent) Pass in a function that will be called on mouseOut on a given arc. + +#### padAngle (optional) +Type: `number|function` +The padding to be applied between arcs. diff --git a/showcase/radial-chart/donut-chart.js b/showcase/radial-chart/donut-chart.js index bd776bebb..8018e9e4c 100644 --- a/showcase/radial-chart/donut-chart.js +++ b/showcase/radial-chart/donut-chart.js @@ -47,7 +47,8 @@ export default class SimpleRadialChart extends Component { onValueMouseOver={v => this.setState({value: v})} onSeriesMouseOut={v => this.setState({value: false})} width={300} - height={300}> + height={300} + padAngle={0.04} > {value && } ); diff --git a/showcase/sunbursts/sunburst-with-tooltips.js b/showcase/sunbursts/sunburst-with-tooltips.js index 51f03fd37..90febdf2b 100644 --- a/showcase/sunbursts/sunburst-with-tooltips.js +++ b/showcase/sunbursts/sunburst-with-tooltips.js @@ -89,7 +89,8 @@ export default class SunburstWithTooltips extends React.Component { getLabel={d => d.name} getSize={d => d.bigness} getColor={d => d.clr} - width={350}> + width={350} + padAngle={() => 0.02}> {hoveredCell ?
diff --git a/src/plot/series/arc-series.js b/src/plot/series/arc-series.js index a4e598408..5c1325249 100644 --- a/src/plot/series/arc-series.js +++ b/src/plot/series/arc-series.js @@ -43,7 +43,8 @@ const defaultProps = { center: {x: 0, y: 0}, arcClassName: '', className: '', - style: {} + style: {}, + padAngle: 0 }; /** @@ -127,6 +128,7 @@ class ArcSeries extends AbstractSeries { hideSeries, marginLeft, marginTop, + padAngle, style } = this.props; @@ -179,7 +181,7 @@ class ArcSeries extends AbstractSeries { startAngle: angle0(row) || 0, endAngle: angle(row) }; - const arcedData = arcBuilder(); + const arcedData = arcBuilder().padAngle(padAngle); const rowStyle = row.style || {}; const rowClassName = row.className || ''; return ( d.angle, getAngle0: d => d.angle0, getRadius: d => d.radius, diff --git a/src/sunburst/index.js b/src/sunburst/index.js index fb830c905..da198f738 100644 --- a/src/sunburst/index.js +++ b/src/sunburst/index.js @@ -205,7 +205,11 @@ Sunburst.propTypes = { onValueMouseOver: PropTypes.func, onValueMouseOut: PropTypes.func, getSize: PropTypes.func, - width: PropTypes.number.isRequired + width: PropTypes.number.isRequired, + padAngle: PropTypes.oneOfType([ + PropTypes.function, + PropTypes.number + ]) }; Sunburst.defaultProps = { getAngle: d => d.angle, @@ -215,7 +219,8 @@ Sunburst.defaultProps = { getColor: d => d.color, hideRootNode: false, getLabel: d => d.label, - getSize: d => d.size + getSize: d => d.size, + padAngle: 0 }; export default Sunburst; diff --git a/tests/components/radial-tests.js b/tests/components/radial-tests.js index a1512b1dd..ae39b88a7 100644 --- a/tests/components/radial-tests.js +++ b/tests/components/radial-tests.js @@ -19,7 +19,8 @@ const RADIAL_PROPS = { ], height: 300, showLabels: true, - width: 400 + width: 400, + padAngle: 0.3 }; // make sure that the components render at all testRenderWithProps(RadialChart, RADIAL_PROPS);