forked from github/dataease
Merge pull request #3729 from dataease/pr@dev@feat_group_line
Merge branch 'dev' into pr@dv@feat_group_line
This commit is contained in:
commit
99835212cc
@ -572,7 +572,9 @@ public class ChartViewService {
|
||||
List<ChartViewFieldDTO> xAxisBase = gson.fromJson(view.getXAxis(), tokenType);
|
||||
List<ChartViewFieldDTO> xAxis = gson.fromJson(view.getXAxis(), tokenType);
|
||||
List<ChartViewFieldDTO> xAxisExt = gson.fromJson(view.getXAxisExt(), tokenType);
|
||||
if (StringUtils.equalsIgnoreCase(view.getType(), "table-pivot") || StringUtils.containsIgnoreCase(view.getType(), "group")) {
|
||||
if (StringUtils.equalsIgnoreCase(view.getType(), "table-pivot")
|
||||
|| StringUtils.containsIgnoreCase(view.getType(), "group")
|
||||
|| ("antv".equalsIgnoreCase(view.getRender()) && "line".equalsIgnoreCase(view.getType()))) {
|
||||
xAxis.addAll(xAxisExt);
|
||||
}
|
||||
List<ChartViewFieldDTO> yAxis = gson.fromJson(view.getYAxis(), tokenType);
|
||||
@ -677,7 +679,13 @@ public class ChartViewService {
|
||||
if (sqlVariables.stream().map(SqlVariableDetails::getVariableName).collect(Collectors.toList()).contains(parameter)) {
|
||||
hasParameters = true;
|
||||
}
|
||||
if (parameter.contains("|DE|") && table.getId().equals(parameter.split("\\|DE\\|")[0]) && sqlVariables.stream().map(SqlVariableDetails::getVariableName).collect(Collectors.toList()).contains(parameter.split("\\|DE\\|")[1])) {
|
||||
if (parameter.contains("|DE|")
|
||||
&& table.getId().equals(parameter.split("\\|DE\\|")[0])
|
||||
&& sqlVariables
|
||||
.stream()
|
||||
.map(SqlVariableDetails::getVariableName)
|
||||
.collect(Collectors.toList())
|
||||
.contains(parameter.split("\\|DE\\|")[1])) {
|
||||
hasParameters = true;
|
||||
}
|
||||
}
|
||||
@ -861,7 +869,7 @@ public class ChartViewService {
|
||||
if (ObjectUtils.isEmpty(ds)) {
|
||||
throw new RuntimeException(Translator.get("i18n_datasource_delete"));
|
||||
}
|
||||
if (StringUtils.isNotEmpty(ds.getStatus()) && ds.getStatus().equalsIgnoreCase("Error")) {
|
||||
if (StringUtils.isNotEmpty(ds.getStatus()) && "Error".equalsIgnoreCase(ds.getStatus())) {
|
||||
throw new Exception(Translator.get("i18n_invalid_ds"));
|
||||
}
|
||||
datasourceRequest.setDatasource(ds);
|
||||
@ -869,7 +877,7 @@ public class ChartViewService {
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.DB.name())) {
|
||||
datasourceRequest.setTable(dataTableInfoDTO.getTable());
|
||||
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
|
||||
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "text", "gauge", "liquid")) {
|
||||
datasourceRequest.setQuery(qp.getSQLSummary(dataTableInfoDTO.getTable(), yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view, ds));
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
datasourceRequest.setQuery(qp.getSQLStack(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, ds, view));
|
||||
@ -883,7 +891,7 @@ public class ChartViewService {
|
||||
} else if (StringUtils.equalsIgnoreCase(table.getType(), DatasetType.SQL.name())) {
|
||||
String sql = dataTableInfoDTO.isBase64Encryption() ? new String(java.util.Base64.getDecoder().decode(dataTableInfoDTO.getSql())) : dataTableInfoDTO.getSql();
|
||||
sql = handleVariable(sql, requestList, qp, table, ds);
|
||||
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
|
||||
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "text", "gauge", "liquid")) {
|
||||
datasourceRequest.setQuery(qp.getSQLSummaryAsTmp(sql, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view));
|
||||
@ -898,7 +906,7 @@ public class ChartViewService {
|
||||
DataTableInfoDTO dt = gson.fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
List<DataSetTableUnionDTO> list = dataSetTableUnionService.listByTableId(dt.getList().get(0).getTableId());
|
||||
String sql = dataSetTableService.getCustomSQLDatasource(dt, list, ds);
|
||||
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
|
||||
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "text", "gauge", "liquid")) {
|
||||
datasourceRequest.setQuery(qp.getSQLSummaryAsTmp(sql, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view));
|
||||
@ -914,7 +922,7 @@ public class ChartViewService {
|
||||
Map<String, Object> sqlMap = dataSetTableService.getUnionSQLDatasource(dt, ds);
|
||||
String sql = (String) sqlMap.get("sql");
|
||||
|
||||
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
|
||||
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "text", "gauge", "liquid")) {
|
||||
datasourceRequest.setQuery(qp.getSQLSummaryAsTmp(sql, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view));
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmpStack(sql, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, view));
|
||||
@ -938,7 +946,7 @@ public class ChartViewService {
|
||||
String tableName = "ds_" + table.getId().replaceAll("-", "_");
|
||||
datasourceRequest.setTable(tableName);
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) {
|
||||
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "text", "gauge", "liquid")) {
|
||||
datasourceRequest.setQuery(qp.getSQLSummary(tableName, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, view, ds));
|
||||
} else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) {
|
||||
datasourceRequest.setQuery(qp.getSQLStack(tableName, xAxis, yAxis, fieldCustomFilter, rowPermissionsTree, extFilterList, extStack, ds, view));
|
||||
@ -958,7 +966,9 @@ public class ChartViewService {
|
||||
if (!cache || CollectionUtils.isNotEmpty(requestList.getFilter())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getLinkageFilters())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getOuterParamsFilters())
|
||||
|| CollectionUtils.isNotEmpty(requestList.getDrill()) || CollectionUtils.isNotEmpty(rowPermissionsTree) || fields.size() != columnPermissionFields.size()) {
|
||||
|| CollectionUtils.isNotEmpty(requestList.getDrill())
|
||||
|| CollectionUtils.isNotEmpty(rowPermissionsTree)
|
||||
|| fields.size() != columnPermissionFields.size()) {
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
} else {
|
||||
try {
|
||||
@ -1110,7 +1120,7 @@ public class ChartViewService {
|
||||
mapChart = ChartDataBuild.transChartData(xAxis, yAxis, view, data, isDrill);
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(view.getRender(), "antv")) {
|
||||
if (StringUtils.equalsIgnoreCase(view.getType(), "bar-group")) {
|
||||
if (StringUtils.equalsAnyIgnoreCase(view.getType(), "bar-group","line")) {
|
||||
mapChart = ChartDataBuild.transBaseGroupDataAntV(xAxisBase, xAxis, xAxisExt, yAxis, view, data, isDrill);
|
||||
} else if (StringUtils.equalsIgnoreCase(view.getType(),"bar-group-stack")) {
|
||||
mapChart = ChartDataBuild.transGroupStackDataAntV(xAxisBase, xAxis, xAxisExt, yAxis, extStack, data, view, isDrill);
|
||||
|
@ -158,7 +158,11 @@ public class ChartDataBuild {
|
||||
} catch (Exception e) {
|
||||
axisChartDataDTO.setValue(new BigDecimal(0));
|
||||
}
|
||||
axisChartDataDTO.setCategory(b.toString());
|
||||
if ("line".equals(view.getType()) && CollectionUtils.isEmpty(xAxisExt)) {
|
||||
axisChartDataDTO.setCategory(yAxis.get(j).getName());
|
||||
} else {
|
||||
axisChartDataDTO.setCategory(b.toString());
|
||||
}
|
||||
dataList.add(axisChartDataDTO);
|
||||
}
|
||||
}
|
||||
|
@ -25,3 +25,15 @@ export function equalsAny(target, ...sources) {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
export function includesAny(target, ...sources) {
|
||||
if (!target || !sources) {
|
||||
return false
|
||||
}
|
||||
for (let i = 0; i < sources.length; i++) {
|
||||
if (target.includes(sources[i])) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { DEFAULT_TITLE_STYLE } from '@/views/chart/chart/chart'
|
||||
import { equalsAny, includesAny } from '@/utils/StringUtils'
|
||||
|
||||
export function hexColorToRGBA(hex, alpha) {
|
||||
const rgb = [] // 定义rgb数组
|
||||
@ -3193,7 +3194,7 @@ export function getColors(chart, colors, reset) {
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if ((chart.type.includes('bar') || chart.type.includes('line') || chart.type.includes('scatter') || chart.type.includes('radar') || chart.type.includes('area')) && !chart.type.includes('group')) {
|
||||
} else if (includesAny(chart.type, 'bar', 'scatter', 'radar', 'area') && !chart.type.includes('group')) {
|
||||
if (Object.prototype.toString.call(chart.yaxis) === '[object Array]') {
|
||||
series = JSON.parse(JSON.stringify(chart.yaxis))
|
||||
} else {
|
||||
@ -3209,7 +3210,7 @@ export function getColors(chart, colors, reset) {
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if (chart.type === 'bar-group') {
|
||||
} else if (equalsAny(chart.type, 'bar-group', 'line')) {
|
||||
// 拿到data中的category,并去重,然后构建seriesColor
|
||||
const data = chart.data.data
|
||||
const s = []
|
||||
|
@ -223,10 +223,6 @@ export default {
|
||||
if (that.linkageActiveParam) {
|
||||
that.reDrawView()
|
||||
}
|
||||
that.linkageActiveParam = {
|
||||
seriesIndex: that.pointParam.seriesIndex,
|
||||
name: that.pointParam.name
|
||||
}
|
||||
if (that.trackMenu.length < 2) { // 只有一个事件直接调用
|
||||
that.trackClick(that.trackMenu[0])
|
||||
} else { // 视图关联多个事件
|
||||
@ -436,6 +432,10 @@ export default {
|
||||
this.$emit('onChartClick', this.pointParam)
|
||||
break
|
||||
case 'linkage':
|
||||
this.linkageActiveParam = {
|
||||
seriesIndex: param.seriesIndex,
|
||||
name: param.name
|
||||
}
|
||||
this.linkageActive()
|
||||
this.$store.commit('addViewTrackFilter', linkageParam)
|
||||
break
|
||||
|
@ -549,17 +549,23 @@
|
||||
</el-row>
|
||||
<!--group field,use xaxisExt-->
|
||||
<el-row
|
||||
v-if="view.type === 'bar-group' || view.type === 'bar-group-stack'"
|
||||
v-if="view.type === 'bar-group'
|
||||
|| view.type === 'bar-group-stack'
|
||||
|| (view.render === 'antv' && view.type === 'line')"
|
||||
class="padding-lr"
|
||||
>
|
||||
<span style="width: 80px;text-align: right;">
|
||||
<span>
|
||||
{{ $t('chart.chart_group') }}
|
||||
<span style="color:#F54A45;">*</span>
|
||||
<span
|
||||
v-show="view.type !== 'line'"
|
||||
style="color:#F54A45;"
|
||||
>*</span>
|
||||
</span>
|
||||
/
|
||||
<span>{{ $t('chart.dimension') }}</span>
|
||||
<el-tooltip
|
||||
v-show="view.type !== 'line'"
|
||||
class="item"
|
||||
effect="dark"
|
||||
placement="bottom"
|
||||
|
Loading…
Reference in New Issue
Block a user