             @width = @width - @margin.left - @margin.right
             @height = @height - @margin.top - @margin.bottom
 
-        getSvg: ->
-            d3.select(@selector).append('svg')
+        getSvg: (selector) ->
+            d3.select(selector).append('svg')
                 .attr
                     width: @width + @margin.left + @margin.right
                     height: @height + @margin.top + @margin.bottom

$ ->
    class LightCurve
        constructor: (@selector) ->
            @margin =
                top: 20
                right: 20

                d3.scale.linear().range([0, @height]).nice()
            ]

        drawData: (data) ->
            [xScale, yScale] = @getScales()
            xScale.domain d3.extent data, (d) -> d.jd
            yScale.domain d3.extent data, (d) -> d.magnitude
            xAxis = d3.svg.axis().scale(xScale).orient('bottom').ticks(10)
            yAxis = d3.svg.axis().scale(yScale).orient('left').ticks(10)
            @svg.append('g')
                .attr
                    class: 'x axis'
                    transform: "translate(0,#{@height})"
                .call(xAxis.tickSize(-@height, 0, 0))
            @svg.append('g')
                .attr
                    class: 'y axis'
                .call(yAxis.tickSize(-@width, 0, 0))
            @svg.selectAll('circle')
                .data(data)
                .enter()
                .append('circle')
