buildSpots method

List<FlSpot> buildSpots(
  1. List<Map<String, dynamic>> data
)

Converts trend data into a list of FlSpot for chart rendering.

data - List of maps with createdOn and noOfDoctors.

Implementation

List<FlSpot> buildSpots(List<Map<String, dynamic>> data) {
  return data.asMap().entries.map((e) {
    return FlSpot(
      e.key.toDouble(),
      (e.value['noOfDoctors'] as int).toDouble(),
    );
  }).toList();
}