Index: packages/charted/lib/charts/behaviors/chart_tooltip.dart |
diff --git a/packages/charted/lib/charts/behaviors/chart_tooltip.dart b/packages/charted/lib/charts/behaviors/chart_tooltip.dart |
index 083d0f811767be8391d5d338810ec84bddf2f8e2..85d4b552c0110211babae2fab372b5d934ca9e7d 100644 |
--- a/packages/charted/lib/charts/behaviors/chart_tooltip.dart |
+++ b/packages/charted/lib/charts/behaviors/chart_tooltip.dart |
@@ -91,9 +91,18 @@ class ChartTooltip implements ChartBehavior { |
// tooltip for them, if none is selected/hovered, show all. |
var activeMeasures = []; |
if (showSelectedMeasure) { |
- activeMeasures.addAll(_state.selection); |
- activeMeasures |
- .add(_state.preview != null ? _state.preview : _state.hovered.first); |
+ if(_state != null) { |
+ activeMeasures.addAll(_state.selection); |
+ activeMeasures |
+ .add(_state.preview != null |
+ ? _state.preview |
+ : _state.hovered.first); |
+ } else { |
+ |
+ // If state is null, chart tooltip will not capture selection, but only |
+ // display for the currently hovered measure column. |
+ activeMeasures.add(e.column); |
+ } |
if (activeMeasures.isEmpty) { |
for (var series in _area.config.series) { |
activeMeasures.addAll(series.measures); |