Browse Source

yangshi

small-tupu
菅振宇 6 months ago
parent
commit
6dbf646666
  1. 96
      gyxtp/src/view/small.vue

96
gyxtp/src/view/small.vue

@ -384,57 +384,59 @@ export default {
}, },
methods: { methods: {
initChart() { initChart() {
// getKeywordsByKeyword(this.getpoinName).then(res=>{
if (this.chart) { this.words = res
this.chart.dispose()
}
// ECharts
this.chart = echarts.init(this.$refs.chart)
const option = { //
tooltip: { show: true }, if (this.chart) {
series: [ this.chart.dispose()
{ }
type: 'wordCloud',
shape: 'diamond', // 'circle' 'diamond'
sizeRange: [12, 40], // 12px60px
rotationRange: [0, 45], //
gridSize: 8, //
drawOutOfBound: false, //
layoutAnimation: true, //
left: 'center',
top: 'center',
width: '100%',
height: '100%',
data: this.words.map(item => ({
name: item.name,
value: item.value,
textStyle: { color: this.randomColor() }
})),
emphasis: {
focus: 'self',
textStyle: { textShadowBlur: 10, textShadowColor: '#333' }
},
//
minSize: 10, //
maxSize: 60, //
//
wordGap: 1, //
wordSizeRange: [10, 60], //
//
rotateStep: 45, //
// 便
backgroundColor: 'transparent'
}
],
backgroundColor: 'rgba(255, 255, 255, 0.21)'
}
getKeywordsByKeyword(this.getpoinName).then(res=>{ // ECharts
this.words = res this.chart = echarts.init(this.$refs.chart)
const option = {
tooltip: { show: true },
series: [
{
type: 'wordCloud',
shape: 'diamond', // 'circle' 'diamond'
sizeRange: [12, 40], // 12px60px
rotationRange: [0, 45], //
gridSize: 8, //
drawOutOfBound: false, //
layoutAnimation: true, //
left: 'center',
top: 'center',
width: '100%',
height: '100%',
data: this.words.map(item => ({
name: item.name,
value: item.value,
textStyle: { color: this.randomColor() }
})),
emphasis: {
focus: 'self',
textStyle: { textShadowBlur: 10, textShadowColor: '#333' }
},
//
minSize: 10, //
maxSize: 60, //
//
wordGap: 1, //
wordSizeRange: [10, 60], //
//
rotateStep: 45, //
// 便
backgroundColor: 'transparent'
}
],
backgroundColor: 'rgba(255, 255, 255, 0.21)'
}
this.chart.setOption(option)
}) })
this.chart.setOption(option)
}, },
randomColor() { randomColor() {
return `hsl(${Math.random() * 360}, 70%, 50%)` return `hsl(${Math.random() * 360}, 70%, 50%)`

Loading…
Cancel
Save