Raph
Raph

Reputation: 554

How can I set the legend text color when not selected in echarts?

I'm trying to change the color of the legend text when a serie is unselected/not shown in echarts.

Using the legend.textStyle.color option, I am able to change the text color but only when the serie is shown.
However I can't seem to find a similar option for when the serie is not shown.

For example the settings:

legend: {
  top: '10%',
    textStyle: {
      color: 'red'
  }
}

results in the following (with series medium and high not selected) enter image description here

But I'd like medium and high shown in a darker color

Am I missing it or is it just not there?

I've tried setting the color to an array (color: ['red', 'blue']) but that didn't work.

Upvotes: 0

Views: 5180

Answers (1)

kishore kumar
kishore kumar

Reputation: 29

you can use inactiveColor:"red", something like below

legend: {
    data: [{name: 'Email',
    inactiveColor:"red",
    textStyle:{
       color:'green'
    },
    itemStyle: {
      //color: ['red', 'green'],
      color: '#ccc',
      borderType: [50, 10],
    }}, 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
  },

Upvotes: 2

Related Questions