大屏---Echart之雷达图

echart版本:5.4.0

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
当数据区域很小时,series.data.label会叠在一起,可以放到radar.axisName里面

axisName: { // 指示器名称配置项
   formatter: (label, indicator) => { // 指示器名称
     const val = dataList[indicator.i]
     return `${label}\n${val}车次`
   }
}

完整配置代码:

const options = {
   backgroundColor: 'transparent',
   legend: {
     show: true,
     textStyle: {
       color: '#FFf'
     }
   },
   radar: [
     {
       shape: 'polygon', // 形状
       center: ['50%', '50%'], // 圆心
       radius: 150, // 半径
       startAngle: 90, // 第一个indicator的角度
       axisName: { // 指示器名称配置项
         formatter: (label, indicator) => { // 指示器名称
           const val = dataList[indicator.i]
           return `${label}\n${val}车次`
         },
         color: '#000',
         fontStyle: 'italic', // 字体风格 normal/italic/oblique
         fontWeight: 'bold', // normal/bold/bolder/lighter
         fontFamily: 'Microsoft YaHei',
         fontsize: 16,
         lineHeight: 20,
         padding: [5, 10],
         backgroundColor: '#fff',
         borderRadius: 10
       },
       indicator: [ // 指示器
         { text: '1小时以下', i: 0, max },
         { text: '1~5小时', i: 1, max },
         { text: '5~12小时', i: 2, max },
         { text: '12~24小时', i: 3, max },
         { text: '24小时以上', i: 4, max }
       ],
       splitNumber: 5, // 间隔数
       splitLine: { // 间隔线
         lineStyle: {
           width: 2,
           color: 'blue'
         }
       },
       axisLine: {
         show: false,
         lineStyle: {
           color: 'rgba(255, 255, 255, .4)'
         }
       },
       // axisLabel: { // 每个交叉点得数值
       //   show: true,
       //   color: 'rgba(255, 255, 255, .6)'
       // }
     }
   ],
   series: [
     {
       type: 'radar',
       radarIndex: 0,
       // label: { // 同data.label
       //   show: true,
       //   position: 'top',
       //   color: 'red'
       // },
       // lineStyle: { // 同data.lineStyle
       //   width: 2,
       //   type: 'dashed',
       //   join: 'round'
       // },
       legendHoverLink: true,
       data: [
         {
           value: dataList,
           name: '占用',
             symbol: 'rect', // 形状
             symbolSize: 12,
             label: {
               show: true,
               position: 'left',
               // offset: [10, -5],
               color: 'rgba(1, 252, 255, 1)',
               fontSize: 12,
               fontWeight: 'bold',
               formatter: function (params) {
               	return  `${params.value} 车次`
               }
             },
           itemStyle: {
             color: 'rgba(70, 253, 255, 1)'
           },
           lineStyle: {
             width: 2,
             type: 'dashed',
             join: 'round',
             color: 'rgba(70, 253, 255, 1)'
           },
           areaStyle: {
             color: new echarts.graphic.RadialGradient(0.6, 0.6, 1, [
               {
                 color: 'rgba(70, 253, 255, 0)',
                 offset: 0
               },
               {
                 color: 'rgba(70, 253, 255, 1)',
                 offset: 1
               }
             ]),
              opacity: 0.5
           },
           emphasis: { // 鼠标经过高亮
             itemStyle: {},
             label: {},
             lineStyle: {},
             areaStyle: {
               color: 'red'
             }
           }
         }
       ]
     }
   ]
 }
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Misha韩

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值