google / charts

https://pub.dev/packages/charts_flutter
Apache License 2.0
2.8k stars 1.2k forks source link

SelectNearest behavior doesn't work with SelectionTrigger.hover #410

Open markathomas opened 4 years ago

markathomas commented 4 years ago

Trying to show the value of a graph on hover but the SelectNearest behavior doesn't work with SelectionTrigger.hover. It works with tap but business wants hover. Please advise.

Maxwell-Thom commented 4 years ago

+1

huffSamuel commented 4 years ago

I'm facing the same problem. Within my chart behaviors I'm using the following code:

charts.TimeSeriesChart(
...
  behaviors: <charts.Behaviors> [
    charts.PanAndZoomBehavior(),
    charts.SlidingViewport(
      charts.SelectionModelType.action
    ),
    charts.SelectNearest(
      eventTrigger: charts.SelectionTrigger.tap,
      selectionModelType: charts.SelectionModelType.action,
    ),
    charts.SelectNearest(
      eventTrigger: charts.SelectionTrigger.hover,
      selectionModelType: charts.SelectionModelType.info
    ),
  ]
...
);

In this case I get nothing when hovering over elements in the chart, my viewport jumps to wherever I tap, when I tap it does not draw a vertical line or highlight points on the chart, and hold+drag does not move the viewport.

However, if I remove the SelectNearest for charts.SelectionTrigger.hover tapping on the chart draws a vertical line and highlights points on the chart, does not move the viewport, and hold+drag moves the viewport with the mouse movement. This is the behavior I would expect with the exception of not getting data when hovering over the elements in the chart.

cgowthamanmca commented 3 years ago

@huffSamuel any answer

huffSamuel commented 3 years ago

I am still unable to get this to behave as expected.

soluchok commented 3 years ago

@kevmoo can you help with this issue?