feat:对接舆情监测相关接口
This commit is contained in:
64
src/views/sentiment/components/area.vue
Normal file
64
src/views/sentiment/components/area.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<div class="area" id="area" />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import * as echarts from 'echarts'
|
||||
import { fitChartSize } from '@/utils/dataUtil'
|
||||
import { getAreaApi } from '@/api/sentiment.js'
|
||||
|
||||
let areaChart = null
|
||||
const initChart = async () => {
|
||||
const dom = document.getElementById('area')
|
||||
areaChart = echarts.init(dom)
|
||||
let res = await getAreaApi()
|
||||
areaChart.setOption({
|
||||
legend: {
|
||||
top: 'top',
|
||||
itemWidth: fitChartSize(30),
|
||||
itemHeight: fitChartSize(30),
|
||||
textStyle: {
|
||||
fontSize: fitChartSize(14),
|
||||
color: '#fff'
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'Nightingale Chart',
|
||||
type: 'pie',
|
||||
radius: ['30%', '60%'],
|
||||
center: ['50%', '56%'],
|
||||
roseType: 'area',
|
||||
labelLine: {
|
||||
normal: {
|
||||
show: true,
|
||||
length: 1
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
borderRadius: fitChartSize(10)
|
||||
},
|
||||
data: res.data
|
||||
}
|
||||
]
|
||||
})
|
||||
}
|
||||
const resize = () => {
|
||||
if (areaChart) {
|
||||
areaChart.dispose()
|
||||
areaChart = null
|
||||
initChart()
|
||||
}
|
||||
}
|
||||
onMounted(() => {
|
||||
initChart()
|
||||
window.addEventListener('resize', resize)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.area {
|
||||
width: vw(740);
|
||||
height: vh(400);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user