mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 03:52:59 +08:00
Merge pull request #11769 from dataease/pr@dev-v2@chart-symbol-map-fix
fix(图表-符号地图): 修复气泡大小字段配置汇总方式无效的问题
This commit is contained in:
commit
3193c78a2c
@ -1764,25 +1764,24 @@ public class ChartDataBuild {
|
|||||||
Map<String, List<String[]>> groupDataList = detailData.stream().collect(Collectors.groupingBy(item -> "(" + StringUtils.join(ArrayUtils.subarray(item, 0, xEndIndex), ")-de-(") + ")"));
|
Map<String, List<String[]>> groupDataList = detailData.stream().collect(Collectors.groupingBy(item -> "(" + StringUtils.join(ArrayUtils.subarray(item, 0, xEndIndex), ")-de-(") + ")"));
|
||||||
|
|
||||||
tableRow.forEach(row -> {
|
tableRow.forEach(row -> {
|
||||||
|
BigDecimal rowValue = new BigDecimal(row.get(yAxis.get(0).getDataeaseName()).toString());
|
||||||
String key = xAxis.stream().map(x -> String.format(format, row.get(x.getDataeaseName()).toString())).collect(Collectors.joining("-de-"));
|
String key = xAxis.stream().map(x -> String.format(format, row.get(x.getDataeaseName()).toString())).collect(Collectors.joining("-de-"));
|
||||||
List<String[]> detailFieldValueList = groupDataList.get(key);
|
List<String[]> detailFieldValueList = groupDataList.get(key);
|
||||||
List<Map<String, Object>> detailValueMapList = Optional.ofNullable(detailFieldValueList).orElse(new ArrayList<>()).stream().map((detailArr -> {
|
List<Map<String, Object>> detailValueMapList = Optional.ofNullable(detailFieldValueList).orElse(new ArrayList<>()).stream().map((detailArr -> {
|
||||||
Map<String, Object> temp = new HashMap<>();
|
Map<String, Object> temp = new HashMap<>();
|
||||||
for (int i = 0; i < realDetailFields.size(); i++) {
|
for (int i = 0; i < realDetailFields.size(); i++) {
|
||||||
ChartViewFieldDTO realDetailField = realDetailFields.get(i);
|
ChartViewFieldDTO realDetailField = realDetailFields.get(i);
|
||||||
temp.put(realDetailField.getDataeaseName(), detailArr[detailIndex + i]);
|
if(StringUtils.equalsIgnoreCase(yAxis.get(0).getDataeaseName(),realDetailField.getDataeaseName())){
|
||||||
|
temp.put(realDetailField.getDataeaseName(), rowValue);
|
||||||
|
}else{
|
||||||
|
temp.put(realDetailField.getDataeaseName(), detailArr[detailIndex + i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return temp;
|
return temp;
|
||||||
})).collect(Collectors.toList());
|
})).collect(Collectors.toList());
|
||||||
//详情只要一个
|
//详情只要一个
|
||||||
row.put("details", !detailValueMapList.isEmpty() ?Collections.singletonList(detailValueMapList.getFirst()):detailValueMapList);
|
row.put("details", !detailValueMapList.isEmpty() ?Collections.singletonList(detailValueMapList.getFirst()):detailValueMapList);
|
||||||
});
|
});
|
||||||
|
|
||||||
ChartViewFieldDTO detailFieldDTO = new ChartViewFieldDTO();
|
|
||||||
detailFieldDTO.setId(IDUtils.snowID());
|
|
||||||
detailFieldDTO.setName("detail");
|
|
||||||
detailFieldDTO.setDataeaseName("detail");
|
|
||||||
fields.add(detailFieldDTO);
|
|
||||||
map.put("fields", fields);
|
map.put("fields", fields);
|
||||||
map.put("detailFields", realDetailFields);
|
map.put("detailFields", realDetailFields);
|
||||||
map.put("tableRow", tableRow);
|
map.put("tableRow", tableRow);
|
||||||
|
@ -4,13 +4,12 @@ import { useI18n } from '@/hooks/web/useI18n'
|
|||||||
import { COLOR_PANEL, DEFAULT_LABEL } from '@/views/chart/components/editor/util/chart'
|
import { COLOR_PANEL, DEFAULT_LABEL } from '@/views/chart/components/editor/util/chart'
|
||||||
import { ElFormItem, ElIcon, ElInput, ElSpace } from 'element-plus-secondary'
|
import { ElFormItem, ElIcon, ElInput, ElSpace } from 'element-plus-secondary'
|
||||||
import { formatterType, unitType } from '../../../js/formatter'
|
import { formatterType, unitType } from '../../../js/formatter'
|
||||||
import { defaultsDeep, cloneDeep, intersection, union, defaultTo, map } from 'lodash-es'
|
import { defaultsDeep, cloneDeep, intersection, union, defaultTo, map, isEmpty } from 'lodash-es'
|
||||||
import { includesAny } from '../../util/StringUtils'
|
import { includesAny } from '../../util/StringUtils'
|
||||||
import { fieldType } from '@/utils/attr'
|
import { fieldType } from '@/utils/attr'
|
||||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import Icon from '../../../../../../components/icon-custom/src/Icon.vue'
|
import Icon from '../../../../../../components/icon-custom/src/Icon.vue'
|
||||||
import { useEmitt } from '@/hooks/web/useEmitt'
|
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
@ -43,12 +42,6 @@ const dvMainStore = dvMainStoreWithOut()
|
|||||||
const toolTip = computed(() => {
|
const toolTip = computed(() => {
|
||||||
return props.themes === 'dark' ? 'ndark' : 'dark'
|
return props.themes === 'dark' ? 'ndark' : 'dark'
|
||||||
})
|
})
|
||||||
const changeDataset = () => {
|
|
||||||
if (showProperty('showFields')) {
|
|
||||||
state.labelForm.showFields = []
|
|
||||||
emit('onLabelChange', { data: state.labelForm }, 'showFields')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const { batchOptStatus } = storeToRefs(dvMainStore)
|
const { batchOptStatus } = storeToRefs(dvMainStore)
|
||||||
watch(
|
watch(
|
||||||
[() => props.chart.customAttr.label, () => props.chart.customAttr.label.show],
|
[() => props.chart.customAttr.label, () => props.chart.customAttr.label.show],
|
||||||
@ -363,16 +356,31 @@ const allFields = computed(() => {
|
|||||||
const defaultPlaceholder = computed(() => {
|
const defaultPlaceholder = computed(() => {
|
||||||
if (state.labelForm.showFields && state.labelForm.showFields.length > 0) {
|
if (state.labelForm.showFields && state.labelForm.showFields.length > 0) {
|
||||||
return state.labelForm.showFields
|
return state.labelForm.showFields
|
||||||
.map(field => {
|
.filter(field => !isEmpty(field))
|
||||||
|
?.map(field => {
|
||||||
return '${' + field.split('@')[1] + '}'
|
return '${' + field.split('@')[1] + '}'
|
||||||
})
|
})
|
||||||
.join(',')
|
.join(',')
|
||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
})
|
})
|
||||||
|
watch(
|
||||||
|
() => allFields.value,
|
||||||
|
() => {
|
||||||
|
let result = []
|
||||||
|
state.labelForm.showFields?.forEach(field => {
|
||||||
|
if (allFields.value?.map(i => i.value).includes(field)) {
|
||||||
|
result.push(field)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
state.labelForm.showFields = result
|
||||||
|
if (allFields.value.length > 0) {
|
||||||
|
changeLabelAttr('showFields')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
init()
|
init()
|
||||||
useEmitt({ name: 'dataset-change', callback: changeDataset })
|
|
||||||
})
|
})
|
||||||
const isGroupBar = computed(() => {
|
const isGroupBar = computed(() => {
|
||||||
return props.chart.type === 'bar-group'
|
return props.chart.type === 'bar-group'
|
||||||
|
@ -7,7 +7,7 @@ import cloneDeep from 'lodash-es/cloneDeep'
|
|||||||
import defaultsDeep from 'lodash-es/defaultsDeep'
|
import defaultsDeep from 'lodash-es/defaultsDeep'
|
||||||
import { formatterType, unitType } from '../../../js/formatter'
|
import { formatterType, unitType } from '../../../js/formatter'
|
||||||
import { fieldType } from '@/utils/attr'
|
import { fieldType } from '@/utils/attr'
|
||||||
import { defaultTo, partition, map, includes } from 'lodash-es'
|
import { defaultTo, partition, map, includes, isEmpty } from 'lodash-es'
|
||||||
import chartViewManager from '../../../js/panel'
|
import chartViewManager from '../../../js/panel'
|
||||||
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
import { dvMainStoreWithOut } from '@/store/modules/data-visualization/dvMain'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
@ -94,10 +94,6 @@ const changeDataset = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (showProperty('showFields')) {
|
|
||||||
state.tooltipForm.showFields = []
|
|
||||||
emit('onTooltipChange', { data: state.tooltipForm }, 'showFields')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const AXIS_PROP: AxisType[] = ['yAxis', 'yAxisExt', 'extBubble']
|
const AXIS_PROP: AxisType[] = ['yAxis', 'yAxisExt', 'extBubble']
|
||||||
@ -380,11 +376,17 @@ const updateAxis = (form: AxisEditForm) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
const allFields = computed(() => {
|
const allFields = computed(() => {
|
||||||
return defaultTo(props.allFields, [])
|
return defaultTo(props.allFields, []).map(item => ({
|
||||||
|
key: item.dataeaseName,
|
||||||
|
name: item.name,
|
||||||
|
value: `${item.dataeaseName}@${item.name}`,
|
||||||
|
disabled: false
|
||||||
|
}))
|
||||||
})
|
})
|
||||||
const defaultPlaceholder = computed(() => {
|
const defaultPlaceholder = computed(() => {
|
||||||
if (state.tooltipForm.showFields && state.tooltipForm.showFields.length > 0) {
|
if (state.tooltipForm.showFields && state.tooltipForm.showFields.length > 0) {
|
||||||
return state.tooltipForm.showFields
|
return state.tooltipForm.showFields
|
||||||
|
.filter(field => !isEmpty(field))
|
||||||
.map(field => {
|
.map(field => {
|
||||||
const v = field.split('@')
|
const v = field.split('@')
|
||||||
return v[1] + ': ${' + field.split('@')[1] + '}'
|
return v[1] + ': ${' + field.split('@')[1] + '}'
|
||||||
@ -393,6 +395,21 @@ const defaultPlaceholder = computed(() => {
|
|||||||
}
|
}
|
||||||
return ''
|
return ''
|
||||||
})
|
})
|
||||||
|
watch(
|
||||||
|
() => allFields.value,
|
||||||
|
() => {
|
||||||
|
let result = []
|
||||||
|
state.tooltipForm.showFields?.forEach(field => {
|
||||||
|
if (allFields.value?.map(i => i.value).includes(field)) {
|
||||||
|
result.push(field)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
state.tooltipForm.showFields = result
|
||||||
|
if (allFields.value.length > 0) {
|
||||||
|
changeTooltipAttr('showFields')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
init()
|
init()
|
||||||
useEmitt({ name: 'addAxis', callback: updateSeriesTooltipFormatter })
|
useEmitt({ name: 'addAxis', callback: updateSeriesTooltipFormatter })
|
||||||
@ -482,9 +499,9 @@ onMounted(() => {
|
|||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="option in allFields"
|
v-for="option in allFields"
|
||||||
:key="option.dataeaseName"
|
:key="option.key"
|
||||||
:label="option.name"
|
:label="option.name"
|
||||||
:value="option.dataeaseName + '@' + option.name"
|
:value="option.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -471,6 +471,9 @@ export class CarouselManager {
|
|||||||
const buildTooltip = () => {
|
const buildTooltip = () => {
|
||||||
const customAttr = this.chart.customAttr ? parseJson(this.chart.customAttr) : null
|
const customAttr = this.chart.customAttr ? parseJson(this.chart.customAttr) : null
|
||||||
if (customAttr?.tooltip?.show) {
|
if (customAttr?.tooltip?.show) {
|
||||||
|
if (!this.popup) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
const { tooltip } = deepCopy(customAttr)
|
const { tooltip } = deepCopy(customAttr)
|
||||||
let showFields = tooltip.showFields || []
|
let showFields = tooltip.showFields || []
|
||||||
if (!tooltip.showFields || tooltip.showFields.length === 0) {
|
if (!tooltip.showFields || tooltip.showFields.length === 0) {
|
||||||
|
@ -521,6 +521,10 @@ export const exportExcelDownload = (chart, callBack?) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chart.type.includes('symbolic-map')) {
|
||||||
|
request.detailFields = []
|
||||||
|
}
|
||||||
|
|
||||||
const linkStore = useLinkStoreWithOut()
|
const linkStore = useLinkStoreWithOut()
|
||||||
|
|
||||||
if (isDataEaseBi.value || appStore.getIsIframe) {
|
if (isDataEaseBi.value || appStore.getIsIframe) {
|
||||||
|
Loading…
Reference in New Issue
Block a user