             r.exit().remove()
 
             # points
+            el.selectAll('circle').remove()
             p = el.selectAll('circle')
                 .data(d.points)
+                .remove()
 
             p.enter().append('circle')
                     .attr('cx', (d) => @scales.x(d))

        @axis =
            x: d3.svg.axis()
                .scale(@scales.x)
                .ticks(d3.time.days.utc, 3)
                #.tickFormat(d3.time.format("%Y-%m-%d"))

        @root.append('g')
            .attr('class', 'axis')
            .call(@axis.x)

        # Compute the height of the x axis
        @options.xAxisHeight = Math.ceil(@root.select('g.axis')[0][0].getBoundingClientRect().height)
        d3.select(@element).select('g.axis')
            .attr('transform', "translate(0, #{@options.height - @options.xAxisHeight})")

       # grid
        @grid =
            x: d3.svg.axis()
                .scale(@scales.x)
                .ticks(d3.time.days.utc, 1)
                .tickFormat('')
                .tickSize(-@options.height + @options.xAxisHeight, 0, 0)

        @root.append('g')
            .attr('class', 'grid')
            .attr('width', @options.width)
            .attr('transform', "translate(0, #{@options.height - @options.xAxisHeight})")
            .call(@grid.x)

        # datasets
        @root.append('g')

                ranges: []
            }

            @updateDataset(dataset.id)

        @updateDataset = (dataset) =>
            console.log "Updating dataset #{dataset}"

            el = @root.select("g.datasets #dataset-#{dataset}")
            d = @data[dataset]

            # update data
            d.ranges = []
            d.points = []
            for data in d.callback()
                if(data.length > 1)
                    d.ranges.push data
                else
                    d.points.push data[0]

            lineFunction = d3.svg.line()
                .x( (d) => @scales.x(d) )
                .y( 5 * d.index )
                .interpolate('linear')

            # ranges
            el.selectAll('path').remove()
            r = el.selectAll('path')
                .data(d.ranges)

