 Epoch.Data.Format ?= {}
 
 # Private Helper Function for DataFormats below
-applyLayerLabel = (layer, options, i) ->
-  [labels, autoLabels] = [options.labels, options.autoLabels]
+applyLayerLabel = (layer, options, i, keys=[]) ->
+  [labels, autoLabels, keyLabels] = [options.labels, options.autoLabels, options.keyLabels]
   if labels? and Epoch.isArray(labels) and labels.length > i
     layer.label = labels[i]
+  else if keyLabels and keys.length > i
+    layer.label = keys[i]
   else if autoLabels
     label = []
     while i >= 0

      formatBasicPlot data, opt
)()


# Formats an input array of tuples such that the first element of the tuple is set
# as the x-coordinate and the second element as the y-coordinate. Supports layers
# of tupled series. For real-time plots the first element of a tuple is set as the

# It then extracts the value for each key across each of the objects in the array
# to produce multi-layer plot data of the given chart type. Note that this formatter
# also can be passed an <code>x</code> or <code>time</code> option as a string that
# allows the programmer specify a key to use for the value of the first component 
# (x or time) of each resulting layer value.
#
# Note that this format does not work with basic pie charts nor real-time gauge charts.
#
# @param [Array] data Flat array of objects to format.
# @param [Array] keys List of keys used to extract data from each of the objects.
