Skip to content

Commit

Permalink
fix(pie): fix pie stories
Browse files Browse the repository at this point in the history
  • Loading branch information
plouc committed Dec 18, 2020
1 parent 0fb7756 commit 4c8cde1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/pie/src/PieCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const InnerPieCanvas = <RawDatum,>({

ctx.save()
ctx.translate(margin.left, margin.top)
;(arcGenerator as any).context(ctx)
arcGenerator.context(ctx)

ctx.save()
ctx.translate(centerX, centerY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const commonProperties = {
...d,
})),
animate: true,
activeOuterRadiusOffset: 20,
}

const legends = [
Expand Down Expand Up @@ -139,10 +140,11 @@ stories.add('adding a metric in the center using a custom layer', () => (
/>
))

stories.add('formatted tooltip values', () => (
stories.add('formatted values', () => (
<Pie
{...commonProperties}
tooltipFormat={value =>
sliceLabelsRadiusOffset={0.7}
valueFormat={value =>
`${Number(value).toLocaleString('ru-RU', {
minimumFractionDigits: 2,
})} ₽`
Expand Down
2 changes: 2 additions & 0 deletions website/src/data/components/pie/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ const props = [
},
{
key: 'activeInnerRadiusOffset',
flavors: ['svg', 'canvas'],
help: `Skip label if corresponding slice's angle is lower than provided value.`,
type: 'number',
required: false,
Expand All @@ -533,6 +534,7 @@ const props = [
},
{
key: 'activeOuterRadiusOffset',
flavors: ['svg', 'canvas'],
help: `Skip label if corresponding slice's angle is lower than provided value.`,
type: 'number',
required: false,
Expand Down
5 changes: 4 additions & 1 deletion website/src/pages/pie/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ const initialProperties = {
sliceLabel: 'formattedValue',
sliceLabelsRadiusOffset: 0.5,
sliceLabelsSkipAngle: 10,
sliceLabelsTextColor: '#333333',
sliceLabelsTextColor: {
from: 'color',
modifiers: [['darker', 2]],
},

isInteractive: true,
'custom tooltip example': false,
Expand Down

0 comments on commit 4c8cde1

Please sign in to comment.