0

Can I chang the color from an SVG included in another svg over the <image> tag created in D3.js

Look at the code below:

plan.select('image').transition().duration(250).ease('in')
            .attr('x', 10)
            .attr('y', 17)
            .attr('width', 55)
            .attr('height', 55)
            .attr('xlink:href', 'icon.svg')
            .style('fill', (year) => {
                let color:string = '#d4d4d4';
                if (isPast(year)) {
                    color = '#555555';
                } else if (hasAmount(year)) {
                    color = '#000000';
                }
                return color;
            });

In the past of codeHistory, I included the svg as a font so the styling was quite easy, but the icons didn't display correct. (some spaces are cancelled magically)

Now i try to include the svg direct over the image tag but i don't know how to change the color of the included svg...

Synoon
  • 2,297
  • 4
  • 22
  • 37

0 Answers0