From f7aadb877d751e624cfac9f9248168063300ae8a Mon Sep 17 00:00:00 2001 From: ulleo Date: Wed, 29 May 2024 11:45:43 +0800 Subject: [PATCH 01/33] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=83=AD=E5=8A=9B=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #8108 --- .../chart/manage/ChartDataManage.java | 2 + .../dataease/chart/utils/ChartDataBuild.java | 72 +++ core/core-frontend/src/locales/zh-CN.ts | 7 + .../src/models/chart/chart-attr.d.ts | 3 + .../components/BasicStyleSelector.vue | 473 ++++++++++-------- .../chart/components/editor/util/chart.ts | 10 + .../js/panel/charts/map/heat-map.ts | 120 +++++ 7 files changed, 479 insertions(+), 208 deletions(-) create mode 100644 core/core-frontend/src/views/chart/components/js/panel/charts/map/heat-map.ts diff --git a/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java b/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java index d37ef830d2..c75ede9ddc 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java +++ b/core/core-backend/src/main/java/io/dataease/chart/manage/ChartDataManage.java @@ -788,6 +788,8 @@ public class ChartDataManage { mapChart = ChartDataBuild.transMixChartDataAntV(xAxis, yAxis, view, data, isDrill); } else if (StringUtils.equalsIgnoreCase(view.getType(), "bar-range")) { mapChart = ChartDataBuild.transBarRangeDataAntV(skipBarRange, barRangeDate, xAxisBase, xAxis, yAxis, view, data, isDrill); + } else if(StringUtils.equalsIgnoreCase(view.getType(), "heat-map")){ + mapChart = ChartDataBuild.transHeatMapChartDataAntV(xAxisBase, xAxis, yAxis, view, data, isDrill); } else { mapChart = ChartDataBuild.transChartDataAntV(xAxis, yAxis, view, data, isDrill); } diff --git a/core/core-backend/src/main/java/io/dataease/chart/utils/ChartDataBuild.java b/core/core-backend/src/main/java/io/dataease/chart/utils/ChartDataBuild.java index f73b9b7b4f..9772403f02 100644 --- a/core/core-backend/src/main/java/io/dataease/chart/utils/ChartDataBuild.java +++ b/core/core-backend/src/main/java/io/dataease/chart/utils/ChartDataBuild.java @@ -4,6 +4,7 @@ import io.dataease.api.chart.dto.*; import io.dataease.i18n.Lang; import io.dataease.i18n.Translator; import io.dataease.utils.IDUtils; +import io.dataease.utils.JsonUtil; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.ObjectUtils; @@ -113,6 +114,77 @@ public class ChartDataBuild { return map; } + public static Map transHeatMapChartDataAntV(List xAxisBase, List xAxis, List yAxis, ChartViewDTO view, List data, boolean isDrill) { + Map map = new HashMap<>(); + List> dataList = new ArrayList<>(); + + if (xAxisBase.size() != 2) { + map.put("data", dataList); + return map; + } + + for (int i1 = 0; i1 < data.size(); i1++) { + String[] row = data.get(i1); + + StringBuilder a = new StringBuilder(); + if (isDrill) { + a.append(row[xAxis.size() - 1]); + } else { + for (int i = 0; i < xAxis.size(); i++) { + if (i == xAxis.size() - 1) { + a.append(row[i]); + } else { + a.append(row[i]).append("\n"); + } + } + } + + // yAxis最后的数据对应extLabel和extTooltip,将他们从yAxis中去掉,同时转换成动态值 + int size = xAxis.size() + yAxis.size(); + int extSize = view.getExtLabel().size() + view.getExtTooltip().size(); + + for (int i = xAxis.size(); i < size - extSize; i++) { + AxisChartDataAntVDTO axisChartDataDTO = new AxisChartDataAntVDTO(); + axisChartDataDTO.setField(a.toString()); + axisChartDataDTO.setName(a.toString()); + + List dimensionList = new ArrayList<>(); + List quotaList = new ArrayList<>(); + + for (int j = 0; j < xAxis.size(); j++) { + ChartDimensionDTO chartDimensionDTO = new ChartDimensionDTO(); + chartDimensionDTO.setId(xAxis.get(j).getId()); + chartDimensionDTO.setValue(row[j]); + dimensionList.add(chartDimensionDTO); + } + axisChartDataDTO.setDimensionList(dimensionList); + + int j = i - xAxis.size(); + ChartQuotaDTO chartQuotaDTO = new ChartQuotaDTO(); + chartQuotaDTO.setId(yAxis.get(j).getId()); + quotaList.add(chartQuotaDTO); + axisChartDataDTO.setQuotaList(quotaList); + try { + axisChartDataDTO.setValue(StringUtils.isEmpty(row[i]) ? null : new BigDecimal(row[i])); + } catch (Exception e) { + axisChartDataDTO.setValue(new BigDecimal(0)); + } + axisChartDataDTO.setCategory(StringUtils.defaultIfBlank(yAxis.get(j).getChartShowName(), yAxis.get(j).getName())); + buildDynamicValue(view, axisChartDataDTO, row, size, extSize); + + Map object = JsonUtil.parse((String) JsonUtil.toJSONString(axisChartDataDTO) , HashMap.class); + + object.put("x", new BigDecimal(row[0])); + object.put("y", new BigDecimal(row[1])); + + dataList.add(object); + } + + } + map.put("data", dataList); + return map; + } + public static Map transBaseGroupDataAntV(List xAxisBase, List xAxis, List xAxisExt, List yAxis, ChartViewDTO view, List data, boolean isDrill) { Map map = new HashMap<>(); diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index b228bc2756..6430a3f3d7 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -449,6 +449,7 @@ export default { condition_style: '标记样式', longitude: '经度', latitude: '纬度', + longitude_and_latitude: '经度纬度', gradient: '渐变', layer_controller: '指标切换', show_zoom: '显示缩放按钮', @@ -1060,6 +1061,7 @@ export default { step: '步长(px)', no_function: '函数尚未支持直接引用,请在字段表达式中手动输入。', chart_flow_map: '流向地图', + chart_heat_map: '热力地图', start_point: '起点经纬度', end_point: '终点经纬度', line: '线条', @@ -1078,10 +1080,15 @@ export default { map_style_darkblue: '极夜蓝', map_style_wine: '酱籽', map_line_type: '类型', + type: '类型', map_line_width: '线条宽度', map_line_height: '线条高度', map_line_linear: '渐变', map_line_animate: '动画', + heatmap_classics: '经典热力图', + heatmap3D: '3D热力图', + heatMapIntensity: '热力强度', + heatMapRadius: '热力点半径', map_line_animate_duration: '动画间隔', map_line_animate_interval: '轨迹间隔', map_line_animate_trail_length: '轨迹长度', diff --git a/core/core-frontend/src/models/chart/chart-attr.d.ts b/core/core-frontend/src/models/chart/chart-attr.d.ts index 1a86f4292e..b630c10c8a 100644 --- a/core/core-frontend/src/models/chart/chart-attr.d.ts +++ b/core/core-frontend/src/models/chart/chart-attr.d.ts @@ -168,6 +168,9 @@ declare interface ChartBasicStyle { * 地图主题风格 */ mapStyle: string + heatMapType?: string + heatMapIntensity?: number + heatMapRadius?: number /** * 地图边线颜色 */ diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue index 5d8d92da8a..3948613f58 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue @@ -187,6 +187,10 @@ const mapStyleOptions = [ { name: t('chart.map_style_blue'), value: 'blue' }, { name: t('chart.map_style_wine'), value: 'wine' } ] +const heatMapTypeOptions = [ + { name: t('chart.heatmap_classics'), value: 'heatmap' }, + { name: t('chart.heatmap3D'), value: 'heatmap3D' } +] const flowLineTypeOptions = [ { name: t('chart.map_line_type_line'), value: 'line' }, @@ -286,233 +290,286 @@ onMounted(() => { -
-
+ + + + + +
+ + + + + + + + + +
+ + + + + + + + +
+
+
+ + + + + + + + + +
+ + + + + + +
+ + + + + {{ t('chart.line') + t('chart.map_line_linear') }} + + + + +
+ + - - - + :trigger-width="108" + :predefine="predefineColors" + @change="changeMisc('mapLineSourceColor')" + /> - -
- - - - - - - - -
-
-
- - + - - - - - - -
- - - - - - - - -
- - - - - {{ t('chart.line') + t('chart.map_line_linear') }} - + @change="changeMisc('mapLineTargetColor')" + /> -
- - - - - - - - - - - - -
-
- - - - - - - -
-
- - - - - - - - - - - - - - - -
- - - - - {{ t('chart.line') + t('chart.map_line_animate') }} - - - - -
- - - - - - - - -
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + +
+ + + + + {{ t('chart.line') + t('chart.map_line_animate') }} + + + + +
+ + + + + + + + +
+
+
+ + + + + + + + +
+
+ + + + + + + +
diff --git a/core/core-frontend/src/views/chart/components/editor/util/chart.ts b/core/core-frontend/src/views/chart/components/editor/util/chart.ts index e21cc7ca77..64cfd829c7 100644 --- a/core/core-frontend/src/views/chart/components/editor/util/chart.ts +++ b/core/core-frontend/src/views/chart/components/editor/util/chart.ts @@ -1317,6 +1317,13 @@ export const CHART_TYPE_CONFIGS = [ value: 'flow-map', title: t('chart.chart_flow_map'), icon: 'flow-map' + }, + { + render: 'antv', + category: 'map', + value: 'heat-map', + title: t('chart.chart_heat_map'), + icon: 'heat-map' } ] }, @@ -1421,6 +1428,9 @@ export const DEFAULT_BASIC_STYLE: ChartBasicStyle = { scatterSymbolSize: 8, radarShape: 'polygon', mapStyle: 'normal', + heatMapType: 'heatmap', + heatMapIntensity: 2, + heatMapRadius: 20, areaBorderColor: '#EBEEF5', areaBaseColor: '#ffffff', mapSymbolOpacity: 0.7, diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/map/heat-map.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/map/heat-map.ts new file mode 100644 index 0000000000..8f801f092e --- /dev/null +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/map/heat-map.ts @@ -0,0 +1,120 @@ +import { useI18n } from '@/hooks/web/useI18n' +import { + L7ChartView, + L7Config, + L7DrawConfig, + L7Wrapper +} from '@/views/chart/components/js/panel/types/impl/l7' +import { MAP_EDITOR_PROPERTY_INNER } from '@/views/chart/components/js/panel/charts/map/common' +import { flow, parseJson } from '@/views/chart/components/js/util' +import { deepCopy } from '@/utils/utils' +import { GaodeMap } from '@antv/l7-maps' +import { Scene } from '@antv/l7-scene' +import { HeatmapLayer } from '@antv/l7-layers' +import { queryMapKeyApi } from '@/api/setting/sysParameter' +import { DEFAULT_BASIC_STYLE } from '@/views/chart/components/editor/util/chart' +const { t } = useI18n() + +/** + * 流向地图 + */ +export class HeatMap extends L7ChartView { + properties: EditorProperty[] = [ + 'background-overall-component', + 'basic-style-selector', + 'title-selector' + ] + propertyInner: EditorPropertyInner = { + ...MAP_EDITOR_PROPERTY_INNER, + 'basic-style-selector': ['colors', 'heatMapStyle', 'zoom'] + } + axis: AxisType[] = ['xAxis', 'yAxis', 'filter'] + axisConfig: AxisConfig = { + xAxis: { + name: `${t('chart.longitude_and_latitude')} / ${t('chart.dimension')}`, + type: 'd', + limit: 2 + }, + yAxis: { + name: `${t('chart.chart_data')} / ${t('chart.quota')}`, + type: 'q', + limit: 1 + } + } + constructor() { + super('heat-map', []) + } + + async drawChart(drawOption: L7DrawConfig) { + const { chart, container } = drawOption + const xAxis = deepCopy(chart.xAxis) + const yAxis = deepCopy(chart.yAxis) + let basicStyle + let miscStyle + if (chart.customAttr) { + basicStyle = parseJson(chart.customAttr).basicStyle + miscStyle = parseJson(chart.customAttr).misc + } + console.log(basicStyle) + const mapStyle = `amap://styles/${basicStyle.mapStyle ? basicStyle.mapStyle : 'normal'}` + const key = await this.getMapKey() + // 底层 + const scene = new Scene({ + id: container, + logoVisible: false, + map: new GaodeMap({ + token: key ?? undefined, + style: mapStyle, + pitch: miscStyle.mapPitch, + zoom: 2.5 + }) + }) + if (xAxis?.length < 2 || yAxis?.length < 1) { + return new L7Wrapper(scene, undefined) + } + console.log(chart.data?.data) + const config: L7Config = new HeatmapLayer({ + name: 'line', + blend: 'normal', + autoFit: true + }) + .source(chart.data?.data, { + parser: { + type: 'json', + x: 'x', + y: 'y' + } + }) + .size('value', [0, 1.0]) // weight映射通道 + .shape(basicStyle.heatMapType ?? DEFAULT_BASIC_STYLE.heatMapType) + + config.style({ + intensity: basicStyle.heatMapIntensity ?? DEFAULT_BASIC_STYLE.heatMapIntensity, + radius: basicStyle.heatMapRadius ?? DEFAULT_BASIC_STYLE.heatMapRadius, + rampColors: { + colors: basicStyle.colors.reverse(), + positions: [0, 0.11, 0.22, 0.33, 0.44, 0.55, 0.66, 0.77, 0.88, 1.0] + } + }) + + this.configZoomButton(chart, scene) + return new L7Wrapper(scene, config) + } + + getMapKey = async () => { + const key = 'online-map-key' + if (!localStorage.getItem(key)) { + await queryMapKeyApi().then(res => localStorage.setItem(key, res.data)) + } + return localStorage.getItem(key) + } + + setupDefaultOptions(chart: ChartObj): ChartObj { + chart.customAttr.misc.mapLineAnimate = true + return chart + } + + protected setupOptions(chart: Chart, config: L7Config): L7Config { + return flow(this.configEmptyDataStrategy)(chart, config) + } +} From 5c53abd1faf9dc9d4d774def34557f5af6a3f6d2 Mon Sep 17 00:00:00 2001 From: ulleo Date: Mon, 3 Jun 2024 15:53:15 +0800 Subject: [PATCH 02/33] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E6=9F=B1?= =?UTF-8?q?=E5=BD=A2=E5=9B=BE/=E6=9D=A1=E5=BD=A2=E5=9B=BE=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E8=AE=BE=E7=BD=AE=E5=9C=86=E8=A7=92=E6=9F=B1=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #9909 --- core/core-frontend/src/locales/zh-CN.ts | 3 +++ .../src/models/chart/chart-attr.d.ts | 8 ++++++++ .../components/BasicStyleSelector.vue | 17 +++++++++++++++++ .../views/chart/components/editor/util/chart.ts | 2 ++ .../chart/components/js/panel/charts/bar/bar.ts | 14 ++++++++++++++ .../js/panel/charts/bar/bidirectional-bar.ts | 14 ++++++++++++++ .../components/js/panel/charts/bar/common.ts | 2 +- .../js/panel/charts/bar/horizontal-bar.ts | 14 ++++++++++++++ .../js/panel/charts/bar/progress-bar.ts | 14 ++++++++++++++ .../components/js/panel/charts/bar/range-bar.ts | 14 ++++++++++++++ .../js/panel/charts/others/chart-mix-common.ts | 3 ++- .../js/panel/charts/others/chart-mix.ts | 14 ++++++++++++++ 12 files changed, 117 insertions(+), 2 deletions(-) diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 836eb53f2b..6fc6b5d082 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -1166,6 +1166,9 @@ export default { font_size: '字号', word_size_range: '字号区间', word_spacing: '文字间隔', + radiusColumnBar: '柱形', + rightAngle: '直角', + roundAngle: '圆角', table_layout_mode: '展示形式', table_layout_grid: '平铺展示', table_layout_tree: '树形展示', diff --git a/core/core-frontend/src/models/chart/chart-attr.d.ts b/core/core-frontend/src/models/chart/chart-attr.d.ts index 7879b7f438..7642d59876 100644 --- a/core/core-frontend/src/models/chart/chart-attr.d.ts +++ b/core/core-frontend/src/models/chart/chart-attr.d.ts @@ -148,6 +148,14 @@ declare interface ChartBasicStyle { * 柱宽 */ barWidth: number + /** + * 柱子形状:直角|圆角 + */ + radiusColumnBar?: 'rightAngle' | 'roundAngle' + /** + * 圆角柱倒角 + */ + columnBarRightAngleRadius: number /** * 柱间距 */ diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue index e981ac07f5..61031225da 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue @@ -273,6 +273,23 @@ onMounted(() => {
+ + + {{ t('chart.rightAngle') }} + {{ t('chart.roundAngle') }} + + + { color } } + if (basicStyle.radiusColumnBar === 'roundAngle') { + const columnStyle = { + radius: [ + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius + ] + } + options = { + ...options, + columnStyle + } + } return options } diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bidirectional-bar.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bidirectional-bar.ts index 0a9c5cc4b0..0761db98c6 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bidirectional-bar.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/bidirectional-bar.ts @@ -198,6 +198,20 @@ export class BidirectionalHorizontalBar extends G2PlotChartView< ...options, layout: basicStyle.layout } + if (basicStyle.radiusColumnBar === 'roundAngle') { + const barStyle = { + radius: [ + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius + ] + } + options = { + ...options, + barStyle + } + } return options } diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/common.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/common.ts index d48243e348..b6578c4795 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/common.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/common.ts @@ -28,7 +28,7 @@ export const BAR_RANGE_EDITOR_PROPERTY: EditorProperty[] = [ export const BAR_EDITOR_PROPERTY_INNER: EditorPropertyInner = { 'background-overall-component': ['all'], - 'basic-style-selector': ['colors', 'alpha', 'gradient'], + 'basic-style-selector': ['colors', 'alpha', 'gradient', 'radiusColumnBar'], 'label-selector': ['fontSize', 'color', 'labelFormatter'], 'tooltip-selector': ['fontSize', 'color', 'tooltipFormatter', 'show'], 'x-axis-selector': [ diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/horizontal-bar.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/horizontal-bar.ts index da39748f56..eac47b3396 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/horizontal-bar.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/horizontal-bar.ts @@ -161,6 +161,20 @@ export class HorizontalBar extends G2PlotChartView { color } } + if (basicStyle.radiusColumnBar === 'roundAngle') { + const barStyle = { + radius: [ + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius + ] + } + options = { + ...options, + barStyle + } + } return options } diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/progress-bar.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/progress-bar.ts index 3a853fbe5e..142acad842 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/progress-bar.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/progress-bar.ts @@ -163,6 +163,20 @@ export class ProgressBar extends G2PlotChartView { } } } + if (basicStyle.radiusColumnBar === 'roundAngle') { + const barStyle = { + radius: [ + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius + ] + } + options = { + ...options, + barStyle + } + } return options } protected configTooltip(chart: Chart, options: BarOptions): BarOptions { diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/range-bar.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/range-bar.ts index 30a1b4cebc..a6d81e77eb 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/bar/range-bar.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/bar/range-bar.ts @@ -292,6 +292,20 @@ export class RangeBar extends G2PlotChartView { } } } + if (basicStyle.radiusColumnBar === 'roundAngle') { + const barStyle = { + radius: [ + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius, + basicStyle.columnBarRightAngleRadius + ] + } + options = { + ...options, + barStyle + } + } return options } diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix-common.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix-common.ts index f094348493..bff49fdf3f 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix-common.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix-common.ts @@ -23,7 +23,8 @@ export const CHART_MIX_EDITOR_PROPERTY_INNER: EditorPropertyInner = { 'lineWidth', 'lineSymbol', 'lineSymbolSize', - 'lineSmooth' + 'lineSmooth', + 'radiusColumnBar' ], 'x-axis-selector': [ 'name', diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts index c69513fc4a..cd94f34471 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/others/chart-mix.ts @@ -225,7 +225,21 @@ export class ColumnLineMix extends G2PlotChartView { tempOption.geometryOptions[1].smooth = smooth tempOption.geometryOptions[1].point = point tempOption.geometryOptions[1].lineStyle = lineStyle + + if (s.radiusColumnBar === 'roundAngle') { + const columnStyle = { + radius: [ + s.columnBarRightAngleRadius, + s.columnBarRightAngleRadius, + s.columnBarRightAngleRadius, + s.columnBarRightAngleRadius + ] + } + tempOption.geometryOptions[0].columnStyle = columnStyle + tempOption.geometryOptions[1].columnStyle = columnStyle + } } + return tempOption } From 1cf2e1faa5f9f48ecd58032bf79421873c8b6952 Mon Sep 17 00:00:00 2001 From: ulleo Date: Mon, 3 Jun 2024 17:37:09 +0800 Subject: [PATCH 03/33] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E6=8A=98?= =?UTF-8?q?=E7=BA=BF=E5=9B=BE=E6=B8=90=E5=8F=98=E8=89=B2=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #9907 --- .../chart/components/js/panel/charts/line/area.ts | 11 +++++++++-- .../chart/components/js/panel/common/common_antv.ts | 13 +++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/core/core-frontend/src/views/chart/components/js/panel/charts/line/area.ts b/core/core-frontend/src/views/chart/components/js/panel/charts/line/area.ts index 5b5c376214..43f49f815f 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/charts/line/area.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/charts/line/area.ts @@ -177,8 +177,12 @@ export class Area extends G2PlotChartView { let areaStyle if (customAttr.basicStyle.gradient) { const colorMap = new Map() + const yAxis = parseJson(chart.customStyle).yAxis + const axisValue = yAxis.axisValue + const start = + !axisValue?.auto && axisValue.min && axisValue.max ? axisValue.min / axisValue.max : 0 areaStyle = item => { - let ele + let ele: string const key = `${item.field}-${item.category}` if (colorMap.has(key)) { ele = colorMap.get(key) @@ -188,9 +192,12 @@ export class Area extends G2PlotChartView { } if (ele) { return { - fill: setGradientColor(hexColorToRGBA(ele, alpha), true, 270) + fill: setGradientColor(hexColorToRGBA(ele, alpha), true, 270, start) } } + return { + fill: 'rgba(255,255,255,0)' + } } } return { diff --git a/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts b/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts index 510086322b..ebed648536 100644 --- a/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts +++ b/core/core-frontend/src/views/chart/components/js/panel/common/common_antv.ts @@ -799,11 +799,20 @@ export function getLineDash(type) { * @param rawColor 原始 RGBA 颜色 * @param show * @param angle 渐变角度 + * @param start 起始值 */ -export function setGradientColor(rawColor: string, show = false, angle = 0) { +export function setGradientColor(rawColor: string, show = false, angle = 0, start = 0) { const item = rawColor.split(',') item.splice(3, 1, '0.3)') - return show ? `l(${angle}) 0:${item.join(',')} 1:${rawColor}` : rawColor + let color: string + if (start == 0) { + color = `l(${angle}) 0:${item.join(',')} 1:${rawColor}` + } else if (start > 0) { + color = `l(${angle}) 0:rgba(255,255,255,0) ${start}:${item.join(',')} 1:${rawColor}` + } else { + color = `l(${angle}) 0:rgba(255,255,255,0) 0.1:${item.join(',')} 1:${rawColor}` + } + return show ? color : rawColor } export function transAxisPosition(position: string): string { From 747ac6c9f0d6386262ef785221f164677de89be1 Mon Sep 17 00:00:00 2001 From: ulleo Date: Tue, 4 Jun 2024 14:57:58 +0800 Subject: [PATCH 04/33] =?UTF-8?q?feat(=E5=9B=BE=E8=A1=A8):=20=E6=98=8E?= =?UTF-8?q?=E7=BB=86=E8=A1=A8=E7=9A=84=E5=88=86=E9=A1=B5=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BE=93=E5=85=A5=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E5=88=B0=E5=A4=9A=E5=B0=91=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #9672 --- core/core-frontend/src/locales/zh-CN.ts | 3 + .../src/models/chart/chart-attr.d.ts | 4 + .../components/BasicStyleSelector.vue | 96 +++++++++++-------- .../chart/components/editor/util/chart.ts | 1 + .../views/components/ChartComponentS2.vue | 32 ++++++- 5 files changed, 93 insertions(+), 43 deletions(-) diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts index 6fc6b5d082..a97f81f0f6 100644 --- a/core/core-frontend/src/locales/zh-CN.ts +++ b/core/core-frontend/src/locales/zh-CN.ts @@ -939,6 +939,9 @@ export default { table_align_center: '居中', table_align_right: '右对齐', table_scroll_bar_color: '滚动条颜色', + table_pager_style: '分页器风格', + page_pager_simple: '精简', + page_pager_general: '常规', draw_back: '收回', senior: '高级', senior_cfg: '高级设置', diff --git a/core/core-frontend/src/models/chart/chart-attr.d.ts b/core/core-frontend/src/models/chart/chart-attr.d.ts index 7642d59876..3e5d0c3c86 100644 --- a/core/core-frontend/src/models/chart/chart-attr.d.ts +++ b/core/core-frontend/src/models/chart/chart-attr.d.ts @@ -92,6 +92,10 @@ declare interface ChartBasicStyle { * 表格分页模式 */ tablePageMode: 'page' | 'pull' + /** + * 表格分页器风格 + */ + tablePageStyle: 'simple' | 'general' /** * 表格分页大小 */ diff --git a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue index 61031225da..2d640677e7 100644 --- a/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue +++ b/core/core-frontend/src/views/chart/components/editor/editor-style/components/BasicStyleSelector.vue @@ -718,49 +718,61 @@ onMounted(() => { - - - - - - - - - - + - - - - - - - + {{ t('chart.page_mode_page') }} + {{ t('chart.page_mode_pull') }} + + + + + {{ t('chart.page_pager_simple') }} + {{ t('chart.page_pager_general') }} + + + + + + + + diff --git a/core/core-frontend/src/views/chart/components/editor/util/chart.ts b/core/core-frontend/src/views/chart/components/editor/util/chart.ts index e88526cd0a..b943a032b5 100644 --- a/core/core-frontend/src/views/chart/components/editor/util/chart.ts +++ b/core/core-frontend/src/views/chart/components/editor/util/chart.ts @@ -1401,6 +1401,7 @@ export const DEFAULT_BASIC_STYLE: ChartBasicStyle = { tableColumnWidth: 100, tableFieldWidth: [], tablePageMode: 'page', + tablePageStyle: 'simple', tablePageSize: 20, gaugeStyle: 'default', colorScheme: 'default', diff --git a/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue b/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue index 24108dcdf4..5ed0625529 100644 --- a/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue +++ b/core/core-frontend/src/views/chart/components/views/components/ChartComponentS2.vue @@ -90,7 +90,9 @@ const state = reactive({ currentPage: 1 }, totalItems: 0, - showPage: false + showPage: false, + pageStyle: 'simple', + currentPageSize: 0 }) // 图表数据不用全响应式 let chartData = shallowRef>({ @@ -182,6 +184,12 @@ const setupPage = (chart: ChartObj, resetPageInfo?: boolean) => { if (resetPageInfo) { state.pageInfo.currentPage = 1 } + state.pageStyle = customAttr.basicStyle.tablePageStyle + if (state.pageStyle === 'general') { + if (state.currentPageSize == 0) { + state.currentPageSize = pageInfo.pageSize + } + } } const initScroll = () => { @@ -242,6 +250,16 @@ const handleCurrentChange = pageNum => { const chart = { ...view.value, chartExtRequest: extReq } calcData(chart, null, false) } + +const handlePageSizeChange = pageSize => { + let extReq = { pageSize: pageSize } + if (chartExtRequest.value) { + extReq = { ...extReq, ...chartExtRequest.value } + } + const chart = { ...view.value, chartExtRequest: extReq } + calcData(chart, null, false) +} + const pointClickTrans = () => { if (embeddedCallBack.value === 'yes') { trackClick('pointClick') @@ -457,6 +475,7 @@ const tabStyle = computed(() => [
共{{ state.pageInfo.total }}条
[ :total="state.pageInfo.total" @update:current-page="handleCurrentChange" /> +
From 5ecb1b003c84170fa216c6776e6d0d035d2a7a65 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 5 Jun 2024 13:53:19 +0800 Subject: [PATCH 05/33] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF):=20?= =?UTF-8?q?=E5=9B=BE=E8=A1=A8=E5=AF=BC=E5=87=BA=E8=B7=9F=E9=9A=8F=E4=BB=AA?= =?UTF-8?q?=E8=A1=A8=E6=9D=BF=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/visualization/UserViewEnlarge.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue index ba1f3095c1..27fa3f921b 100644 --- a/core/core-frontend/src/components/visualization/UserViewEnlarge.vue +++ b/core/core-frontend/src/components/visualization/UserViewEnlarge.vue @@ -8,7 +8,12 @@ trigger="click" >
- + Date: Wed, 5 Jun 2024 14:09:50 +0800 Subject: [PATCH 06/33] =?UTF-8?q?fix(xpack):=20=E8=B7=AF=E7=94=B1=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/plugin/src/index.vue | 26 +++++++------------ 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/core/core-frontend/src/components/plugin/src/index.vue b/core/core-frontend/src/components/plugin/src/index.vue index a22df5391c..fe3f091f28 100644 --- a/core/core-frontend/src/components/plugin/src/index.vue +++ b/core/core-frontend/src/components/plugin/src/index.vue @@ -94,17 +94,19 @@ onMounted(async () => { } else { distributed = wsCache.get(key) } + console.log('distributed', distributed, attrs, window['DEXPack']) + if (distributed) { - window['Vue'] = Vue - window['Axios'] = axios - window['Pinia'] = Pinia - window['vueRouter'] = vueRouter - window['MittAll'] = useEmitt().emitter.all - window['I18n'] = i18n if (window['DEXPack']) { const xpack = await window['DEXPack'].mapping[attrs.jsname] plugin.value = xpack.default } else { + window['Vue'] = Vue + window['Axios'] = axios + window['Pinia'] = Pinia + window['vueRouter'] = vueRouter + window['MittAll'] = useEmitt().emitter.all + window['I18n'] = i18n loadDistributed().then(async res => { new Function(res.data)() const xpack = await window['DEXPack'].mapping[attrs.jsname] @@ -116,16 +118,6 @@ onMounted(async () => { } }) -watch( - () => attrs.jsname, - () => { - if (window['DEXPack']) { - const xpack = window['DEXPack'].mapping[attrs.jsname] - plugin.value = xpack.default - } - } -) - const emits = defineEmits(['loadFail']) defineExpose({ invokeMethod @@ -134,7 +126,7 @@ defineExpose({