Incubator-echarts: color option not updated

Created on 22 Nov 2014  ·  3Comments  ·  Source: apache/incubator-echarts

Hi everyone, first of all - ECharts are awesome, the next big thing in dataviz, you guys rock!

Now the issue - I've been trying to change the "color" option and use the .setOption() method. This doesn't update the chart nor calling the .refresh() method. The only method which works is setTheme() // empty param throws an error but does the job..

Anyway, thanks for your hard work!

Most helpful comment

Just because the legend keep the color-series Map after render. Try this option and change the color as your description, it work.

option = {
    color: ['red','green'],
    series : [
      {
          type:'pie',
          data:[
            {name:1, value:10},
            {name:2, value:20}
          ]
      }
  ]
};

But, when legend has been used, you can use legend's api: setColor, see http://echarts.baidu.com/doc/doc-en.html#LegendInterface , set the series to a new color or false for clear the series' color map in legend.

Or, maybe the setTheme is the best way, check this http://echarts.baidu.com/doc/example/line1.html#-en
and in the Console, try this
myChart.setTheme({color:['red','green']});
you will find what your need.

Thx for your appreciate.

All 3 comments

In fact, your color is already in force, but has not been applied to the echarts series, because the current option.color not corresponding to each series.In this regard, I also expect echarts to change —— color sequential decision color of series .

Just because the legend keep the color-series Map after render. Try this option and change the color as your description, it work.

option = {
    color: ['red','green'],
    series : [
      {
          type:'pie',
          data:[
            {name:1, value:10},
            {name:2, value:20}
          ]
      }
  ]
};

But, when legend has been used, you can use legend's api: setColor, see http://echarts.baidu.com/doc/doc-en.html#LegendInterface , set the series to a new color or false for clear the series' color map in legend.

Or, maybe the setTheme is the best way, check this http://echarts.baidu.com/doc/example/line1.html#-en
and in the Console, try this
myChart.setTheme({color:['red','green']});
you will find what your need.

Thx for your appreciate.

Yeah, myChart.setTheme({color:['red','green']}); works great, thanks for that!

Was this page helpful?
0 / 5 - 0 ratings