SUPPORT-9206: label for each dataset's data on doughnut and pie charts

This commit is contained in:
Рауф Латыпов 2025-05-30 11:58:14 +03:00
parent ea4ce54498
commit 27379cd0df
3 changed files with 31 additions and 20 deletions

View file

@ -93,6 +93,7 @@ public class RoundSingleChartDataSetService extends AbstractChartDatasetService
List<SingleChartDataSetDto> datasets = new ArrayList<>();
List<ChartLabelModel> centerLabelModels = new ArrayList<>();
List<Object> labels = new ArrayList<>();
List<List<Object>> dataLabels = new ArrayList<>();
for (Future<RoundChartDataSetDtoWrapper> future : dataSetFutures) {
RoundChartDataSetDtoWrapper chartDataSetDto = future.get();
@ -101,6 +102,7 @@ public class RoundSingleChartDataSetService extends AbstractChartDatasetService
datasets.add(chartDataSetDto.getRoundChartDataSetDto());
}
labels.addAll(chartDataSetDto.getLabels());
dataLabels.add(chartDataSetDto.getLabels());
}
executorService.shutdown();
@ -108,7 +110,7 @@ public class RoundSingleChartDataSetService extends AbstractChartDatasetService
centerLabelModels.add(future.get());
}
return new RoundChartDataDto(datasets, labels, centerLabelModels);
return new RoundChartDataDto(datasets, labels, centerLabelModels, dataLabels);
}
catch (InterruptedException | ExecutionException e) {
executorService.shutdownNow();

View file

@ -12,22 +12,16 @@ import ervu_business_metrics.model.chart.round.label.ChartLabelModel;
public class RoundChartDataDto extends SingleChartDataDto {
public List<ChartLabelModel> centerLabels;
public List<List<Object>> dataLabels;
public RoundChartDataDto(
List<SingleChartDataSetDto> datasets,
List<Object> labels,
List<ChartLabelModel> centerLabels
List<ChartLabelModel> centerLabels,
List<List<Object>> dataLabels
) {
super(datasets, labels);
this.centerLabels = centerLabels;
}
public List<ChartLabelModel> getCenterLabels() {
return centerLabels;
}
public void setCenterLabels(
List<ChartLabelModel> centerLabels) {
this.centerLabels = centerLabels;
this.dataLabels = dataLabels;
}
}