* Tooltip Plugin: Prevent tooltip render if focusedSeriesIdx is out of range
* TooltipPlugin: Also prevent render in multi case
* TooltipPlugin: Return null if field is undefined
(cherry picked from commit 96a3cc3cd8)
Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
co-authored by
Ashley Harrison
parent
efbfb42f15
commit
cc843e67ae
@@ -135,6 +135,10 @@ export const TooltipPlugin: React.FC<TooltipPluginProps> = ({
|
||||
if (mode === TooltipDisplayMode.Single && focusedSeriesIdx !== null) {
|
||||
const field = otherProps.data.fields[focusedSeriesIdx];
|
||||
|
||||
if (!field) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const fieldFmt = field.display || getDisplayProcessor({ field, timeZone, theme });
|
||||
const display = fieldFmt(field.values.get(focusedPointIdx));
|
||||
|
||||
@@ -160,6 +164,7 @@ export const TooltipPlugin: React.FC<TooltipPluginProps> = ({
|
||||
const frame = otherProps.data;
|
||||
const field = frame.fields[i];
|
||||
if (
|
||||
!field ||
|
||||
field === xField ||
|
||||
field.type === FieldType.time ||
|
||||
field.type !== FieldType.number ||
|
||||
|
||||
Reference in New Issue
Block a user