auth-web/src/views/welcome/components/charts/ChartRound.vue

74 lines
1.2 KiB
Vue
Raw Normal View History

2024-09-26 09:38:02 +08:00
<script lang="ts" setup>
2024-10-26 01:12:17 +08:00
import { computed, ref } from 'vue';
import { useDark, useECharts } from '@pureadmin/utils';
2024-09-26 09:38:02 +08:00
const { isDark } = useDark();
2024-10-26 01:12:17 +08:00
const theme = computed(() => (isDark.value ? 'dark' : 'light'));
2024-09-26 09:38:02 +08:00
const chartRef = ref();
const { setOptions } = useECharts(chartRef, {
2024-10-26 01:12:17 +08:00
theme,
renderer: 'svg',
2024-09-26 09:38:02 +08:00
});
setOptions({
2024-10-26 01:12:17 +08:00
container: '.line-card',
title: {
text: '100%',
left: '47%',
top: '30%',
textAlign: 'center',
textStyle: {
fontSize: '16',
fontWeight: 600,
},
},
polar: {
radius: ['100%', '90%'],
center: ['50%', '50%'],
},
angleAxis: {
max: 100,
show: false,
},
radiusAxis: {
type: 'category',
show: true,
axisLabel: {
show: false,
},
axisLine: {
show: false,
},
axisTick: {
show: false,
},
},
series: [
{
type: 'bar',
roundCap: true,
barWidth: 2,
showBackground: true,
backgroundStyle: {
color: '#dfe7ef',
},
data: [100],
coordinateSystem: 'polar',
color: '#7846e5',
itemStyle: {
shadowBlur: 2,
shadowColor: '#7846e5',
shadowOffsetX: 0,
shadowOffsetY: 0,
},
},
],
2024-09-26 09:38:02 +08:00
});
</script>
<template>
2024-10-26 01:12:17 +08:00
<div ref="chartRef" style="width: 100%; height: 60px" />
2024-09-26 09:38:02 +08:00
</template>