Skip to content

Commit

Permalink
refactor(polar): refactor polar padding logic (#28)
Browse files Browse the repository at this point in the history
* refactor(polar): create inner radius per area

* fix(polar): follow linter
  • Loading branch information
cmpark0126 committed Dec 22, 2021
1 parent 2b31d72 commit 15b5dd9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ChartInternal/shape/polar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ export default {
const {config, state: {current}} = $$;
const [width, height] = $$.getPolarSize();
const radius = Math.min(width, height);
const dataMax = current.dataMax;

// TODO: remove magic number
const innerRadius = config.polar_padding * 0.4;
const innerRadius = config.polar_padding * 0.75;

return d3Arc()
.innerRadius(innerRadius)
.outerRadius((d: any) => d.data.values.reduce((a, b) => a + b.value, 0) / current.dataMax * radius)(d) || "M 0 0";
.innerRadius((d: any) => innerRadius * d.data.values.reduce((a, b) => a + b.value, 0) / dataMax)
.outerRadius((d: any) => d.data.values.reduce((a, b) => a + b.value, 0) / dataMax * radius)(d) || "M 0 0";
},

updateTargetsForPolarArc(targets): void {
Expand Down

0 comments on commit 15b5dd9

Please sign in to comment.