I am working in an angular project and designing d3 pie charts. Everything works fine. But my problem is that I am not able to access class private variable inside a function.
Scope issue. Change
.attr('y', function (d, i) { return (this.legendHeight * (i + 1))})
To
.attr('y', (d, i) => { return (this.legendHeight * (i + 1))})
One of many docs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With