echarts4.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <div ref="echarts4" class="echarts4"></div>
  3. </template>
  4. <style scoped lang="scss">
  5. .echarts4 {
  6. height: 65%;
  7. width: 100%;
  8. }
  9. </style>
  10. <script setup>
  11. import * as echarts from 'echarts'
  12. const echarts4 = ref()
  13. onMounted(() => {
  14. echarts4View()
  15. })
  16. function echarts4View() {
  17. const myChart4 = echarts.init(echarts4.value)
  18. const option4 = {
  19. color: ['#67F9D8', '#FFE434', '#56A3F1', '#FF917C'],
  20. radar: [
  21. {
  22. indicator: [{ text: '总利润(亿)' }, { text: '总营收(亿)' }, { text: '员工数' }, { text: '投入研发(亿)' }, { text: '总利税(亿)' }],
  23. center: ['50%', '50%'],
  24. radius: '80%',
  25. startAngle: 90,
  26. splitNumber: 4,
  27. shape: 'circle',
  28. axisName: {
  29. formatter: '【{value}】',
  30. color: '#fff'
  31. },
  32. splitArea: {
  33. areaStyle: {
  34. color: ['#77EADF', '#26C3BE', '#64AFE9', '#428BD4'],
  35. shadowColor: 'rgba(0, 0, 0, 0.2)',
  36. shadowBlur: 10
  37. }
  38. },
  39. axisLine: {
  40. lineStyle: {
  41. color: 'rgba(211, 253, 250, 0.8)'
  42. }
  43. },
  44. splitLine: {
  45. lineStyle: {
  46. color: 'rgba(211, 253, 250, 0.8)'
  47. }
  48. }
  49. }
  50. ],
  51. series: [
  52. {
  53. type: 'radar',
  54. emphasis: {
  55. lineStyle: {
  56. width: 4
  57. }
  58. },
  59. data: [
  60. {
  61. value: [100, 8, 0.4, -80, 2000],
  62. name: 'Data A'
  63. }
  64. ]
  65. }
  66. ]
  67. }
  68. myChart4.setOption(option4)
  69. window.addEventListener('resize', function () {
  70. myChart4.resize()
  71. })
  72. }
  73. </script>