echarts改变折线图和折线点的颜色

最近在做echart,每次更新一点,记录一点完成之后方便进行大的总结

//(1)改变折线点和折线的颜色

series: [
    {
      name: "温度",//鼠标放在折线点上显示的名称
      type: "line",//折线图
      symbol: 'circle',//折线点设置为实心点
      symbolSize: 4,   //折线点的大小
      itemStyle: {
         normal: {
           color: "#386db3",//折线点的颜色
           lineStyle: {
           color: "#386db3"//折线的颜色
          }
        }
     },
]
//(2)改变x轴y轴的颜色以及宽度

xAxis: [{
        gridIndex: 0,
        type: "category",
        data: xdata,
        axisLine: {
            lineStyle:{
                color:'#272729',//x轴的颜色
                width:8,//轴线的宽度
            }
        },
    }],
yAxis: [
    axisLine: {
       lineStyle:{
          color:'#272729',// y轴的颜色
          width:8,//y轴线的宽度
    }
}],
// (3)改变坐标值的颜色

axisLabel: {
      show: true,
      textStyle: {
         color: '#fff'
       }
}
(4)legend

添加legend的时候,必须是series中name的名字和legend中字体的内容是一致的才能显示

legend的颜色是在option里面直接定义的color数组,有几个图例就在color里面写几个颜色值。

 legend: {
            color:['#4472C5'],
            data:['最近七天喷淋主泵出口压力'],
            textStyle:{//图例文字的样式
                color:'#fff',
                fontSize:16
            }
  },
 series: [
          {
            type: 'line',
            valueAxisIndex: 0,
            name: "最近七天喷淋主泵出口压力"
          }
         ]
 
 

猜你喜欢

转载自blog.csdn.net/bujiongdan/article/details/83859632