• ECharta雷达图 样式调整


    预期效果
    在这里插入图片描述

    <template>
      <div id="operationalRisk-radar-chart" class="h-290 w-385"></div>
    </template>
    
    <script>
      export default {
        name: 'radarChart'
      }
    </script>
    <script setup>
      import { onMounted, reactive } from 'vue'
      import * as echarts from 'echarts'
    
      const options = reactive({
        color: ['#ff9200', '#0086ff'],
        legend: {
          show: true,
          //   type: 'scroll',
          //   left: 200,
          itemHeight: 3,
          itemWidth: 20,
          data: ['实际值', '阈值'],
          textStyle: {
            fontSize: 16,
            color: '#fff'
          }
        },
        radar: {
          center: [215, 165],
          radius: 90,
          indicator: [
            { name: '客货比', max: 6500 },
            { name: '道路几何线性', max: 16000 },
            { name: '平均速度', max: 30000 },
            { name: '危险驾驶行为影响', max: 38000 },
            { name: '流量', max: 52000 },
            { name: '剩余通行能力', max: 25000 },
            { name: '速度差', max: 25000 },
            { name: '能见度', max: 25000 }
          ],
          //   刻度线颜色
          splitLine: {
            lineStyle: {
              color: '#214b83'
            }
          },
          //   轴线不显示
          axisLine: {
            show: false
            // lineStyle: {
            //   color: 'pink'
            // }
          },
          //   文字颜色
          axisName: {
            color: '#5faff4',
            fontSize: 16
          },
          splitArea: {
            // (圆中间的圆环分隔的区域)坐标轴在 grid 区域中的分隔区域,默认不显示。
            areaStyle: {
              // 分隔区域的样式设置。
              show: false,
              color: 'rgba(1, 1, 1, 0)',
              shadowColor: 'rgba(0, 0, 0, 0.2)',
              shadowBlur: 10
            }
          },
          axisradar: {
            // (圆内的几条直线)坐标轴轴线相关设
            show: false
          }
        },
        series: [
          {
            name: 'Budget vs spending',
            type: 'radar',
            itemStyle: {
              lineStyle: {
                type: 'dashed'
              }
            },
            data: [
              {
                value: [5000, 14000, 28000, 26000, 42000, 21000],
                name: '阈值',
                areaStyle: {
                  color: '#655137'
                },
                symbol: 'none', // 数据点不要圆点样式
                lineStyle: {
                  type: 'dashed' // 线条样式为虚线
                }
              },
              {
                value: [4200, 3000, 20000, 35000, 50000, 18000],
                name: '实际值',
                symbol: 'none',
                areaStyle: {
                  color: '#004d9c'
                },
                lineStyle: {
                  type: 'dashed'
                }
              }
            ]
          }
        ]
      })
      // 创建基础折线图
      const createradarChart = () => {
        const chart = echarts.init(document.getElementById('operationalRisk-radar-chart'))
        chart.setOption(options)
      }
    
      // 在组件加载时创建折线图
      onMounted(() => {
        setTimeout(() => {
          createradarChart()
        }, 1000)
      })
    </script>
    <style lang="scss" scoped></style>
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
  • 相关阅读:
    数据结构 | (四) Queue
    北京程序员的真实一天!!!!!
    操作系统学习笔记_1 计算机系统的运行和结构
    【git入门教程--基于gitee】
    这波水文章
    2023-9-8 求组合数(二)
    ISO9001质量管理体系剖析
    双十一游戏党必备的数码好物有哪些?2022双11游戏党必备外设清单
    基于STM32的智能健康监测手环
    如何开发新客户?有哪些高效率方法?
  • 原文地址:https://blog.csdn.net/weixin_63681863/article/details/133951687