class TenderPercentagesExcelController extends ExcelChartOCDSController {

    @ApiOperation(value = "Exports *Percentage of plans with tender* dashboard in Excel format.")
    @RequestMapping(value = "/api/ocds/tendersWithLinkedProcurementPlanExcelChart",
            method = {RequestMethod.GET, RequestMethod.POST})
    public void tendersWithLinkedProcurementPlanExcelChart(@ModelAttribute @Valid
                                                           final LangYearFilterPagingRequest filter,
                                                           final HttpServletResponse response) throws IOException {
        final String chartTitle = translationService.getValue(filter.getLanguage(),
                "charts:percentWithTenders:title");



        // fetch the data that will be displayed in the chart
        final List<Document> percentTendersWithLinkedProcurementPlan = tenderPercentagesController
                .percentTendersWithLinkedProcurementPlan(filter);

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

        final List<Number> percentTenders = excelChartHelper.getValuesFromDBObject(
                percentTendersWithLinkedProcurementPlan, categories, getExportYearMonthXAxis(filter),
                TenderPercentagesController.Keys.PERCENT_TENDERS);
        values.add(percentTenders);

        final List<String> seriesTitle = Arrays.asList(
                translationService.getValue(filter.getLanguage(),
                        "charts:percentWithTenders:yAxisTitle"));

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

}