         # the DC charts, the padding must be expressed in the same unit domains
         # as the data being charted.
         #
-        # @param dat the scatterplot data
+        # @param data the scatterplot data
         # @param choices the valid data types for the current collection
         # @returns the chart padding for each data type
-        calculatePadding: (dat, choices) ->
+        calculatePadding: (data, choices) ->
           padding = new Object
           # Iterate over the data types.
+          #
+          # TODO - What does 'data type' mean here?
+          #
+          # FIXME - this breaks if data is empty. Present an alert
+          #   in that case. Can this occur in practice?
+          #
+          # TODO - rename function to chartPadding. Then, make a function to
+          #   get the item padding and collect the iteration result into an
+          #   object using the functional programming reduce idiom, e.g.:
+          #     chartPadding: (data, choices) ->
+          #       dataTypePadding = (key) -> ...
+          #       addDataTypePadding = (obj, key) ->
+          #         obj[key] = dataTypePadding(key)
+          #         obj
+          #     # Return the {data type: padding} object
+          #     choices.reduce(addDataTypePadding, key, {})
           for key of choices
-            max = _.maxBy(dat, (o) -> o[key])[key]
-            min = _.minBy(dat, (o) -> o[key])[key]
+            values = _.map(data, key)
+            max = _.max(values)
+            min = _.min(values)
             diff = max - min
-            # If the values are not all the same, calculate a padding value
-            # based the chart layout parameter setting, e.g. a setting of .2
-            # will give the chart 20% padding.
-            #
-            # If the values are all the same, calculate a padding value of an
-            # appropriate resolution for that value. The initial result value
-            # reflects the number of digits or decimal places of the
-            # scatterplot values. Each chart tick mark above and below that
-            # value is then set to 10 to the power of the result reduced by 1.
-            if diff != 0
-              pad = diff * CHART_LAYOUT_PARAMS.corrChartPadding
-            else
+            # The padding is determined as follows:
+            # * If the values are all the same, then calculate a padding value of
+            #   an appropriate resolution for that value. The initial result value
+            #   reflects the number of digits or decimal places of the
+            #   scatterplot values. Each chart tick mark above and below that
+            #   value is then set to 10 to the power of the result reduced by 1.
+            # * Otherwise, calculate a padding value based the chart layout
+            #   parameter setting, e.g. a setting of .2 will give the chart 20%
+            #   padding.
+            if diff == 0
               max = Math.abs max
               result = Math.ceil(Math.log(max) / Math.log(10))
               if Math.abs(result) is Infinity then result = 0
               pad = CHART_LAYOUT_PARAMS.ticks / 2 * Math.pow(10, result - 1)
+            else
               # Add the padding for the data type to the object.
+              pad = diff * CHART_LAYOUT_PARAMS.corrChartPadding
             padding[key] = pad
           # Return the padding object.
           padding

                  null
          'grb7':
              label: 'GRB7 Normalized Assay'
              coll: [
                'Breast'
              ]
              accessor: (tumor) ->

                  null
          'gstm1':
              label: 'GSTM1 Normalized Assay'
              collection: [
                'Breast'
              ]
              accessor: (tumor) ->
