tooltipFormatter property

SparkChartTooltipCallback<String>? tooltipFormatter
final

Callback that gets triggered when a trackball tooltip text is created.

The TooltipFormatterDetails is passed as an argument and it provides the closest data point x value, y value, and the tooltip text.

The string returned from this call back will be displayed as tooltip text.

Defaults to null.

String handleTooltipFormatter(TooltipFormatterDetails details) {
 return details.y.toStringAsFixed(0) + 'cm';
}

@override
Widget build(BuildContext context) {
 return Scaffold(
   body: Center(
    child: SfSparkAreaChart(
      trackball:
         SparkChartTrackball(tooltipFormatter: handleTooltipFormatter)
      )
    ),
  );
}

Implementation

final SparkChartTooltipCallback<String>? tooltipFormatter;