From c233e6e3b65a648a5517f069f83ca32278b070b8 Mon Sep 17 00:00:00 2001 From: Lakhan Baheti <94619783+1akhanBaheti@users.noreply.github.com> Date: Fri, 3 Nov 2023 19:18:24 +0530 Subject: [PATCH] style: custom analytics bar graph label overlapping (#2636) * style: custom analytics bar graph label overlapping fix: Bar graph avatar image rendering & tooltip * fix: import --- .../custom-analytics/graph/index.tsx | 66 +++++++++++-------- 1 file changed, 37 insertions(+), 29 deletions(-) diff --git a/web/components/analytics/custom-analytics/graph/index.tsx b/web/components/analytics/custom-analytics/graph/index.tsx index 9c9fff9ad..181eec8bd 100644 --- a/web/components/analytics/custom-analytics/graph/index.tsx +++ b/web/components/analytics/custom-analytics/graph/index.tsx @@ -3,7 +3,7 @@ import { BarDatum } from "@nivo/bar"; // components import { CustomTooltip } from "./custom-tooltip"; // ui -import { BarGraph } from "components/ui"; +import { BarGraph, Tooltip } from "components/ui"; // helpers import { findStringWithMostCharacters } from "helpers/array.helper"; import { generateBarColor, generateDisplayName } from "helpers/analytics.helper"; @@ -72,42 +72,50 @@ export const AnalyticsGraph: React.FC = ({ analytics, barGraphData, param renderTick: params.x_axis === "assignees__id" ? (datum) => { - const avatar = analytics.extras.assignee_details?.find( - (a) => a?.assignees__display_name === datum?.value - )?.assignees__avatar; + const assignee = analytics.extras.assignee_details?.find((a) => a?.assignees__id === datum?.value); - if (avatar && avatar !== "") + if (assignee?.assignees__avatar && assignee?.assignees__avatar !== "") return ( - - - + + + + + ); else return ( - - - - {params.x_axis === "assignees__id" - ? datum.value && datum.value !== "None" - ? generateDisplayName(datum.value, analytics, params, "x_axis")[0].toUpperCase() - : "?" - : datum.value && datum.value !== "None" - ? `${datum.value}`.toUpperCase()[0] - : "?"} - - + + + + + {params.x_axis === "assignees__id" + ? datum.value && datum.value !== "None" + ? generateDisplayName(datum.value, analytics, params, "x_axis")[0].toUpperCase() + : "?" + : datum.value && datum.value !== "None" + ? `${datum.value}`.toUpperCase()[0] + : "?"} + + + ); } : (datum) => ( - - + + 7 ? "-rotate-45" : ""}`} + > {generateDisplayName(datum.value, analytics, params, "x_axis")}