Q:

Writing methods that call other methods inside d3 ember components? 

Let's say I am creating a reusable component in Ember, and I want a helper function that calls another helper function defined within.   For example,
App. SomeCoolComponent = Ember.Component.extend

  offset: 50

  position: (x) -> x * 100

  offsetPosition: # would like (x) -> position(x) + offset

So conceptually, return a function that would evaluate the position at x, add offset, and return value.   Obviously this is a silly example and I could just write offSetPosition without calling position, but in a more complex scenario that is repeating code.   The problem is I can't figure out how to get this to work.   I tried 
  offsetPosition: (x) -> @get('position')(x) + @get('offset')

which fails because @get isn't defined within the function, it has the wrong scope.   I've tried to insert things like Ember.computed in various places also with no luck, e.g. the following also doesn't work:
  offsetPosition: Ember.computed(->
    (x) -> @get('position')(x) + @get('offset')).property('position', 'offset')

What is the correct way of doing this? 
Ember version 1.3.0-beta.1+canary.48513b24.  Thanks in advance! 
Edit: seems like my problem stems from passing the function into a d3 call.   For example:
App. SomeCoolComponent = Ember.Component.extend

  offset: 50

  position: (d, i) -> i * 100

  offsetPosition: (d, i) ->
    @position(d, i) + @get('offset')

  # Some other code not shown

  didInsertElement: ->
    data = [1, 2, 3]
    i = 1
    d = data[i]
    console.log(@position(d, i)) # works
    console.log(@offsetPosition(d, i)) # works

    d3.select('svg').selectAll('circle').data(data).enter().append('circle')
      .attr('cx', @position) # works
      .attr('cy', @offsetPosition) # fails
      .attr('r', 30)

The error message is Uncaught TypeError: Object #<SVGCircleElement> has no method 'position'
Any thoughts on how to resolve this issue? 

A:

The problem is that you are passing a function offsetPosition (which references this and expects it to point to App. SomeCoolComponent) to a D3 callback where this is replaced by the DOMElement. 
You can solve the problem in two ways:

Using the fat arrow syntax:
d3.select('svg').selectAll('circle').data(data).enter().append('circle')
  .attr('cx', @position) # works
  .attr('cy', (d, i) => @offsetPosition(d, i))
  .attr('r', 30)

Using bind explicitly:
d3.select('svg').selectAll('circle').data(data).enter().append('circle')
  .attr('cx', @position) # works
  .attr('cy', @offsetPosition.bind(this))
  .attr('r', 30)

