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