ScatterChartData constructor

ScatterChartData({
  1. List<ScatterSpot>? scatterSpots,
  2. FlTitlesData? titlesData,
  3. ScatterTouchData? scatterTouchData,
  4. List<int>? showingTooltipIndicators,
  5. FlGridData? gridData,
  6. FlBorderData? borderData,
  7. double? minX,
  8. double? maxX,
  9. double? baselineX,
  10. double? minY,
  11. double? maxY,
  12. double? baselineY,
  13. FlClipData? clipData,
  14. Color? backgroundColor,
  15. ScatterLabelSettings? scatterLabelSettings,
})

ScatterChart draws some points in a square space, points are defined by scatterSpots,

It draws some titles on left, top, right, bottom sides per each axis number, you can modify titlesData to have your custom titles, also you can define the axis title (one text per axis) for each side using axisTitleData, you can restrict the y axis using minY and maxY value, and restrict x axis using minX and maxX.

It draws a color as a background behind everything you can set it using backgroundColor, then a grid over it, you can customize it using gridData, and it draws 4 borders around your chart, you can customize it using borderData.

You can modify scatterTouchData to customize touch behaviors and responses.

You can show some tooltipIndicators (a popup with an information) on top of each ScatterChartData.scatterSpots using showingTooltipIndicators, just put spot indices you want to show it on top of them.

clipData forces the LineChart to draw lines inside the chart bounding box.

Implementation

ScatterChartData({
  List<ScatterSpot>? scatterSpots,
  FlTitlesData? titlesData,
  ScatterTouchData? scatterTouchData,
  List<int>? showingTooltipIndicators,
  FlGridData? gridData,
  super.borderData,
  double? minX,
  double? maxX,
  super.baselineX,
  double? minY,
  double? maxY,
  super.baselineY,
  FlClipData? clipData,
  super.backgroundColor,
  ScatterLabelSettings? scatterLabelSettings,
})  : scatterSpots = scatterSpots ?? const [],
      scatterTouchData = scatterTouchData ?? ScatterTouchData(),
      showingTooltipIndicators = showingTooltipIndicators ?? const [],
      scatterLabelSettings = scatterLabelSettings ?? ScatterLabelSettings(),
      super(
        gridData: gridData ?? const FlGridData(),
        touchData: scatterTouchData ?? ScatterTouchData(),
        titlesData: titlesData ?? const FlTitlesData(),
        clipData: clipData ?? const FlClipData.none(),
        minX: minX ??
            ScatterChartHelper.calculateMaxAxisValues(
              scatterSpots ?? const [],
            ).minX,
        maxX: maxX ??
            ScatterChartHelper.calculateMaxAxisValues(
              scatterSpots ?? const [],
            ).maxX,
        minY: minY ??
            ScatterChartHelper.calculateMaxAxisValues(
              scatterSpots ?? const [],
            ).minY,
        maxY: maxY ??
            ScatterChartHelper.calculateMaxAxisValues(
              scatterSpots ?? const [],
            ).maxY,
      );