From 189f80303921bdd511720934763b5bbc14914756 Mon Sep 17 00:00:00 2001
From: Dan Vanderkam <dan@dygraphs.com>
Date: Thu, 5 Jul 2012 20:58:30 -0700
Subject: [PATCH] running into some issues with ordering

---
 dygraph.js      | 11 +++++------
 plugins/README  |  7 +++++++
 tests/demo.html |  3 ++-
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/dygraph.js b/dygraph.js
index aea8830..4f6b41b 100644
--- a/dygraph.js
+++ b/dygraph.js
@@ -1128,7 +1128,7 @@ Dygraph.prototype.getPropertiesForSeries = function(series_name) {
     name: series_name,
     column: idx,
     visible: this.visibility()[idx - 1],
-    color: this.plotter_.colors[series_name],
+    color: this.colorsMap_[series_name],
     axis: 1 + this.seriesToAxisMap_[series_name]
   };
 };
@@ -2341,6 +2341,10 @@ Dygraph.prototype.renderGraph_ = function(is_initial_draw) {
   this.cascadeEvents_('clearChart');
   this.plotter_.clear();
 
+  this.cascadeEvents_('drawChart', {
+    canvas: this.hidden_,
+    drawingContext: this.hidden_ctx_,
+  });
   this.plotter_.render();
 
   // TODO(danvk): is this a performance bottleneck when panning?
@@ -2353,11 +2357,6 @@ Dygraph.prototype.renderGraph_ = function(is_initial_draw) {
   if (this.rangeSelector_) {
     this.rangeSelector_.renderInteractiveLayer();
   }
-
-  this.cascadeEvents_('drawChart', {
-    canvas: this.hidden_,
-    drawingContext: this.hidden_ctx_,
-  });
   if (this.attr_("drawCallback") !== null) {
     this.attr_("drawCallback")(this, is_initial_draw);
   }
diff --git a/plugins/README b/plugins/README
index 7956d55..f216545 100644
--- a/plugins/README
+++ b/plugins/README
@@ -99,8 +99,15 @@ Plugin Events Reference:
 - select
 - deselect
 
+TODO(danvk): document all event properties for each event.
+
+
 Special methods:
 - (constructor)
 - activate
 - destroy
 
+
+----------------
+
+Notes on plugin registration and event cascade ordering/behavior.
diff --git a/tests/demo.html b/tests/demo.html
index 6435ca1..94582dc 100644
--- a/tests/demo.html
+++ b/tests/demo.html
@@ -48,7 +48,8 @@
                 xlabel: 'Date',
                 ylabel: 'Count',
                 axisLineColor: 'white',
-                drawXGrid: false
+                gridLineWidth: 10
+                // drawXGrid: false
               }
           );
     </script>
-- 
2.7.4