lcny-vue3-antd-admin/src/views/visualization/components/TRJCSJ.vue

118 lines
2.8 KiB
Vue

<template>
<Box title="土壤监测数据">
<div class="h-full flex flex-col">
<div class="flex-1" ref="chartRef"> </div>
</div>
</Box>
</template>
<script lang="ts">
import { defineComponent, reactive, ref, Ref, onMounted } from 'vue'
import Box from './Box.vue'
import { useECharts } from '/@/hooks/web/useECharts'
export default defineComponent({
components: {
Box,
},
setup() {
const chartRef = ref<HTMLDivElement | null>(null)
const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>)
const chartsInit = () => {
setOptions({
grid: { left: '2%', right: '2%', top: '20%', bottom: '2%', containLabel: true },
legend: {
data: ['销售水量', '主营业务'],
top: '0%',
right: '0',
textStyle: {
color: '#ffffff',
},
},
tooltip: {
trigger: 'axis',
axisPointer: {
lineStyle: {
width: 1,
color: '#019680',
},
},
},
xAxis: {
type: 'category',
data: [...new Array(10)].map((_item, index) => `${index + 6}:00`),
axisTick: {
show: false,
},
axisLine: {
show: false,
},
axisLabel: {
color: '#fff',
},
},
yAxis: [
{
type: 'value',
axisTick: {
show: false,
},
splitLine: {
lineStyle: {
type: 'solid',
color: '#8EEEFF',
opacity: 0.3,
},
},
axisLabel: {
color: '#fff',
},
},
],
series: [
{
name: '销售水量',
data: [11, 22, 40, 18, 3, 55, 66, 33, 14, 30],
type: 'line',
symbol: 'none',
itemStyle: {
color: '#00F4B9',
},
areaStyle: {
color: 'rgba(0, 244, 185, 0.4)',
},
},
{
name: '主营业务',
data: [11, 22, 40, 18, 3, 55, 66, 33, 14, 30].reverse(),
type: 'line',
symbol: 'none',
itemStyle: {
color: '#28F2E6',
},
areaStyle: {
color: 'rgba(40, 242, 230, 0.4)',
},
},
],
})
}
onMounted(() => {
chartsInit()
})
return {
chartRef,
}
},
})
</script>
<style scoped lang="less">
.active {
@apply font-bold text-15px text-[#76E9F0];
}
</style>