some gadget options
authorDan Vanderkam <danvdk@gmail.com>
Sun, 29 Nov 2009 21:52:24 +0000 (16:52 -0500)
committerDan Vanderkam <danvdk@gmail.com>
Sun, 29 Nov 2009 21:52:24 +0000 (16:52 -0500)
gadget.xml

index 53dee08..885d0ea 100644 (file)
@@ -6,11 +6,11 @@
       description="Interactive, zoomable chart"
       author="Dan Vanderkam"
       author_email="danvdk@gmail.com"
+      thumbnail="http://danvk.org/dygraphs/thumbnail.png"
       >
       <!-- TODO(danvk): change these -->
       <!--
       screenshot="http://www.google.com/ig/modules/simple-table.png"
-      thumbnail="http://www.google.com/ig/modules/simple-table-thm.png">
       -->
     <Require feature="idi" />
     <Require feature="locked-domain" />
     <EnumValue value="300" display_value="5"/>
     <EnumValue value="1800" display_value="30"/>
   </UserPref>
+  <UserPref name="_dg_rollPeriod" display_name="Roll Period" required="false" default_value="1" />
+  <UserPref name="_dg_showRoller" display_name="Show Roller" required="false" default_value="false" datatype="bool" />
+  <UserPref name="_dg_minY" display_name="Min Y Value" required="false" default_value="" />
+  <UserPref name="_dg_maxY" display_name="Max Y Value" required="false" default_value="" />
+  <UserPref name="_dg_kmb" display_name="KMB labels" required="false" default_value="false" datatype="bool" />
   <!--
   This is a sample gadget, that uses the Google Visualization API to read data
   from a data source, and displays it as an html table.
       // Take the data table from the response, and format it.
       // var options = {showRowNumber: true};
       var prefs = new _IG_Prefs(); // User preferences
-      chart.draw(data, {
-      });
+      var showRoller = prefs.getBool("_dg_showRoller");
+      var rollPeriod = prefs.getInt("_dg_rollPeriod");
+      var labelsKMB = prefs.getBool("_dg_kmb");
+      var opts = {
+        showRoller: showRoller,
+        rollPeriod: rollPeriod,
+        labelsKMB: labelsKMB
+      };
+
+      var minY = prefs.getString("_dg_minY");
+      var maxY = prefs.getString("_dg_maxY");
+      if (minY && maxY) {
+        opts.valueRange = [parseInt(minY), parseInt(maxY)];
+      }
+
+      chart.draw(data, opts);
     };
 
   </script>