susielu / d3-legend

A reusable d3 legend component.
http://d3-legend.susielu.com/
Apache License 2.0
727 stars 104 forks source link

When it works with Angular's iElement, I get some error #42

Closed EtachGu closed 7 years ago

EtachGu commented 8 years ago
angular.min.js:108 TypeError: shapes.nodes is not a function
    at Array.legend (http://localhost:3000/lib/d3/d3-legend.js:4101:36)
    at Array.d3_selectionPrototype.call (http://localhost:3000/lib/d3/d3.js:975:14)
    at post (http://localhost:3000/js/directives.js:2505:22)
    at ea (http://localhost:3000/lib/angular/angular.min.js:74:16)
    at w (http://localhost:3000/lib/angular/angular.min.js:61:340)
    at g (http://localhost:3000/lib/angular/angular.min.js:54:250)
    at g (http://localhost:3000/lib/angular/angular.min.js:54:267)
    at g (http://localhost:3000/lib/angular/angular.min.js:54:267)
    at g (http://localhost:3000/lib/angular/angular.min.js:54:267)
    at g (http://localhost:3000/lib/angular/angular.min.js:54:267) <div my-legend-info="">
  var linear = d3.scale.linear()
                    .domain([0,10])
                    .range(["rgb(46, 73, 123)", "rgb(71, 187, 94)"]);

                d3.select(iElement[0]).remove("svg");
                var svg = d3.select(iElement[0]).append("svg");

                svg.append("g")
                    .attr("class", "legendLinear")
                    .attr("transform", "translate(20,20)");

                var legendLinear = d3.legendColor()
                    .shapeWidth(30)
                    .orient('horizontal')
                    .scale(linear);

                svg.select(".legendLinear")
                    .call(legendLinear);
susielu commented 8 years ago

Is this still happening with the v4 version of this component?

susielu commented 7 years ago

I am going to close this issue please respond if you want it re-opened.