score:1

Accepted answer

Converting the function() {} syntax into arrow functions will allow you to maintain the this.

So:

function(d) { return this.get('xScale'); }

becomes

(d) => this.get('xScale')

or

(d) => {
  return this.get('xScale');
}

For more information on arrow functions: - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions - https://hackernoon.com/javascript-es6-arrow-functions-and-lexical-this-f2a3e2a5e8c4


Related Query

More Query from same tag