Develop an angular application with D3 JS and faced with the problem that I cannot change the fill color of svg.
If you look at this code, you will see that I am creating one svg and trying to insert another from my provider:
function link (scope, element, attrs) { var svgContainer = d3.select(element[0]).append("svg") .attr("width", $window.screenX - 2*100) .attr("id", "oil-game") .attr("height", 1200); var well = svgContainer.append("g"); angular.forEach(scope.d3WellDetails, function (value, key) { var circle = well.append("circle") .attr("cx", 55) .attr("cy", 100 + key*115) .attr("r", 40) .attr('stroke', '#0897c7') .attr('stroke-width', '5') .attr('fill', 'white'); well.append("text") .attr('x', 50) .attr('y', 85 + key*115) .attr('fill', '#0897c7') .attr('font-size', 16) .attr('font-weight', 900) .text(value.Name); well.append('svg:image') .attr('xlink:href', '../../images/wells.svg') .attr('x', 40) .attr('y', 95 + key*115) .attr("width", 30) .attr("height", 30) .attr('fill', '#0897c7'); }); }
I want you to look at the final part when I add a new svg. If I use .attr('xlink:href', '//') , I cannot change the fill color of svg.
But if I use .attr('src', '//') , I do not see the svg image, but in the developer tool I see it empty.
How can i solve this?