关于Echarts修改自己碰到的 会持续更新

React 引入echarts
在这里插入图片描述
渲染 echarts
在这里插入图片描述
修改 X轴样式:

xAxis: {
      type: 'category',
      data: dataArr,
      axisLabel: {
        interArrival: 0,   ---x轴全部显示
        rotate: 30			---倾斜度
      },
      splitLine:{ show:false}   ---不显示分割线
  },
  legend: {
      orient: 'vertical',   --- 纵向显示,默认横向
      show: true,
      data: ['BadIP', 'BadSrc', 'BadDst'],
      x: 'right',
      textStyle: {
        color: '#C0C1C4'
      }
  },
  series: [{
      data: valArr,
      type: 'bar',
      barWidth: '30%',     ---柱子宽度
      itemStyle: {
        normal: {
          color: '#06BAE9'   ---柱子颜色
        }
      }
  }]
  
  textStyle: {
    color: '#C0C1C4'   -- 字体颜色
  },


//  和series中 itemStyle 一样  适用多种颜色同时渲染
 itemStyle: {   
	//每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
            normal:{  
	
                color: function (params){
                    var colorList = ['#56B25C','#F32A2C','#028AF4','#F25614','#0E365C'];
                    return colorList[params.dataIndex];
                }
            },
            // //鼠标悬停时:
            // emphasis: {
            //         shadowBlur: 10,
            //         shadowOffsetX: 0,
            //         shadowColor: 'rgba(0, 0, 0, 0.5)'
            // }
        },
  
 //自定义图标样式
 toolbox: {
    top: 'top',
    feature: {
      magicType: { type: ['line', 'bar'] },
      restore: {   //配置还原
        show: true
      },
      saveAsImage: {   //保存为图片
        show: true
      }
    }
  },
  // 鼠标进入显示数据
  tooltip : {
      trigger: 'axis',
      axisPointer : {            // 坐标轴指示器,坐标轴触发有效
          type : 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
      }
  },

echarts的pie图中,各区块颜色的调整
参考原文 https://www.cnblogs.com/kumu/p/9515169.html

猜你喜欢

转载自blog.csdn.net/weixin_43271750/article/details/83818923