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'}
    }
    }
    }
    ]
    };

  • 相关阅读:
    第二阶段个人冲刺总结01
    软件工程学习进度表13
    软件工程学习进度表12
    个人博客(09)
    个人博客(07)
    个人博客(08)
    poj1562 DFS入门
    poj3278 BFS入门
    数组单步运算
    十天冲刺
  • 原文地址:https://www.cnblogs.com/snowhite/p/10782242.html
Copyright © 2011-2022 走看看