zoukankan      html  css  js  c++  java
  • echarts 折线图自定义颜色与修改legend颜色

     

    option4 = {
    title : {
    text: '',
    subtext: ''
    },
    color:['#2db7f5','#ff6600','#808bc6'],      //关键加上这句话,legend的颜色和折线的自定义颜色就一致了
    legend: {
    icon: 'rectangle',
    data: ['total', 'dfs_used','non_dfs_used'],
    right: '4%',
    textStyle: {
    fontSize: 12,
    color: '#666'
    }
    },
    /*grid:{y:15},*/
    tooltip : {
    trigger: 'axis'
    },
    calculable : true,
    yAxis : [
    {
    type : 'value',
    splitLine:{show: false},//去除网格线
    //boundaryGap : [0, 0.1],
    axisLabel: {
    show: true,
    textStyle: {
    color:'#666' //这里用参数代替了
    }
    },
    }
    ],
    xAxis : [
    {
    type : 'category',
    splitLine:{show: false},//去除网格线
    data : ['5','10','15','20','25','30','35','40','45'],
    axisLabel: {
    show: true,
    textStyle: {
    color:'#666' //这里用参数代替了
    }
    },
    }
    ],
    series : [
    {
    name:'total',
    type:'line',
    symbol:'none', //这句就是去掉点的
    smooth:true,
    barWidth:'37',
    data:[43, 48, 36, 32, 46, 32,30, 40, 29],
    //symbol:'none',
    //smooth:true,
    itemStyle: {
    normal: {
    areaStyle: {type: 'default',color:'#d5f0fd'},
    lineStyle:{color:'#2db7f5'}
    }
    },
    },
    {
    name:'dfs_used',
    type:'line',
    symbol:'none', //这句就是去掉点的
    smooth:true,
    barWidth:'37',
    data:[28, 32, 30, 52, 56, 22,20, 25, 20],
    itemStyle: {
    normal: {
    areaStyle: {type: 'default',color:'#fff5e6'},
    lineStyle:{color:'#ff6600'}
    }
    }
    },
    {
    name:'non_dfs_used',
    type:'line',
    symbol:'none', //这句就是去掉点的
    smooth:true,
    barWidth:'37',
    data:[20, 12, 20, 32, 46, 12,10, 15, 10],
    itemStyle: {
    normal: {
    areaStyle: {type: 'default',color:'#dcdfee'},
    lineStyle:{color:'#808bc6'}
    }
    }
    }
    ]
    };

  • 相关阅读:
    VTK初学一,b_PolyVertex多个图形点的绘制
    VTK初学一,a_Vertex图形点的绘制
    Python基础学习之集合
    Apache
    NTP时间同步服务和DNS服务
    NFS服务及DHCPD服务
    samba服务及vsftpd服务
    Linux rpm和yum软件管理
    Linux网络技术管理及进程管理
    Linux RAID磁盘阵列
  • 原文地址:https://www.cnblogs.com/snowhite/p/10782242.html
Copyright © 2011-2022 走看看