echarts icon indicating copy to clipboard operation
echarts copied to clipboard

color option not updated

Open jarben opened this issue 12 years ago • 3 comments

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!

jarben avatar Nov 22 '14 04:11 jarben

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 .

appleskiller avatar Nov 22 '14 06:11 appleskiller

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.

kener avatar Nov 22 '14 15:11 kener

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

jarben avatar Nov 23 '14 05:11 jarben