add grid color and dot size parameters
authorDan Vanderkam <danvdk@gmail.com>
Thu, 3 Sep 2009 06:31:41 +0000 (06:31 +0000)
committerDan Vanderkam <danvdk@gmail.com>
Thu, 3 Sep 2009 06:31:41 +0000 (06:31 +0000)
dygraph.js
tests/grid_dot.html [new file with mode: 0644]

index 53a7272..4f5eca5 100644 (file)
@@ -75,6 +75,7 @@ DateGraph.AXIS_LINE_WIDTH = 0.3;
 
 // Default attribute values.
 DateGraph.DEFAULT_ATTRS = {
+  highlightCircleSize: 3,
   pixelsPerXLabel: 60,
   labelsDivWidth: 250,
   labelsDivStyles: {
@@ -498,7 +499,7 @@ DateGraph.prototype.mouseMove_ = function(event) {
   }
 
   // Clear the previously drawn vertical, if there is one
-  var circleSize = 3;
+  var circleSize = this.attrs_.highlightCircleSize;
   var ctx = this.canvas_.getContext("2d");
   if (this.previousVerticalX_ >= 0) {
     var px = this.previousVerticalX_;
diff --git a/tests/grid_dot.html b/tests/grid_dot.html
new file mode 100644 (file)
index 0000000..789b7aa
--- /dev/null
@@ -0,0 +1,34 @@
+<html>
+  <head>
+    <title>Custom grid and Dot</title>
+    <!--[if IE]>
+    <script type="text/javascript" src="excanvas.js"></script>
+    <![endif]-->
+    <script type="text/javascript" src="../dygraph-combined.js"></script>
+    <script type="text/javascript" src="../dygraph.js"></script>
+    <script type="text/javascript" src="data.js"></script>
+  </head>
+  <body>
+    <p>Dot and lines should be extra large. Grid is red.</p>
+    <div id="g14" style="width:600px; height:300px;"></div>
+
+    <script type="text/javascript">
+      g14 = new DateGraph(
+            document.getElementById("g14"),
+            NoisyData, null, {
+              rollPeriod: 14,
+              errorBars: true,
+              gridLineColor: MochiKit.Color.Color.redColor(),
+              highlightCircleSize: 10,
+              strokeWidth: 3,
+              padding: {
+                left: 40,
+                top: 0,
+                right: 10,
+                bottom: 10
+              }
+            }
+          );
+    </script>
+  </body>
+</html>