 
     setBinTooltipFormatter: (@binTooltipFormatter) ->
 
+    setHighlightInterval: (start, end, fillColor, strokeColor, outsideColor) ->
+      if start and end
+          @highlightInterval =
+              start: start
+              end: end
+              fillColor: fillColor
+              strokeColor: strokeColor
+              outsideColor: outsideColor
+      else
+          @highlightInterval = null
+
+      @redraw()
+
 
 # Interface for a source
 class Source

            tooltipFormatter: @tooltipFormatter,
            binTooltipFormatter: @binTooltipFormatter

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

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

            .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) ->
