def default_grouping(datasets, date_field=None):
    """
    Heuristic for default boxplot grouping
    """
    if datasets > 20 and date_field:
        # Group all data by year
        return "year"
    elif datasets > 10 or not date_field:
        # Compare series but don't break down by year
        return "series"
    else:
        # 10 or fewer datasets, break down by both series and year
        return "series-year"