2024-04-15 09:15:31 +08:00
|
|
|
|
<template>
|
2024-04-15 14:11:14 +08:00
|
|
|
|
<div ref="chart" style="width: 100%; height: 200px"></div>
|
2024-04-15 09:15:31 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup >
|
|
|
|
|
import { onMounted, reactive, ref } from "vue";
|
|
|
|
|
// 局部引入echarts核心模块
|
|
|
|
|
import * as echarts from "echarts";
|
|
|
|
|
|
|
|
|
|
const chart = ref(); // 创建DOM引用
|
|
|
|
|
|
|
|
|
|
let option = {
|
|
|
|
|
tooltip: {
|
2024-04-15 13:33:05 +08:00
|
|
|
|
trigger: "axis",
|
2024-04-15 09:15:31 +08:00
|
|
|
|
},
|
|
|
|
|
legend: {
|
2024-04-15 13:33:05 +08:00
|
|
|
|
// data: ["80-90补贴人次", "90-98补贴人次", "99以上补贴人次"],
|
|
|
|
|
top: "8%",
|
|
|
|
|
right: "15%",
|
|
|
|
|
textStyle: {
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: "#ccc",
|
|
|
|
|
},
|
2024-04-15 09:15:31 +08:00
|
|
|
|
},
|
|
|
|
|
grid: {
|
2024-04-15 13:33:05 +08:00
|
|
|
|
left: "1%",
|
|
|
|
|
right: "4%",
|
|
|
|
|
bottom: "3%",
|
|
|
|
|
containLabel: true,
|
2024-04-15 09:15:31 +08:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
xAxis: {
|
2024-04-15 13:33:05 +08:00
|
|
|
|
type: "category",
|
2024-04-15 09:15:31 +08:00
|
|
|
|
// boundaryGap: false,
|
2024-04-15 13:33:05 +08:00
|
|
|
|
data: ["1月", "2月", "3月", "4月", "5月"],
|
|
|
|
|
axisLabel: {
|
|
|
|
|
//坐标轴刻度标签的相关设置
|
|
|
|
|
textStyle: {
|
|
|
|
|
color: "#ccc",
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 09:15:31 +08:00
|
|
|
|
},
|
|
|
|
|
yAxis: {
|
2024-04-15 13:33:05 +08:00
|
|
|
|
type: "value",
|
|
|
|
|
splitLine: {
|
|
|
|
|
show: true,
|
|
|
|
|
lineStyle: {
|
|
|
|
|
color: "rgba(226, 226, 226, 0.3)",
|
|
|
|
|
width: 1,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
axisLabel: {
|
|
|
|
|
//坐标轴刻度标签的相关设置
|
|
|
|
|
textStyle: {
|
|
|
|
|
color: "#ccc",
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-04-15 09:15:31 +08:00
|
|
|
|
},
|
|
|
|
|
series: [
|
|
|
|
|
{
|
2024-04-15 14:11:14 +08:00
|
|
|
|
name: "特困补助金额",
|
2024-04-15 13:33:05 +08:00
|
|
|
|
type: "line",
|
|
|
|
|
stack: "Total",
|
|
|
|
|
symbol: "emptyCircle",
|
|
|
|
|
|
|
|
|
|
symbolSize: 10,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
borderColor: "#00FCFF",
|
|
|
|
|
borderWidth: 1,
|
|
|
|
|
color: "#00FCFF",
|
|
|
|
|
},
|
|
|
|
|
data: [120, 132, 101, 134, 90],
|
2024-04-15 09:15:31 +08:00
|
|
|
|
},
|
2024-04-15 13:33:05 +08:00
|
|
|
|
|
2024-04-15 09:15:31 +08:00
|
|
|
|
{
|
2024-04-15 14:11:14 +08:00
|
|
|
|
name: "低保补助金额",
|
2024-04-15 13:33:05 +08:00
|
|
|
|
type: "line",
|
|
|
|
|
stack: "Total",
|
|
|
|
|
symbol: "emptyCircle",
|
2024-04-15 09:15:31 +08:00
|
|
|
|
|
2024-04-15 13:33:05 +08:00
|
|
|
|
symbolSize: 10,
|
|
|
|
|
itemStyle: {
|
|
|
|
|
borderColor: "#2468FF",
|
|
|
|
|
borderWidth: 1,
|
|
|
|
|
color: "#2468FF",
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
data: [150, 232, 201, 154, 190],
|
|
|
|
|
},
|
|
|
|
|
],
|
2024-04-15 09:15:31 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 使用生命钩子
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
// 基于准备好的dom,初始化echarts实例
|
|
|
|
|
// var myChart = echarts.init(document.getElementById('main'));
|
|
|
|
|
// Vue3中: 需要引入
|
|
|
|
|
var myChart = echarts.init(chart.value);
|
|
|
|
|
|
|
|
|
|
// init(); // vue3.2没有this
|
|
|
|
|
// 使用刚指定的配置项和数据显示图表。
|
|
|
|
|
myChart.setOption(option);
|
|
|
|
|
|
|
|
|
|
// 单图表响应式: 跟随浏览器大小改变
|
|
|
|
|
// window.addEventListener("resize", () => {
|
|
|
|
|
// myChart.resize();
|
|
|
|
|
// });
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
</style>
|