Makson  Bondaruk
Makson Bondaruk

Reputation: 36

Amcharts grid color with opacity

Need to change line(grid) color, create custom theme, but my line with opacity

enter image description here

function am4themes_sdTheme(target) {
  if (target instanceof am4core.InterfaceColorSet) {
    target.setFor('text', am4core.color('#ffffff')); // text color
    target.setFor('grid', am4core.color('#ffffff')); // line color
  }
}
am4core.useTheme(am4themes_sdTheme);

Thanks!

Upvotes: 0

Views: 454

Answers (2)

Makson  Bondaruk
Makson Bondaruk

Reputation: 36

function am4themes_sdTheme(target) {
  if (target instanceof am4core.InterfaceColorSet) {
    target.setFor('text', am4core.color('#ffffff')); // text color
    target.setFor('grid', am4core.color('#ffffff')); // line color
  }
  if (target instanceof am4charts.Tick) {
    target.strokeOpacity = 1; // line opacity
  }
}
am4core.useTheme(am4themes_sdTheme);

Upvotes: 0

xorspark
xorspark

Reputation: 16012

That's a tick, not a grid. You have to target it separately:

function am4themes_sdTheme(target) {
  if (target instanceof am4core.InterfaceColorSet) {
    target.setFor('text', am4core.color('#ffffff')); 
  }
  if (target instanceof am4charts.Tick) { 
    target.strokeOpacity = 0;
  }
}
am4core.useTheme(am4themes_sdTheme);

Tick extends different types of elements, so you might want to be more specific and use PieTick if you want to differentiate between pie ticks, axis ticks, etc.

Upvotes: 1

Related Questions