tooltipFormatter property
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),
data: <double>[18, 24, 30, 14, 28],
)),
);
}
Implementation
final SparkChartTooltipCallback<String>? tooltipFormatter;