mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix StateTimeline duration bug + add hidden tooltip option (#54697)
This commit is contained in:
parent
8d489dfd9b
commit
aee13563ce
@ -104,7 +104,7 @@ export const addTooltipSupport = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
config.addHook('setLegend', (u) => {
|
config.addHook('setLegend', (u) => {
|
||||||
if (!isToolTipOpen.current) {
|
if (!isToolTipOpen.current && !tooltipInterpolator) {
|
||||||
setFocusedPointIdx(u.legend.idx!);
|
setFocusedPointIdx(u.legend.idx!);
|
||||||
}
|
}
|
||||||
if (u.cursor.idxs != null) {
|
if (u.cursor.idxs != null) {
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
||||||
|
|
||||||
import { CartesianCoords2D, DataFrame, FieldType, PanelProps } from '@grafana/data';
|
import { CartesianCoords2D, DataFrame, FieldType, PanelProps } from '@grafana/data';
|
||||||
import { Portal, UPlotConfigBuilder, usePanelContext, useTheme2, VizTooltipContainer, ZoomPlugin } from '@grafana/ui';
|
import {
|
||||||
|
Portal,
|
||||||
|
TooltipDisplayMode,
|
||||||
|
UPlotConfigBuilder,
|
||||||
|
usePanelContext,
|
||||||
|
useTheme2,
|
||||||
|
VizTooltipContainer,
|
||||||
|
ZoomPlugin,
|
||||||
|
} from '@grafana/ui';
|
||||||
import { HoverEvent, addTooltipSupport } from '@grafana/ui/src/components/uPlot/config/addTooltipSupport';
|
import { HoverEvent, addTooltipSupport } from '@grafana/ui/src/components/uPlot/config/addTooltipSupport';
|
||||||
import { CloseButton } from 'app/core/components/CloseButton/CloseButton';
|
import { CloseButton } from 'app/core/components/CloseButton/CloseButton';
|
||||||
import { getLastStreamingDataFramePacket } from 'app/features/live/data/StreamingDataFrame';
|
import { getLastStreamingDataFramePacket } from 'app/features/live/data/StreamingDataFrame';
|
||||||
@ -172,6 +180,11 @@ export const StateTimelinePanel: React.FC<TimelinePanelProps> = ({
|
|||||||
isToolTipOpen,
|
isToolTipOpen,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.tooltip.mode === TooltipDisplayMode.None) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ZoomPlugin config={config} onZoom={onChangeTimeRange} />
|
<ZoomPlugin config={config} onZoom={onChangeTimeRange} />
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
import React, { useCallback, useMemo, useRef, useState } from 'react';
|
||||||
|
|
||||||
import { CartesianCoords2D, DataFrame, FieldType, PanelProps } from '@grafana/data';
|
import { CartesianCoords2D, DataFrame, FieldType, PanelProps } from '@grafana/data';
|
||||||
import { Portal, UPlotConfigBuilder, useTheme2, VizTooltipContainer, ZoomPlugin } from '@grafana/ui';
|
import {
|
||||||
|
Portal,
|
||||||
|
TooltipDisplayMode,
|
||||||
|
UPlotConfigBuilder,
|
||||||
|
useTheme2,
|
||||||
|
VizTooltipContainer,
|
||||||
|
ZoomPlugin,
|
||||||
|
} from '@grafana/ui';
|
||||||
import { HoverEvent, addTooltipSupport } from '@grafana/ui/src/components/uPlot/config/addTooltipSupport';
|
import { HoverEvent, addTooltipSupport } from '@grafana/ui/src/components/uPlot/config/addTooltipSupport';
|
||||||
import { CloseButton } from 'app/core/components/CloseButton/CloseButton';
|
import { CloseButton } from 'app/core/components/CloseButton/CloseButton';
|
||||||
|
|
||||||
@ -174,6 +181,11 @@ export const StatusHistoryPanel: React.FC<TimelinePanelProps> = ({
|
|||||||
isToolTipOpen,
|
isToolTipOpen,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.tooltip.mode === TooltipDisplayMode.None) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ZoomPlugin config={config} onZoom={onChangeTimeRange} />
|
<ZoomPlugin config={config} onZoom={onChangeTimeRange} />
|
||||||
|
Loading…
Reference in New Issue
Block a user