Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: decrease the pad angle and remove the empty legend entries #6507

Merged
merged 5 commits into from
Nov 22, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions frontend/src/container/PanelWrapper/PiePanelWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { getYAxisFormattedValue } from 'components/Graph/yAxisConfig';
import { themeColors } from 'constants/theme';
import { useIsDarkMode } from 'hooks/useDarkMode';
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
import { isNaN } from 'lodash-es';
import { useRef, useState } from 'react';
import { Query } from 'types/api/queryBuilder/queryBuilderData';

Expand Down Expand Up @@ -44,7 +45,7 @@ function PiePanelWrapper({

const isDarkMode = useIsDarkMode();

const pieChartData: {
let pieChartData: {
label: string;
value: string;
color: string;
Expand All @@ -67,6 +68,10 @@ function PiePanelWrapper({
)
.filter((d) => d !== undefined) as never[]),
);
pieChartData = pieChartData.filter(
(arc) =>
arc.value && !isNaN(parseFloat(arc.value)) && parseFloat(arc.value) > 0,
);

let size = 0;
let width = 0;
Expand Down Expand Up @@ -108,7 +113,7 @@ function PiePanelWrapper({
if (!active) return half - 3;
return data.label === active.label ? half : half - 3;
}}
padAngle={0.02}
padAngle={0.01}
cornerRadius={3}
width={size}
height={size}
Expand Down
Loading