fl_chart icon indicating copy to clipboard operation
fl_chart copied to clipboard

Popup/tooltip doesn't show up when x values are close

Open masc-it opened this issue 4 years ago • 3 comments

Hello @imaNNeoFighT, first of all, great job with this lib!

I've successfully implemented the line chart, but I am experiencing the issue shown in the pic below.

Screenshot_16041647041

On the x-axis I got dates, which can be really close to each other (in this scenario the last 2 points have a delta of 15 mins) and whose corresponding y-values might be really different.

When I tap/slide on the chart, the tooltip/popup associated with the last, lower point, doesn't show up, but it does with the one right above it.

If it can be of any help:


..
bottomTitles: SideTitles(
          showTitles: true,
         
          getTextStyles: (value) => const TextStyle(
              color: Color(0xff68737d),
              fontSize: 14),
          getTitles: (value) {
            final DateTime date =
                DateTime.fromMillisecondsSinceEpoch(value.toInt());
            final parts = date.toIso8601String().split("T");
            return parts.first + "\n" + parts[1].split(".")[0];
          },
          margin: 12,
          interval:
              (widget.spots[widget.spots.length - 1].x - widget.spots[0].x), 
        ),
..

Any idea about I can possibly fix this? :/

masc-it avatar Oct 31 '20 17:10 masc-it

Hi, did you check fitInsideHorizontally in LineTouchTooltipData?

imaNNeo avatar Nov 01 '20 05:11 imaNNeo

Hi, did you check fitInsideHorizontally in LineTouchTooltipData?

it's not about a graphical problem.

The touch event on that spot (the lower one), just doesn't make the tooltip to show up. It always triggers the above tooltip. (same situation if I switch the y-values)

masc-it avatar Nov 01 '20 09:11 masc-it

Can you provide ma a reproducible code (a main.dart file)?

imaNNeo avatar Feb 23 '22 19:02 imaNNeo