feat: 词云图字体大小区间调整

This commit is contained in:
wushaochuan 2023-08-21 10:23:43 +08:00
parent 2ffce2cebd
commit b8eff71779
4 changed files with 33 additions and 4 deletions

View File

@ -146,7 +146,8 @@ export const DEFAULT_SIZE = {
mapLineAnimate: true, mapLineAnimate: true,
mapLineAnimateDuration: 3, mapLineAnimateDuration: 3,
mapLineAnimateInterval: 1, mapLineAnimateInterval: 1,
mapLineAnimateTrailLength: 1 mapLineAnimateTrailLength: 1,
wordSizeRange: [8, 32]
} }
export const DEFAULT_SUSPENSION = { export const DEFAULT_SUSPENSION = {
show: true show: true

View File

@ -1746,7 +1746,8 @@ export const TYPE_CONFIGS = [
properties: [ properties: [
'color-selector', 'color-selector',
'tooltip-selector-ant-v', 'tooltip-selector-ant-v',
'title-selector-ant-v' 'title-selector-ant-v',
'size-selector-ant-v'
], ],
propertyInner: { propertyInner: {
'color-selector': [ 'color-selector': [
@ -1754,6 +1755,9 @@ export const TYPE_CONFIGS = [
'custom', 'custom',
'alpha' 'alpha'
], ],
'size-selector-ant-v': [
'wordSizeRange'
],
'tooltip-selector-ant-v': [ 'tooltip-selector-ant-v': [
'show', 'show',
'textStyle' 'textStyle'

View File

@ -12,6 +12,14 @@ export function baseWordCloudOptionAntV(plot, container, chart, action) {
const tooltip = getTooltip(chart) const tooltip = getTooltip(chart)
// data // data
const data = chart.data.data const data = chart.data.data
// size
let wordSizeRange = [8, 32]
if (chart.customAttr) {
const customAttr = JSON.parse(chart.customAttr)
if (customAttr?.size?.wordSizeRange) {
wordSizeRange = customAttr?.size?.wordSizeRange
}
}
// options // options
const options = { const options = {
theme: theme, theme: theme,
@ -21,7 +29,7 @@ export function baseWordCloudOptionAntV(plot, container, chart, action) {
colorField: 'field', colorField: 'field',
wordStyle: { wordStyle: {
fontFamily: 'Verdana', fontFamily: 'Verdana',
fontSize: [8, 32], fontSize: wordSizeRange,
rotation: [0, 0], rotation: [0, 0],
padding: 6 padding: 6
}, },

View File

@ -1365,6 +1365,21 @@
@change="changeBarSizeCase('mapLineAnimateTrailLength')" @change="changeBarSizeCase('mapLineAnimateTrailLength')"
/> />
</el-form-item> </el-form-item>
<!-- word-cloud start -->
<el-form-item
v-show="showProperty('wordSizeRange') "
:label="$t('chart.text_fontsize')"
class="form-item form-item-slider"
>
<el-slider
v-model="sizeForm.wordSizeRange"
:min="1"
:max="100"
range
@change="changeBarSizeCase('wordSizeRange')"
/>
</el-form-item>
<!-- word-cloud end -->
</div> </div>
</el-form> </el-form>
<!--flow-map-end--> <!--flow-map-end-->
@ -1574,8 +1589,9 @@ export default {
this.sizeForm.mapLineAnimateInterval = this.sizeForm.mapLineAnimateInterval !== undefined ? this.sizeForm.mapLineAnimateInterval : DEFAULT_SIZE.mapLineAnimateInterval this.sizeForm.mapLineAnimateInterval = this.sizeForm.mapLineAnimateInterval !== undefined ? this.sizeForm.mapLineAnimateInterval : DEFAULT_SIZE.mapLineAnimateInterval
this.sizeForm.mapLineAnimateTrailLength = this.sizeForm.mapLineAnimateTrailLength !== undefined ? this.sizeForm.mapLineAnimateTrailLength : DEFAULT_SIZE.mapLineAnimateTrailLength this.sizeForm.mapLineAnimateTrailLength = this.sizeForm.mapLineAnimateTrailLength !== undefined ? this.sizeForm.mapLineAnimateTrailLength : DEFAULT_SIZE.mapLineAnimateTrailLength
if (this.sizeForm.gaugeAxisLine === null || this.sizeForm.gaugeAxisLine === undefined) { if (this.sizeForm.gaugeAxisLine === null || this.sizeForm.gaugeAxisLine === undefined) {
this.sizeForm.gaugeAxisLine = DEFAULT_SIZE.gaugeAxisLine this.sizeForm.gaugeAxisLine = DEFAULT_SIZE.gaugeAxisLin
} }
this.sizeForm.wordSizeRange = this.sizeForm !== undefined ? this.sizeForm.wordSizeRange : DEFAULTSIZE.wordSizeRange
} }
} }
}, },