diff --git a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/map/FlowMapHandler.java b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/map/FlowMapHandler.java index aa0963e0c4..0f63710e3b 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/charts/impl/map/FlowMapHandler.java +++ b/core/core-backend/src/main/java/io/dataease/chart/charts/impl/map/FlowMapHandler.java @@ -1,6 +1,9 @@ package io.dataease.chart.charts.impl.map; import io.dataease.chart.charts.impl.GroupChartHandler; +import io.dataease.extensions.view.dto.AxisFormatResult; +import io.dataease.extensions.view.dto.ChartAxis; +import io.dataease.extensions.view.dto.ChartViewDTO; import lombok.Getter; import org.springframework.stereotype.Component; @@ -8,4 +11,13 @@ import org.springframework.stereotype.Component; public class FlowMapHandler extends GroupChartHandler { @Getter private String type = "flow-map"; + @Override + public AxisFormatResult formatAxis(ChartViewDTO view) { + var result = super.formatAxis(view); + var xAxis = result.getAxisMap().get(ChartAxis.xAxis); + xAxis.addAll(view.getFlowMapStartName()); + xAxis.addAll(view.getFlowMapEndName()); + result.getAxisMap().put(ChartAxis.xAxis, xAxis); + return result; + } } diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/flow-map.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/flow-map.ts index 87283a679f..cbaaebf019 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/map/flow-map.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/flow-map.ts @@ -130,12 +130,26 @@ export class FlowMap extends L7ChartView { if (yAxisExt.length > 0) { lineColorField = yAxisExt[0].dataeaseName } + const asteriskField = '*' + const data = [] + chart.data?.tableRow.forEach(item => { + const newKey = 'f_record' + const newObj = Object.keys(item).reduce((acc, key) => { + if (key === asteriskField) { + acc[newKey] = item[key] + } else { + acc[key] = item[key] + } + return acc + }, {}) + data.push(newObj) + }) const config: L7Config = new LineLayer({ name: 'line', blend: 'normal', autoFit: true }) - .source(chart.data?.tableRow ? chart.data.tableRow : [], { + .source(data, { parser: { type: 'json', x: xAxis[0].dataeaseName, @@ -154,7 +168,7 @@ export class FlowMap extends L7ChartView { }) if (lineWidthField) { - config.size(lineWidthField, [1, 10]) + config.size(lineWidthField === asteriskField ? 'f_record' : lineWidthField, [1, 10]) } if (lineColorField) { config.style({