Hmm, that makes sense, about the accessors not yet being available. Slowly I’m getting the feel for how Ember models stuff. And thanks for all the resources… lot’s of homework to do : )
This is probably not a complete match, but it started clicking for me when I thought of js’s prototype as ruby’s singleton class, where class methods live… And ember’s extend() as a Class.new.
In the end I did something similar to what you suggested, separating the data part from Graph and making it a property of the graph controller. Then I pass it to graph after creating the instance. This works
App.Graph = Ember.Object.extend
series: null
initialize: (data)->
series = [{ data: data }]
@set('series', series)
App.GraphController = Ember.ObjectController.extend
data:
json = ...
json.map (a) ->
...
[date, somevalue]
render: ->
graph = App.Graph.create()
graph.initialize(@data())
new Highcharts.Chart(graph)
App.GraphView = Ember.View.extend
didInsertElement: ->
graph = new App.GraphController()
graph.render()