Incubator-echarts: 如何设置legend前的icon样式,比如颜色

Created on 1 Mar 2016  ·  11Comments  ·  Source: apache/incubator-echarts

Most helpful comment

与legend同级,
加一个color:['#0098FE','#FF9B00']

All 11 comments

看样子是需要自己做素材图片了,如此一来更改line的颜色,或者更改legend字体的颜色,但icon不能改也不是好的办法

itemStyle.normal.color

但是如果我series数据的color有红黄绿三种颜色,但legend我要设置成绿色,怎么办? @pissang

legendModel.js
貌似没有这个选项啊itemStyle.normal.color

与legend同级,
加一个color:['#0098FE','#FF9B00']

@pissang @duxiaofeng-github
我折线图中的点有两种颜色
itemStyle: {
normal: {

                            color: function (param) {
                                if (param.data == maxtime){
                                    return '#ff151a';
                                } else {
                                    return '#1ca1ff';
                                }
                            },
                            borderColor: '#1ca1ff'
                        }
                    }

这样设置了当value为某个值时设置折线的点为另一个颜色,但是legend的颜色每次都取第一个节点的颜色,同级别加color数组也不行,不知道如何自定义,难道只能设置icon吗

但是如果我series数据的color有红黄绿三种颜色,但legend我要设置成绿色,怎么办? @pissang

同样好气

@andy-hu1993 我和你有同样的需求 请问你找到解决办法了么?

我也有同样的需求,求解决

@impguier 的回答有用,改变了折线的颜色,然后:

        color: ['#5A8FEE', '#ff7674'], // 图例icon颜色会变成对应的这两个颜色
        legend: {
          data: [
            {
              name: '1数',
              icon: 'circle',
              textStyle: {
                color: '#5A8FEE' // 图例文字颜色
              }
            },
            {
              name: '2数',
              icon: 'circle',
              textStyle: {
                color: '#ff7674'
              }
            }
          ]
        },

图例icon颜色和线的颜色一致,谢谢大神

这个更灵活
echarts文档

option = {
    // 全局调色盘。
    color: ['#c23531','#2f4554', '#61a0a8', '#d48265', '#91c7ae','#749f83',  '#ca8622', '#bda29a','#6e7074', '#546570', '#c4ccd3'],
    series: [{
        type: 'bar',
        // 此系列自己的调色盘。
        color: ['#dd6b66','#759aa0','#e69d87','#8dc1a9','#ea7e53','#eedd78','#73a373','#73b9bc','#7289ab', '#91ca8c','#f49f42'],
        ...
    }, {
        type: 'pie',
        // 此系列自己的调色盘。
        color: ['#37A2DA', '#32C5E9', '#67E0E3', '#9FE6B8', '#FFDB5C','#ff9f7f', '#fb7293', '#E062AE', '#E690D1', '#e7bcf3', '#9d96f5', '#8378EA', '#96BFFF'],
        ...
    }]
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

jarben picture jarben  ·  3Comments

kirazxyun picture kirazxyun  ·  3Comments

Cyycl picture Cyycl  ·  3Comments

marine1ly picture marine1ly  ·  3Comments

publisherfk picture publisherfk  ·  3Comments