Skip to content

Commit d138122

Browse files
Merge pull request dataease#808 from dataease/pr@dev@feat_liquid
feat(视图): 尝试接入G2制作视图;增加水波图
2 parents ad9f8b1 + 97e289f commit d138122

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

frontend/src/views/chart/chart/liquid/liquid.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,7 @@ import { DEFAULT_SIZE } from '@/views/chart/chart/chart'
55
export function baseLiquid(plot, container, chart) {
66
let value = 0
77
const colors = []
8-
let max
9-
let radius
10-
let outlineBorder
11-
let outlineDistance
12-
let waveLength
13-
let waveCount
14-
let bgColor
15-
let shape
16-
let labelContent
8+
let max, radius, outlineBorder, outlineDistance, waveLength, waveCount, bgColor, shape, labelContent, title
179
if (chart.data) {
1810
if (chart.data.series.length > 0) {
1911
value = chart.data.series[0].data[0].value
@@ -62,6 +54,22 @@ export function baseLiquid(plot, container, chart) {
6254
if (customStyle.background) {
6355
bgColor = customStyle.background.color.concat(digToHex(parseInt(customStyle.background.alpha)))
6456
}
57+
if (customStyle.text) {
58+
const t = JSON.parse(JSON.stringify(customStyle.text))
59+
if (t.show) {
60+
title = {
61+
formatter: () => { return chart.title },
62+
style: ({ percent }) => ({
63+
fontSize: parseInt(t.fontSize),
64+
color: t.color,
65+
fontWeight: t.isBolder ? 'bold' : 'normal',
66+
fontStyle: t.isItalic ? 'italic' : 'normal'
67+
})
68+
}
69+
} else {
70+
title = false
71+
}
72+
}
6573
}
6674
// 开始渲染
6775
if (plot) {
@@ -87,6 +95,7 @@ export function baseLiquid(plot, container, chart) {
8795
count: waveCount
8896
},
8997
statistic: {
98+
title: title,
9099
content: labelContent
91100
}
92101
})

frontend/src/views/chart/components/component-style/TitleSelector.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
<el-form-item :label="$t('chart.text_color')" class="form-item">
2525
<el-color-picker v-model="titleForm.color" class="color-picker-style" @change="changeTitleStyle" />
2626
</el-form-item>
27-
<el-form-item :label="$t('chart.text_h_position')" class="form-item">
27+
<el-form-item v-show="chart.type && chart.type !== 'liquid'" :label="$t('chart.text_h_position')" class="form-item">
2828
<el-radio-group v-model="titleForm.hPosition" size="mini" @change="changeTitleStyle">
2929
<el-radio-button label="left">{{ $t('chart.text_pos_left') }}</el-radio-button>
3030
<el-radio-button label="center">{{ $t('chart.text_pos_center') }}</el-radio-button>
3131
<el-radio-button label="right">{{ $t('chart.text_pos_right') }}</el-radio-button>
3232
</el-radio-group>
3333
</el-form-item>
34-
<el-form-item v-show="chart.type && !chart.type.includes('table')" :label="$t('chart.text_v_position')" class="form-item">
34+
<el-form-item v-show="chart.type && !chart.type.includes('table') && chart.type !== 'liquid'" :label="$t('chart.text_v_position')" class="form-item">
3535
<el-radio-group v-model="titleForm.vPosition" size="mini" @change="changeTitleStyle">
3636
<el-radio-button label="top">{{ $t('chart.text_pos_top') }}</el-radio-button>
3737
<el-radio-button label="center">{{ $t('chart.text_pos_center') }}</el-radio-button>

frontend/src/views/chart/view/ChartEdit.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@
503503
<el-collapse-item v-show="view.type && view.type.includes('radar')" name="split" :title="$t('chart.split')">
504504
<split-selector :param="param" class="attr-selector" :chart="chart" @onChangeSplitForm="onChangeSplitForm" />
505505
</el-collapse-item>
506-
<el-collapse-item v-show="view.type && view.type !== 'liquid'" name="title" :title="$t('chart.title')">
506+
<el-collapse-item v-show="view.type" name="title" :title="$t('chart.title')">
507507
<title-selector :param="param" class="attr-selector" :chart="chart" @onTextChange="onTextChange" />
508508
</el-collapse-item>
509509
<el-collapse-item v-show="view.type && view.type !== 'map' && !view.type.includes('table') && !view.type.includes('text') && chart.type !== 'treemap' && view.type !== 'liquid'" name="legend" :title="$t('chart.legend')">

0 commit comments

Comments
 (0)