Fix bug 428, add test which catches exception. What an annoying little bug.
[dygraphs.git] / dygraph.js
index eba57db..8e06ba2 100644 (file)
@@ -3500,9 +3500,12 @@ Dygraph.prototype.annotations = function() {
 /**
  * Get the list of label names for this graph. The first column is the
  * x-axis, so the data series names start at index 1.
+ *
+ * Returns null when labels have not yet been defined.
  */
 Dygraph.prototype.getLabels = function() {
-  return this.attr_("labels").slice();
+  var labels = this.attr_("labels");
+  return labels ? labels.slice() : null;
 };
 
 /**