Incubator-echarts: 关于line颜色和symbol的颜色不一致的问题

Created on 26 Jul 2016  ·  4Comments  ·  Source: apache/incubator-echarts

问题简述 (One-line summary)

我在lineStyle里面设置了线的颜色,但是我无法设置series[i]-line.symbol的颜色。symbol的颜色总是根据我的color中的颜色交替显示。如何保证symbol的颜色与线的颜色一致呢?

版本及环境 (Version & Environment)

  • ECharts 版本 (ECharts version):
  • 浏览器类型和版本 (Browser version):
  • 操作系统类型和版本 (OS Version):

    重现步骤 (Steps to reproduce)

1.
2.

期望结果 (Expected behaviour)

symbol可以设置成与line一样的颜色

可能哪里有问题 (What went wrong)

ECharts配置项 (ECharts option)

var color = ['rgb(155,187,89)','#c23531']
option = {
    title: {
        text: '未来一周气温变化',
        subtext: '纯属虚构'
    },
    color:color,
    tooltip: {
        trigger: 'axis'
    },
    legend: {
        data:['最高气温','最低气温']
    },
    toolbox: {
        show: true,
        feature: {
            dataZoom: {
                yAxisIndex: 'none'
            },
            dataView: {readOnly: false},
            magicType: {type: ['line', 'bar']},
            restore: {},
            saveAsImage: {}
        }
    },
    xAxis:  {
        type: 'category',
        boundaryGap: false,
        data: ['周一','周二','周三','周四','周五','周六','周日']
    },
    yAxis: {
        type: 'value',
        axisLabel: {
            formatter: '{value} °C'
        }
    },
    series: [
        {
            name:'最高气温',
            type:'line',
            symbol:'arrow',
        symbolSize:10,
            data:[11, 11, 15, 13, 12, 13, 10],           
            lineStyle: {
                normal: {
                        color: color[0],
                        },
                },
          },
        {
            name:'最低气温',
            type:'line',
            symbol:'arrow',
                symbolSize:10,
            data:[1, -2, 2, 5, 3, 2, 0],
            lineStyle: {
                normal: {
                        color: color[0],
                        },
                },
         },
        {
            name:'最低气温',
            type:'line',
            symbol:'arrow',
        symbolSize:10,
            data:[5, 5,8, 9, 8, 9, 5],
            lineStyle: {
                normal: {
                        color: color[1],
                        },
                },
        }
    ]
};

其他信息 (Other comments)

1234

Most helpful comment

设置 itemStyle,不要设置 lineStyle

All 4 comments

我这个颜色可以设为一致吗?谢谢指教!

设置 itemStyle,不要设置 lineStyle

非常感谢,使用成功!

谢谢我也搞定了

Was this page helpful?
0 / 5 - 0 ratings