From caff9146eac49e4ef6f05df0c9f4c5e8994f8f89 Mon Sep 17 00:00:00 2001 From: Dominik Prokop Date: Thu, 21 Nov 2019 17:07:11 +0100 Subject: [PATCH] Tooltip: Fix issue with tooltip throwing an error when retrieving values (#20565) --- packages/grafana-ui/src/components/Graph/Graph.tsx | 7 +++++-- .../grafana-ui/src/components/Graph/GraphWithLegend.tsx | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/grafana-ui/src/components/Graph/Graph.tsx b/packages/grafana-ui/src/components/Graph/Graph.tsx index 1416c21114f..af457a30bbf 100644 --- a/packages/grafana-ui/src/components/Graph/Graph.tsx +++ b/packages/grafana-ui/src/components/Graph/Graph.tsx @@ -139,7 +139,6 @@ export class Graph extends PureComponent { // Check if tooltip needs to be rendered with custom tooltip component, otherwise default to GraphTooltip const tooltipContentRenderer = tooltipElementProps.tooltipComponent || GraphTooltip; - // Indicates column(field) index in y-axis dimension const seriesIndex = activeItem ? activeItem.series.seriesIndex : 0; // Indicates row index in active field values @@ -272,7 +271,11 @@ export class Graph extends PureComponent { }; try { - $.plot(this.element, series, flotOptions); + $.plot( + this.element, + series.filter(s => s.isVisible), + flotOptions + ); } catch (err) { console.log('Graph rendering error', err, flotOptions, series); throw new Error('Error rendering panel'); diff --git a/packages/grafana-ui/src/components/Graph/GraphWithLegend.tsx b/packages/grafana-ui/src/components/Graph/GraphWithLegend.tsx index 0f20d6068be..c4a6aad7d48 100644 --- a/packages/grafana-ui/src/components/Graph/GraphWithLegend.tsx +++ b/packages/grafana-ui/src/components/Graph/GraphWithLegend.tsx @@ -94,7 +94,7 @@ export const GraphWithLegend: React.FunctionComponent = (p
!!s.isVisible)} + series={series} timeRange={timeRange} timeZone={timeZone} showLines={showLines}