-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
167 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
home: home | ||
about: about | ||
echarts: echarts | ||
edit: Edit | ||
to test HMR: to test HMR | ||
check out: Check out | ||
|
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
home: 主页 | ||
about: 关于 | ||
echarts: 图表 | ||
edit: 编辑 | ||
to test HMR: 测试热更新 | ||
check out: 查看 | ||
|
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
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,75 @@ | ||
<script setup lang="ts"> | ||
import { use } from 'echarts/core' | ||
import { CanvasRenderer } from 'echarts/renderers' | ||
import { PieChart } from 'echarts/charts' | ||
import { | ||
TitleComponent, | ||
TooltipComponent, | ||
LegendComponent, | ||
} from 'echarts/components' | ||
import VChart, { THEME_KEY } from 'vue-echarts' | ||
import { ref, provide } from 'vue' | ||
use([ | ||
CanvasRenderer, | ||
PieChart, | ||
TitleComponent, | ||
TooltipComponent, | ||
LegendComponent, | ||
]) | ||
const { isDark } = useDarks() | ||
provide( | ||
THEME_KEY, | ||
computed(() => (isDark.value ? 'dark' : '')) | ||
) | ||
const option = ref({ | ||
title: { | ||
text: 'Traffic Sources', | ||
left: 'center', | ||
}, | ||
tooltip: { | ||
trigger: 'item', | ||
formatter: '{a} <br/>{b} : {c} ({d}%)', | ||
}, | ||
legend: { | ||
orient: 'vertical', | ||
left: 'left', | ||
data: ['Direct', 'Email', 'Ad Networks', 'Video Ads', 'Search Engines'], | ||
}, | ||
series: [ | ||
{ | ||
name: 'Traffic Sources', | ||
type: 'pie', | ||
radius: '55%', | ||
center: ['50%', '60%'], | ||
data: [ | ||
{ value: 335, name: 'Direct' }, | ||
{ value: 310, name: 'Email' }, | ||
{ value: 234, name: 'Ad Networks' }, | ||
{ value: 135, name: 'Video Ads' }, | ||
{ value: 1548, name: 'Search Engines' }, | ||
], | ||
emphasis: { | ||
itemStyle: { | ||
shadowBlur: 10, | ||
shadowOffsetX: 0, | ||
shadowColor: 'rgba(0, 0, 0, 0.5)', | ||
}, | ||
}, | ||
}, | ||
], | ||
}) | ||
</script> | ||
|
||
<template> | ||
<v-chart class="chart" :option="option" autoresize /> | ||
</template> | ||
|
||
<style scoped> | ||
.chart { | ||
height: 100vh; | ||
} | ||
</style> |