Merge pull request #11876 from dataease/pr@dev-v2@chart-t-heatmap-data-fix

fix(图表-热力图): 修复热力图查看数据时,总是会显示记录数的问题
This commit is contained in:
jianneng-fit2cloud 2024-08-30 14:44:37 +08:00 committed by GitHub
commit 11261501e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,13 +57,17 @@ public class TableHeatmapHandler extends DefaultChartHandler {
datasourceRequest.setDsList(dsMap);
var xAxis = formatResult.getAxisMap().get(ChartAxis.xAxis);
var yAxis = formatResult.getAxisMap().get(ChartAxis.yAxis);
var extColorAxis = view.getExtColor();
List<ChartViewFieldDTO> yFields = new ArrayList<>();
yFields.addAll(chartViewManege.transFieldDTO(Collections.singletonList(chartViewManege.createCountField(view.getTableId()))));
yAxis.addAll(yFields);
xAxis = xAxis.stream().filter(i-> !StringUtils.equalsIgnoreCase(i.getDataeaseName(),yAxis.get(0).getDataeaseName())).toList();
if(!extColorAxis.isEmpty() && extColorAxis.getFirst().getId()==-1){
yFields.addAll(chartViewManege.transFieldDTO(Collections.singletonList(chartViewManege.createCountField(view.getTableId()))));
yAxis.addAll(yFields);
xAxis = xAxis.stream().filter(i-> !StringUtils.equalsIgnoreCase(i.getDataeaseName(),yAxis.get(0).getDataeaseName())).toList();
}
var allFields = (List<ChartViewFieldDTO>) filterResult.getContext().get("allFields");
Dimension2SQLObj.dimension2sqlObj(sqlMeta, xAxis, FieldUtil.transFields(allFields), crossDs, dsMap, Utils.getParams(FieldUtil.transFields(allFields)), view.getCalParams(), pluginManage);
Quota2SQLObj.quota2sqlObj(sqlMeta, yAxis, FieldUtil.transFields(allFields), crossDs, dsMap, Utils.getParams(FieldUtil.transFields(allFields)), view.getCalParams(), pluginManage);
yAxis.clear();
String querySql = SQLProvider.createQuerySQL(sqlMeta, true, needOrder, view);
querySql = provider.rebuildSQL(querySql, sqlMeta, crossDs, dsMap);
datasourceRequest.setQuery(querySql);