Skip to content

Commit

Permalink
SC-4 - Made adjustments to pass autotests.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaWuebbolt committed Feb 4, 2025
1 parent 82da972 commit 2e83d27
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions webapp/src/components/pie-chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,6 @@ const PieChart: React.FC<PieChartProps> = ({ data, colors = defaultColors, label
let adjustedLabelX = labelX;
let adjustedLabelY = labelY;

// Ensure labels are within the bounds of the circle
const distanceFromCenter = Math.sqrt(Math.pow(labelX - 16, 2) + Math.pow(labelY - 16, 2));
if (distanceFromCenter > 10) {
const angle = Math.atan2(labelY - 16, labelX - 16);
const labelDistance = 9 - (4 * (value / total));
adjustedLabelX = 16 + Math.cos(angle) * labelDistance;
adjustedLabelY = 16 + Math.sin(angle) * labelDistance;
}

const isHovered = index === hoveredIndex;
const translateFactor = isHovered ? 0.25 : 0; // Increased translation factor
const translateX = isHovered ? (labelX - 16) * translateFactor : 0;
Expand Down

0 comments on commit 2e83d27

Please sign in to comment.