     scale = d3.time.scale().domain(domain).range(range)
     return scale
 
-class BarRendererView extends PlotWidget
+
+
+class XYRendererView extends PlotWidget
   initialize : (options) ->
     safebind(this, @model, 'change', @request_render)
     safebind(this, @mget_ref('xmapper'), 'change', @request_render)

        @plot_view.ctx.fillRect(0, left_points[i], value_pos(heights[i]), thickness)
    
    @plot_view.ctx.stroke()
    node
      .attr('stroke', @mget('foreground_color'))
      .attr('fill', @mget('foreground_color'))
    return null

  tagName : 'g'

  render : () ->
    super()
    node = d3.select(@el)
    bars = node.selectAll('rect').data(@model.get_ref('data_source').get('data'))
    @render_bars(bars, @mget('orientation'))
    @render_bars(bars.enter().append('rect'), @mget('orientation'))
    @render_end()
    return null


class XYRendererView extends PlotWidget
  initialize : (options) ->
    safebind(this, @model, 'change', @request_render)
    safebind(this, @mget_ref('xmapper'), 'change', @request_render)
    safebind(this, @mget_ref('ymapper'), 'change', @request_render)
    safebind(this, @mget_ref('data_source'), 'change:data', @request_render)
    super(options)


  calc_buffer : (data) ->
    "use strict";
    xmapper = @model.get_ref('xmapper')
    ymapper = @model.get_ref('ymapper')
    xfield = @model.get('xfield')
    yfield = @model.get('yfield')
    datax = (x[xfield] for x in data)
    screenx = xmapper.v_map_screen(datax)
    screenx = @model.v_xpos(screenx)
    datay = (y[yfield] for y in data)
    screeny = ymapper.v_map_screen(datay)
    screeny = @model.v_ypos(screeny)
    #fix me figure out how to feature test for this so it doesn't use
    #typed arrays for browsers that don't support that

    @screeny = new Float32Array(screeny)
    @screenx = new Float32Array(screenx)
    #@screenx = screenx
    #@screeny = screeny


class LineRendererView extends XYRendererView

    if not _.isObject(index_field)
      index_field = {'field' : index_field}
    data_source = @mget_ref('data_source')

    if _.has(index_field, index_dimension)
      thickness = index_field[index_dimension]
