Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color option not updated #936

Closed
jarben opened this issue Nov 22, 2014 · 3 comments
Closed

color option not updated #936

jarben opened this issue Nov 22, 2014 · 3 comments

Comments

@jarben
Copy link
Contributor

jarben commented Nov 22, 2014

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!

@appleskiller
Copy link

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 .

@kener
Copy link
Contributor

kener commented Nov 22, 2014

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.

@jarben
Copy link
Contributor Author

jarben commented Nov 23, 2014

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

@kener kener closed this as completed Nov 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants