0
votes

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!

2
I think it might be easier to target the lines using CSS selectors. - IVO GELOV
there are no classes on grid lines, by selector - not variant, but thank you - Makson Bondaruk

2 Answers

1
votes

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.

0
votes

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);