Different color bar chart from eCharts

后端 未结 3 679
粉色の甜心
粉色の甜心 2020-12-30 03:46

I was trying to create a different color bar. For Mon blue, Tue red, Wed green. Please help me how to write it. Line itemStyle: {normal: {color: \'blue\',\'red\', \'gr

3条回答
  •  既然无缘
    2020-12-30 04:30

    The top solution was not working for me. From their documentation is seems lineStyle now has two children elements you can leverage 'normal' and 'emphasis'. I had to modify it like so to override the default colors:

        var option = {
        xAxis: {
            type: 'category',
            data: ['Mon', 'Tue', 'Wed']
        },
        yAxis: {
            type: 'value'
        },
        series: [{
            data: [
                {
                    value: 120,
                    itemStyle: { normal: { color: 'blue' } },
                },
                {
                    value: 200,
                    itemStyle: { normal: { color: 'red' } },
                },
                {
                    value: 150,
                    itemStyle: { normal: { color: 'green' } },
                }
            ],
            type: 'bar'
        }],
        graph: {
            color: colorPalette
        }
    };
    

提交回复
热议问题