We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Tooltip not rendering when line chart has only one data point per series

I have a Line chart that displays fine and shows tooltip when there is more than 1 data point in the series. However, I experience the following error when I pass in only one data point to a line chart: 

The error brings me to the following line in the code:

tooltipArgs = TooltipArgs(
_chart is SfCartesianChart
? currentSeries._segments[0]._seriesIndex
: currentSeries,


Error below:

════════ Exception caught by rendering library ═════════════════════════════════
The following RangeError was thrown during paint():
RangeError (index): Invalid value: Valid value range is empty: 0

The relevant error-causing widget was
SfCartesianChart-[<'11_chart'>]
lib/…/line_chart_widget/line_chart_widget_view.dart:79
When the exception was thrown, this was the stack
#0      List.[] (dart:core-patch/growable_array.dart:177:60)
#1      _TooltipPainter._renderTooltip
package:syncfusion_flutter_charts/…/user_interaction/tooltip_painter.dart:700
#2      TooltipBehaviorRenderer.onPaint
package:syncfusion_flutter_charts/…/user_interaction/tooltip.dart:883
#3      _TooltipPainter.paint
package:syncfusion_flutter_charts/…/user_interaction/tooltip_painter.dart:673
#4      RenderCustomPaint._paintWithPainter
package:flutter/…/rendering/custom_paint.dart:531
...
The following RenderObject was being processed when the exception was fired: RenderCustomPaint#b5208 relayoutBoundary=up4
RenderObject: RenderCustomPaint#b5208 relayoutBoundary=up4
    parentData: <none> (can use size)
    constraints: BoxConstraints(0.0<=w<=378.0, 0.0<=h<=300.0)
    size: Size(0.0, 0.0)


I would appreciate any pointers,

Thank you


2 Replies 1 reply marked as answer

SK Sriram Kiran Senthilkumar Syncfusion Team February 1, 2021 07:57 AM UTC

Hi Rebecca, 
  
Greetings from Syncfusion. The reported issue has been resolved already and will be available in upcoming weekly patch release which is expected to be rolled out on February 2, 2021. We will keep you posted once the weekly patch release has been rolled out and we appreciate your patience until then. 
  
Thanks, 
Sriram Kiran 



DP Dharanitharan Palanisamy Syncfusion Team February 2, 2021 09:32 AM UTC

Hi Rebecca,

We are happy to inform you that the reported issue has been fixed in our latest version v18.4.41. Now the tooltip for a single data point will render and does not throw any exception. Please upgrade our chart package to the latest version from the following link.

Latest version: https://pub.dev/packages/syncfusion_flutter_charts/versions/18.4.41

Thanks,
Dharanitharan. P


Marked as answer
Loader.
Up arrow icon