Barchart: Fix tooltip erroneous header (#60741)

This commit is contained in:
Nathan Marrs 2022-12-23 11:42:53 -07:00 committed by GitHub
parent 7a679db08b
commit 283cdc184e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 13 deletions

View File

@ -24,5 +24,5 @@ export const DataHoverRow = ({ feature }: Props) => {
data = new ArrayDataFrame([properties]);
}
return <DataHoverView data={data} rowIndex={rowIndex} displayExemplarHeader={false} />;
return <DataHoverView data={data} rowIndex={rowIndex} />;
};

View File

@ -19,17 +19,10 @@ export interface Props {
columnIndex?: number | null; // the hover column
sortOrder?: SortOrder;
mode?: TooltipDisplayMode | null;
displayExemplarHeader?: boolean;
header?: string;
}
export const DataHoverView = ({
data,
rowIndex,
columnIndex,
sortOrder,
mode,
displayExemplarHeader = true,
}: Props) => {
export const DataHoverView = ({ data, rowIndex, columnIndex, sortOrder, mode, header = undefined }: Props) => {
const styles = useStyles2(getStyles);
if (!data || rowIndex == null) {
@ -70,9 +63,9 @@ export const DataHoverView = ({
return (
<div className={styles.wrapper}>
{displayExemplarHeader && (
{header && (
<div className={styles.header}>
<span className={styles.title}>Exemplar</span>
<span className={styles.title}>{header}</span>
</div>
)}
<table className={styles.infoWrap}>

View File

@ -28,7 +28,7 @@ type Props = {
export const HeatmapHoverView = (props: Props) => {
if (props.hover.seriesIdx === 2) {
return <DataHoverView data={props.data.exemplars} rowIndex={props.hover.dataIdx} />;
return <DataHoverView data={props.data.exemplars} rowIndex={props.hover.dataIdx} header={'Exemplar'} />;
}
return <HeatmapHoverCell {...props} />;
};