     me.id = () ->
       return _containerId
 
-    _genChart = ()->
+    _genChartFrame = ()->
       _svg = _elementSelection.append('div').attr('class', 'd3-chart')
         .append('svg')
       _svg.append('defs').append('clipPath').attr('id', "clip-#{_containerId}").append('rect')
       _container= _svg.append('g').attr('class','d3-chart-container')
-      _container.append('g').attr('class', 'x axis top')
-      _container.append('g').attr('class', 'x axis bottom')
-      _container.append('g').attr('class', 'y axis left')
-      _container.append('g').attr('class', 'y axis right')
-      _container.append('g').attr('class', 'x label top')
-      _container.append('g').attr('class', 'x label bottom')
-      _container.append('g').attr('class', 'y label left')
-      _container.append('g').attr('class', 'y label right')
       _chartArea = _container.append('g').attr('class', 'chartArea')
       _overlay= _chartArea.append('rect').attr('class', 'overlay').style({opacity: 0, 'pointer-events': 'none'})
       _container.append('g').attr('class', 'brushArea')
-      #_tooltip.behavior(_overlay)
+
+    _getAxis = (orient) ->
+      axis = _container.select(".axis.#{orient}")
+      if axis.empty()
+        axis = _container.append('g').attr('class',"axis #{orient}")
+      if orient is 'bottom'
+        axis.attr('transform', (d) -> "translate(0, #{_innerHeight})")
+      if orient is 'right'
+        axis.attr('transform', (d) -> "translate(#{_innerWidth}, 0)")
+      return axis
+
+    _removeAxis = (orient) ->
+      _container.select(".axis.#{orient}").remove()
+
+    _getLabel = (orient) ->
+      label = _container.select(".label.#{orient}")
+      if label.empty()
+        label = _container.append('g').attr('class',"label #{orient}")
+      switch orient
+        when 'top'
+          label.attr('transform', (d) -> "translate(#{_innerWidth/2}, #{-_margin.top})")
+        when 'bottom'
+          label.attr('transform', (d) -> "translate(#{_innerWidth/2},#{_innerHeight+_margin.bottom})")
+        when 'left'
+          label.attr('transform', (d) -> "translate(#{-_margin.left},#{_innerHeight/2})rotate(-90)")
+        when 'right'
+          label.attr('transform', (d) ->"translate(#{_innerWidth+_margin.right},#{_innerHeight/2})rotate(90)")
+      return label
+
+    _removeLabel = (orient) ->
+      _container.select(".label.#{orient}").remove()
 
     me.addLayout = (layout) ->
       _layouts.push(layout)

      _innerHeight = bounds.height - _margin.top - _margin.bottom
      _svg.select("#clip-#{_containerId} rect").attr('width', _innerWidth).attr('height', _innerHeight)
      _spacedContainer = _container.attr('transform', (d) -> "translate(#{_margin.left}, #{_margin.top})")
      _spacedContainer.select('.bottom').attr('transform', (d) -> "translate(0, #{_innerHeight})")
      _spacedContainer.select('.right').attr('transform', (d) -> "translate(#{_innerWidth}, 0)")
      _spacedContainer.select('.chartArea').style('clip-path', "url(#clip-#{_containerId})")
      _spacedContainer.select('.x.label.top').attr('transform', (d) -> "translate(#{_innerWidth/2}, #{-_margin.top})")
      _spacedContainer.select('.x.label.bottom').attr('transform', (d) -> "translate(#{_innerWidth/2},#{_innerHeight+_margin.bottom})")
      _spacedContainer.select('.y.label.left').attr('transform', (d) -> "translate(#{-_margin.left},#{_innerHeight/2})rotate(-90)")
      _spacedContainer.select('.y.label.right').attr('transform', (d) ->"translate(#{_innerWidth+_margin.right},#{_innerHeight/2})rotate(90)")
      _overlay = _spacedContainer.select('.overlay').attr('width', _innerWidth).attr('height', _innerHeight)
      return me

    me.element = (elem) ->

        if _elementSelection.empty()
          $log.error "Error: Element #{_element} does not exist"
        else
          _genChartFrame()
        return me

    me.height = () ->
