         if not dataset
             return
 
-        records = dataset.getRecords()
+        [low, high] = @scales.x.domain()
+
+        records = (dataset.getRecords() || [])
+            .filter((r) -> r[0] <= high and r[1] >= low)
         paths = dataset.getPaths()
         index = dataset.index
         color = dataset.color
 
         if paths and paths.length
             @drawPaths(dataset.element, dataset, paths)
-        else if records and records.length
-            data = records.map((record) =>
-                new Date(record[0] + (record[1] - record[0]) / 2)
-            )
-            if dataset.histogram
+        else
+            if dataset.histogramThreshold? and records.length >= dataset.histogramThreshold
+                dataset.element.selectAll('.record').remove()
+                data = records.map((record) =>
+                    new Date(record[0] + (record[1] - record[0]) / 2)
+                )
                 @drawHistogram(dataset.element, dataset, records)
             else
+                dataset.element.selectAll('.bin').remove()
                 points = records.filter((record) =>
                     (@scales.x(new Date(record[1])) - @scales.x(new Date(record[0]))) < 5
                 )

        )

    drawRanges: (datasetElement, dataset, records) ->
        datasetElement.selectAll('rect').remove()

        r = datasetElement.selectAll('rect')
            .data(records)

        r.enter().append('rect')
            .attr('x', (record) => @scales.x(new Date(record[0])) )
            .attr('y', - (@options.ticksize + 3) * dataset.index + -(@options.ticksize-2) )
            .attr('width', (record) => @scales.x(new Date(record[1])) - @scales.x(new Date(record[0])) )
            .attr('height', (@options.ticksize-2))
            .attr('stroke', d3.rgb(dataset.color).darker())
            .attr('stroke-width', 1)
            .call((recordElement) => @setupRecord(recordElement, dataset))

        r.exit().remove()

    drawPoints: (datasetElement, dataset, records) ->
        datasetElement.selectAll('circle').remove()
        p = datasetElement.selectAll('circle')
            .data(records)

        p.enter().append('circle')
            .attr('cx', (a) =>
                if Array.isArray(a)
                    return @scales.x(new Date(a[0]))
                else
                    return @scales.x(new Date(a))
            )
            .attr('cy', - (@options.ticksize + 3) * dataset.index - (@options.ticksize - 2) / 2)
            .attr('stroke', d3.rgb(dataset.color).darker())
            .attr('stroke-width', 1)
            .attr('r', @options.ticksize / 2)
            .call((recordElement) => @setupRecord(recordElement, dataset))

        p.exit().remove()

            debounceTime: @options.debounce,
            ordinal: @ordinal,
            element: element,
            histogramThreshold: definition.histogramThreshold
        })

        @reloadDataset(id)
