-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 优化图表页面 * 优化图标功能 * fix bug
- Loading branch information
Showing
14 changed files
with
205 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
<template> | ||
<div class="chart-bar" ref="chartBar" :style="style"></div> | ||
</template> | ||
<script setup> | ||
import * as echarts from "echarts/core"; | ||
import { GridComponent } from "echarts/components"; | ||
import { BarChart } from "echarts/charts"; | ||
import { TitleComponent } from "echarts/components"; | ||
import { CanvasRenderer } from "echarts/renderers"; | ||
import { ref, onMounted, computed, watch } from "vue"; | ||
import { useWindowSize } from "@vueuse/core"; | ||
import { watchThrottled } from "@vueuse/core"; | ||
const chartBar = ref(null); | ||
let myChart = ""; | ||
const props = defineProps({ | ||
// x轴数据 | ||
xData: { | ||
type: Object, | ||
default: () => {}, | ||
}, | ||
// 数据 | ||
yData: { | ||
type: Object, | ||
default: () => {}, | ||
}, | ||
// 标题 | ||
title: { | ||
type: String, | ||
default: "", | ||
}, | ||
// 样式 | ||
style: { | ||
type: Object, | ||
default: () => {}, | ||
}, | ||
// 颜色 | ||
color: { | ||
type: String, | ||
default: "", | ||
}, | ||
}); | ||
// 更新图表 | ||
const updateChart = () => { | ||
const option = { | ||
title: { | ||
text: props.title, | ||
}, | ||
xAxis: { | ||
type: "category", | ||
data: props.xData, | ||
}, | ||
yAxis: { | ||
type: "value", | ||
}, | ||
series: [ | ||
{ | ||
data: props.yData, | ||
type: "bar", | ||
}, | ||
], | ||
}; | ||
myChart.setOption(option); | ||
}; | ||
// 组件加载 | ||
onMounted(() => { | ||
const window = computed(() => { | ||
const { width, height } = useWindowSize(); | ||
return width.value * height.value; | ||
}); | ||
echarts.use([GridComponent, BarChart, CanvasRenderer, TitleComponent]); | ||
myChart = echarts.init(chartBar.value); | ||
updateChart(); | ||
watchThrottled( | ||
window, | ||
() => { | ||
myChart.resize(); | ||
}, | ||
{ throttle: 800 } | ||
); | ||
}); | ||
// 监听数据发生变化 | ||
watch( | ||
[props.xData, props.yData], | ||
() => { | ||
updateChart(); | ||
}, | ||
{ deep: true } | ||
); | ||
</script> | ||
|
||
<style scoped> | ||
.chart-bar { | ||
width: 100%; | ||
height: 100%; | ||
min-height: 400px; | ||
background-color: #fff; | ||
border-radius: 10px; | ||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); | ||
padding: 20px; | ||
margin-bottom: 20px; | ||
overflow: hidden; | ||
box-sizing: border-box; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
<div class="line-view"></div> | ||
</template> |
Oops, something went wrong.
a82b136
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
leelaa-admin – ./
admin.leelaa.cn
leelaa-admin-git-master-leelaas-projects.vercel.app
leelaa-admin.vercel.app
leelaa-admin-leelaas-projects.vercel.app