ECharts使用

  1. 设置X轴标签倾斜一定角度,全部显示,在xAxis中设置

     axisLabel: {
         show: true,
         interval: 0,
         rotate: -30
     }
  1. 设置渐变色,在option中设置

    color: {
         type: 'linear',
         x: 0,
         y: 0,
         x2: 0,
         y2: 1,
         colorStops: [{
         offset: 0, color: 'rgba(43,78,182,0.8)' // 0% 处的颜色
         }, {
         offset: 1, color: 'rgba(90,201,221,0.8)' // 100% 处的颜色
         }],
         global: false // 缺省为 false
     }

     

  2.  柱状图或饼图悬浮提示,具体params参数内容可以借助console.log打印输出查看
      tooltip: {
        trigger: 'axis',
        formatter: (params)=>{
          return params[0].name+'<br>计划投资:'+data.investment[params[0].dataIndex]+'亿元'
              +'<br>项目数量:'+params[0].value+'个<br> ';
        }
      },

     

posted @ 2022-08-08 15:17  华格瑞沙  阅读(34)  评论(0编辑  收藏  举报