echarts5.vue 1006 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <div ref="echarts5" class="echarts5"></div>
  3. </template>
  4. <style scoped lang="scss">
  5. .echarts5 {
  6. height: 13vh;
  7. width: 100%;
  8. }
  9. </style>
  10. <script setup>
  11. import * as echarts from 'echarts'
  12. const echarts5 = ref()
  13. onMounted(() => {
  14. echarts5View()
  15. })
  16. function echarts5View() {
  17. const myChart5 = echarts.init(echarts5.value)
  18. const option5 = {
  19. series: [
  20. {
  21. type: 'pie',
  22. radius: ['75%', '90%'],
  23. avoidLabelOverlap: false,
  24. color: ['#1E90FF', '#00FFFF'],
  25. label: {
  26. position: 'center',
  27. color: '#FFFFFF',
  28. fontSize: '14'
  29. },
  30. emphasis: {
  31. label: {
  32. show: false
  33. }
  34. },
  35. labelLine: {
  36. show: true
  37. },
  38. data: [
  39. { value: 1048, name: '占比80%' },
  40. { value: 735, name: '占比20%' }
  41. ]
  42. }
  43. ]
  44. }
  45. myChart5.setOption(option5)
  46. window.addEventListener('resize', function () {
  47. myChart5.resize()
  48. })
  49. }
  50. </script>