class ProcurementActivityByYearController extends ExcelChartOCDSController {

    @ApiOperation(value = "Exports *Procurement activity by year* dashboard in Excel format.")
    @RequestMapping(value = "/api/ocds/procurementActivityExcelChart", method = {RequestMethod.GET, RequestMethod.POST})
    public void procurementActivityExcelChart(@ModelAttribute @Valid final LangYearFilterPagingRequest filter,
                                              final HttpServletResponse response) throws IOException {
        final String chartTitle = translationService.getValue(filter.getLanguage(), "charts:overview:title");

        // fetch the data that will be displayed in the chart (we have multiple sources for this dashboard)
        final List<Document> countAwardsByYear = countPlansTendersAwardsController.countAwardsByYear(filter);
        final List<Document> countTendersByYear = countPlansTendersAwardsController.countTendersByYear(filter);

        final List<?> categories = excelChartHelper.getCategoriesFromDBObject(
                getExportYearMonthXAxis(filter),
                countAwardsByYear, countTendersByYear);
        final List<List<? extends Number>> values = new ArrayList<>();

        final List<Number> valueAwards = excelChartHelper.getValuesFromDBObject(countAwardsByYear, categories,
                getExportYearMonthXAxis(filter), CountPlansTendersAwardsController.Keys.COUNT);
        final List<Number> valueTenders = excelChartHelper.getValuesFromDBObject(countTendersByYear, categories,
                getExportYearMonthXAxis(filter), CountPlansTendersAwardsController.Keys.COUNT);
        if (!valueAwards.isEmpty()) {
            values.add(valueAwards);
        }
        if (!valueTenders.isEmpty()) {
            values.add(valueTenders);
        }


        // check if we have anything to display before setting the *seriesTitle*.
        final List<String> seriesTitle;
        if (!values.isEmpty()) {
            seriesTitle = Arrays.asList(
                    translationService.getValue(filter.getLanguage(), "charts:overview:traces:award"),
                    translationService.getValue(filter.getLanguage(), "charts:overview:traces:tender"));
        } else {
            seriesTitle = new ArrayList<>();
        }

        response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
        response.setHeader("Content-Disposition", "attachment; filename=" + chartTitle + ".xlsx");
        response.getOutputStream().write(
                excelChartGenerator.getExcelChart(
                        ChartType.line,
                        chartTitle,
                        seriesTitle,
                        categories, values));
    }

}