From f3011afbf1f5ee6183b99bc44536b93eb6f53c45 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Tue, 4 Jan 2022 16:03:45 +0100 Subject: [PATCH] fix(time series): first point in a series can show context menu on click (#43344) (#43671) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 71b7df09fce167505b9cb24aa8a9fbbf71ef48e3) Co-authored-by: Jure Stepišnik --- .../plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx b/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx index 0412c089f21..d5fbcd2e92b 100644 --- a/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx +++ b/public/app/plugins/panel/timeseries/plugins/ContextMenuPlugin.tsx @@ -136,7 +136,7 @@ export const ContextMenuPlugin: React.FC = ({ const seriesIdx = i + 1; const dataIdx = u.cursor.idx; pluginLog('ContextMenuPlugin', false, seriesIdx, dataIdx); - setPoint({ seriesIdx, dataIdx: dataIdx || null }); + setPoint({ seriesIdx, dataIdx: dataIdx ?? null }); }); }); } @@ -239,7 +239,7 @@ export const ContextMenuView: React.FC = ({ const { seriesIdx, dataIdx } = selection.point; const xFieldFmt = xField.display!; - if (seriesIdx && dataIdx) { + if (seriesIdx && dataIdx !== null) { const field = data.fields[seriesIdx]; const displayValue = field.display!(field.values.get(dataIdx));