diff --git a/packages/pie/src/PieLegends.js b/packages/pie/src/PieLegends.js index 61c6df85f..ccb3c5b79 100644 --- a/packages/pie/src/PieLegends.js +++ b/packages/pie/src/PieLegends.js @@ -45,11 +45,11 @@ class PieLegends extends Component { export const enhance = Component => compose( withPropsOnChange(['arcs'], ({ arcs }) => ({ - data: arcs.map(arc => ({ - id: arc.data.id, - label: arc.data.id, - color: arc.color, - fill: arc.fill, + data: arcs.map(({ color, data: { id, label }, fill }) => ({ + id: id, + label: label || id, + color, + fill, })), })), pure diff --git a/packages/pie/src/PieSlice.js b/packages/pie/src/PieSlice.js index 15feeba2a..d35adb061 100644 --- a/packages/pie/src/PieSlice.js +++ b/packages/pie/src/PieSlice.js @@ -35,7 +35,7 @@ const PieSlice = ({ const handleTooltip = e => showTooltip( ({ - id: d.label, + data: generateProgrammingLanguageStats(true, 9).map(({ label, ...d }) => ({ + id: label, ...d, })), animate: true, } +const legends = [ + { + anchor: 'bottom', + direction: 'row', + translateY: 56, + itemWidth: 100, + itemHeight: 18, + itemTextColor: '#999', + symbolSize: 18, + symbolShape: 'circle', + effects: [ + { + on: 'hover', + style: { + itemTextColor: '#000', + }, + }, + ], + }, +] + const stories = storiesOf('Pie', module) stories.addDecorator(withKnobs) -stories.add('default', () => ) +stories.add('default', () => ( + +)) stories.add('donut', () => )