/**
   * This method returns a hashmap where the key is for the year and the array is the months of the
   * year and the number of deaths per month.
   *
   * @return
   */
  public HashMap<Integer, int[]> dataForChartMuertes() {
    HashMap<Integer, int[]> map = new HashMap<>();
    ConectorBovino cb = new ConectorBovino();
    ArrayList<Bovino> bovinos = cb.getAll();

    int year;
    int month;
    Calendar cal = Calendar.getInstance();
    for (Bovino bovino : bovinos) {
      Date fm = bovino.getFecha_muerte();
      if (fm != null) {

        cal.setTime(fm);
        year = cal.get(Calendar.YEAR);
        month = cal.get(Calendar.MONTH) + 1;

        if (map.containsKey(year)) {
          int[] get = map.get(year);
          get[month] = get[month] + 1;
          map.put(year, get);
        } else {
          int[] a = new int[13];
          a[month] = 1;
          map.put(year, a);
        }
      }
    }

    return map;
  }
  /**
   * This method returns a hashmap where the key is for the year and the array is the months of the
   * year and the number of calfs born per month.
   *
   * @return
   */
  public HashMap<Integer, int[]> dataForChartNacimientos() {
    HashMap<Integer, int[]> map = new HashMap<>();
    ConectorBovino cb = new ConectorBovino();
    ArrayList<Bovino> bovinos = cb.getAll();

    int year;
    int month;
    Calendar cal = Calendar.getInstance();
    for (Bovino bovino : bovinos) {
      cal.setTime(bovino.getFecha_nacimiento());
      year = cal.get(Calendar.YEAR);
      month = cal.get(Calendar.MONTH) + 1;
      //            System.out.println("year="+year+" month="+month);

      if (map.containsKey(year)) {
        int[] get = map.get(year);
        get[month] = get[month] + 1;
        map.put(year, get);
      } else {
        int[] a = new int[13];
        a[month] = 1;
        map.put(year, a);
      }
    }

    return map;
  }