mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-23 16:38:17 +00:00
chore(ui): improve data insight chart and tooltip rendering (#19143)
This commit is contained in:
parent
6fab88a3d1
commit
2b6cdea802
@ -13,7 +13,7 @@
|
||||
import { Button, Col, Row } from 'antd';
|
||||
import { Gutter } from 'antd/lib/grid/row';
|
||||
import classNames from 'classnames';
|
||||
import { includes, toLower } from 'lodash';
|
||||
import { includes, startCase, toLower } from 'lodash';
|
||||
import React, { useMemo, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { updateActiveChartFilter } from '../../utils/ChartUtils';
|
||||
@ -114,7 +114,7 @@ const TotalEntityInsightSummary = ({
|
||||
onMouseEnter={() => handleLegendMouseEnter(entity)}
|
||||
onMouseLeave={handleLegendMouseLeave}>
|
||||
<EntitySummaryProgressBar
|
||||
entity={entity}
|
||||
entity={startCase(entity)}
|
||||
isActive={
|
||||
activeKeys?.length ? activeKeys.includes(entity) : true
|
||||
}
|
||||
|
@ -44,6 +44,7 @@ export interface DataInsightChartTooltipProps extends TooltipProps<any, any> {
|
||||
dateTimeFormatter?: (date?: number) => string;
|
||||
valueFormatter?: (value: number | string, key?: string) => string | number;
|
||||
timeStampKey?: string;
|
||||
transformLabel?: boolean;
|
||||
}
|
||||
|
||||
export interface UIKpiResult extends KpiResult {
|
||||
|
@ -149,6 +149,7 @@ export const CustomTooltip = (props: DataInsightChartTooltipProps) => {
|
||||
dateTimeFormatter = formatDate,
|
||||
isPercentage,
|
||||
timeStampKey = 'timestampValue',
|
||||
transformLabel = true,
|
||||
} = props;
|
||||
|
||||
if (active && payload && payload.length) {
|
||||
@ -172,7 +173,9 @@ export const CustomTooltip = (props: DataInsightChartTooltipProps) => {
|
||||
<Surface className="mr-2" height={12} version="1.1" width={12}>
|
||||
<rect fill={entry.color} height="14" rx="2" width="14" />
|
||||
</Surface>
|
||||
{startCase(entry.name ?? (entry.dataKey as string))}
|
||||
{transformLabel
|
||||
? startCase(entry.name ?? (entry.dataKey as string))
|
||||
: entry.name ?? (entry.dataKey as string)}
|
||||
</span>
|
||||
<span className="font-medium">
|
||||
{valueFormatter
|
||||
|
Loading…
x
Reference in New Issue
Block a user