defaultScatterTooltipItem function

ScatterTooltipItem? defaultScatterTooltipItem(
  1. ScatterSpot touchedSpot
)

Default implementation for ScatterTouchTooltipData.getTooltipItems.

Implementation

ScatterTooltipItem? defaultScatterTooltipItem(ScatterSpot touchedSpot) {
  final textStyle = TextStyle(
    color: touchedSpot.dotPainter.mainColor,
    fontWeight: FontWeight.bold,
    fontSize: 14,
  );
  String text;
  if (touchedSpot.dotPainter is FlDotCirclePainter) {
    text = '${(touchedSpot.dotPainter as FlDotCirclePainter).radius.toInt()}';
  } else {
    text = '${touchedSpot.x.toInt()}, ${touchedSpot.y.toInt()}';
  }
  return ScatterTooltipItem(
    text,
    textStyle: textStyle,
  );
}