feat:对接舆情监测相关接口

This commit is contained in:
zjc
2024-12-25 18:17:00 +08:00
parent 45c85763dd
commit 50a6b06381
23 changed files with 532 additions and 214 deletions

View 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>