Skip to content

Commit

Permalink
A
Browse files Browse the repository at this point in the history
  • Loading branch information
envex committed Apr 2, 2024
1 parent bc5ba5c commit d60e7b6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/polaris-viz/src/components/DonutChart/Chart.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Fragment, useState} from 'react';
import {Fragment, useMemo, useState} from 'react';
import {pie} from 'd3-shape';
import {
clamp,
Expand Down Expand Up @@ -114,10 +114,13 @@ export function Chart({
return previous;
}, 0);

const maxLegendWidth = Math.min(
longestLegendWidth,
dimensions.width * MAX_LEGEND_WIDTH_PERCENTAGE,
);
const maxLegendWidth =
legendDirection === 'vertical'
? Math.max(
longestLegendWidth,
dimensions.width * MAX_LEGEND_WIDTH_PERCENTAGE,
)
: 0;

const {height, width, legend, setLegendDimensions, isLegendMounted} =
useLegend({
Expand Down

0 comments on commit d60e7b6

Please sign in to comment.