             .classed('tick-date', (d) -> !(
                 d.getUTCMilliseconds() | d.getUTCSeconds() | d.getUTCMinutes() | d.getUTCHours()
             ))
+
+    drawHighlights: () ->
+        #draw the highlighted interval
+        d3.select(@element).selectAll('.highlight .interval').remove()
+        if @highlightInterval
+            start = @highlightInterval.start
+            end = @highlightInterval.end
+            left = @scales.x(start)
+            width = pixelWidth([start, end], @scales.x)
+            right = left + width
+            height = @options.height - 19
+
+            d3.select(@element).selectAll('.highlight').append('rect')
+                .attr('class', 'interval')
+                .attr('x', left)
+                .attr('width', width)
+                .attr('y', 0)
+                .attr('height', height)
+                .attr('stroke', @highlightInterval.strokeColor)
+                .attr('stroke-width', 1)
+                .attr('fill', @highlightInterval.fillColor)
+            if @highlightInterval.outsideColor
+                if left > 0
+                    d3.select(@element).selectAll('.highlight').append('rect')
+                        .attr('class', 'interval')
+                        .attr('x', 0)
+                        .attr('width', left)
+                        .attr('y', 0)
+                        .attr('height', height)
+                        .attr('fill', @highlightInterval.outsideColor)
+                d3.select(@element).selectAll('.highlight').append('rect')
+                    .attr('class', 'interval')
+                    .attr('x', right)
+                    .attr('width', 2000)
+                    .attr('y', 0)
+                    .attr('height', height)
+                    .attr('fill', @highlightInterval.outsideColor)
 
     # this function triggers the reloading of a dataset (sync)
     reloadDataset: (datasetId, clearCaches = false) ->

            tooltipFormatter: @tooltipFormatter,
            binTooltipFormatter: @binTooltipFormatter

        # TODO: apply margin?
        [ start, end ] = @scales.x.domain()

        # repaint the datasets
        # First paint lines and ticks
        for datasetId of @datasets

                    s = new Date(s.getTime()-(d/2))
                    e = new Date(e.getTime()+(d/2))
                    [low, high] = @scales.x.domain()
                    if @options.displayLimit != null and
                       (e - s) > @options.displayLimit * 1000
                        [s, e] = @scales.x.domain()
                    @center(s,e)
