fix: custom analytic grouped bar tooltip value as ID (#3003)

* fix: tooltip value is coming as ID

* fix lint named module
This commit is contained in:
Lakhan Baheti 2023-12-06 19:15:07 +05:30 committed by sriram veeraghanta
parent 1f860312c6
commit 4c53157b0e

View File

@ -24,7 +24,22 @@ export const CustomTooltip: React.FC<Props> = ({ datum, analytics, params }) =>
if (params.segment) {
if (DATE_KEYS.includes(params.segment)) tooltipValue = renderMonthAndYear(datum.id);
else tooltipValue = datum.id;
else if (params.segment === "labels__id") {
const label = analytics.extras.label_details.find((l) => l.labels__id === datum.id);
tooltipValue = label && label.labels__name ? label.labels__name : "None";
} else if (params.segment === "state_id") {
const state = analytics.extras.state_details.find((s) => s.state_id === datum.id);
tooltipValue = state && state.state__name ? state.state__name : "None";
} else if (params.segment === "issue_cycle__cycle_id") {
const cycle = analytics.extras.cycle_details.find((c) => c.issue_cycle__cycle_id === datum.id);
tooltipValue = cycle && cycle.issue_cycle__cycle__name ? cycle.issue_cycle__cycle__name : "None";
} else if (params.segment === "issue_module__module_id") {
const selectedModule = analytics.extras.module_details.find((m) => m.issue_module__module_id === datum.id);
tooltipValue =
selectedModule && selectedModule.issue_module__module__name
? selectedModule.issue_module__module__name
: "None";
} else tooltipValue = datum.id;
} else {
if (DATE_KEYS.includes(params.x_axis)) tooltipValue = datum.indexValue;
else tooltipValue = datum.id === "count" ? "Issue count" : "Estimate";