Whitespace
authorDavid Schoonover <dsc@wikimedia.org>
Wed, 27 Jun 2012 17:16:56 +0000 (10:16 -0700)
committerDavid Schoonover <dsc@wikimedia.org>
Wed, 27 Jun 2012 17:16:56 +0000 (10:16 -0700)
1  2 
lib/chart/type/d3-chart.co

@@@ -28,11 -31,10 +31,10 @@@ class exports.D3ChartType extends Chart
          legend   : '.graph-legend'
      
      
-     # constructor: function D3ChartType
-     -> super ...
      
+     -> super ...
      
 -        
 +    
      getData: ->
          @model.dataset.getColumns()
      
@@@ -61,7 -63,7 +63,7 @@@
          # Calculate extents using all the data points (but not dates)
          # allValues = d3.merge @model.dataset.getDataColumns()
          allValues = d3.merge cols
--                
++        
          # Update the x-scale with the extents of the dates.
          xScale
              .domain d3.extent dates
          xAxis = d3.svg.axis().scale(xScale).orient("bottom").tickSize(6, 0)
          frame.select ".x.axis.time"
              .attr "transform", "translate(0,#{yScale.range()[0]})"
 -            .call xAxis        
 -             
 -
 -
 +            .call xAxis
 +        
+         # this is wrong. should work using d3 datajoins.
+         # i.e. use the enter/exit function to add/remove
+         # metrics from the graph
          for i,metric in @model.dataset.metrics.models
              # metric defined charttype
-             chartType = metric.get "chartType"
 -            chartElement = metric.get "chartElement"            
++            chartElement = metric.get "chartElement"
              # otherwise the graph defined charttype
              # FOR NOW take line as default
-             chartType or= 'd3-line' # @model.get "chartType"
-             
-             # create d3 charttype and render it
-             model = ChartType.create chartType
-             model.renderChartType metric, frame ,xScale, yScale
-         
+             chartElement ?= 'd3-line' # @model.get "chartType"
+                     
+             # create d3 chart element and render it
 -            chEl = D3ChartElement.create chartElement     
 -            console.log chEl         
++            chEl = D3ChartElement.create chartElement
++            console.log chEl
+             chEl.renderChartElement metric, frame ,xScale, yScale
 -
          
          svg