4 <title>Palette Demo
</title>
5 <script type=
"text/javascript" src=
"jquery-1.8.3.min.js"></script>
6 <script type=
"text/javascript" src=
"../../dygraph-dev.js"></script>
7 <script type=
"text/javascript" src=
"options.js"></script>
8 <script type=
"text/javascript" src=
"../../common/textarea.js"></script>
9 <script type=
"text/javascript" src=
"tooltip.js"></script>
10 <script type=
"text/javascript" src=
"palette.js"></script>
11 <script type=
"text/javascript" src=
"multi-palette.js"></script>
12 <script type=
"text/javascript" src=
"samples.js"></script>
13 <script type=
"text/javascript" src=
"index.js"></script>
14 <link rel=
"stylesheet" type=
"text/css" href=
"index.css" />
18 <div style=
"font-size:smaller;"><p>To configure this chart, tweak the values on the right.
19 Enter applies changes, and the filter bar on the top reduces selections
</p></div>
26 <div id=
"graph"></div>
27 <div id=
"status" style=
"width:200px; font-size:0.8em; padding-top:5px;"></div>
28 <div class=
"instructions">
29 <a id=
"toggleInstructions">instructions
</a>
30 <div id=
"instructions" style=
"display: none">
31 <h3>Learn By Doing
</h3>
33 <li>In the filter box, type
<code>point
</code>.
</li>
34 <li>Click the
<em>drawPoints
</em> toggle button until
<code>true
</code> appears
</li>
35 <li>You will see dots on the graph where points exist.
</li>
36 <li>In the
<em>pointSize
</em> text box, enter
<code>5</code></li>
37 <li>Press
<code>enter
</code> or click
<em>Refresh
</em>. The dots
39 <li>Type
<code>callback
</code> in the filter box.
</li>
40 <li>Instead of a text box, you will see buttons that can be used
41 to define callbacks. Click the button for
<em>clickCallback
</em>.
</li>
42 <li>You will see that the prototype function body is
43 <code>function(e, x, points){ }
</code>. Paste in this
44 replacement function:
<p/>
45 <code>function(e, x){
<br/> var elem =
46 document.getElementById(
"messages");
<br/> elem.innerHTML =
47 elem.innerHTML + x +
"<br>";
<br/>}
</code></li>
48 <li>Click the
<em>OK
</em> button. The
<em>clickCallback
</em>
49 button now says
<code>defined
</code> instead of
<code>not defined
</code>.
</li>
50 <li>Click anywhere on the graph. The x-value will appear on the
52 <li>If you click directly on a point, then an alert box will
53 indicate that you've clicked on a point. That's because the
54 <em>pointClickCallback
</em> was defined already.
</li>
55 <li><b>Have fun and send feedback!
</b></li>
58 The palette on the right contains (most) Dygraphs options. Here's
61 <li>The selection box on top can be used to choose your own data source.
</li>
62 <li>Use the filter box to constrain your selection. For instance,
63 typing
<code>draw
</code> will show all options with that phrase in
65 <li>Each field has specific types. The types are not documented,
66 but if you hover over an entry (or click on it) it will give you a
68 <li>Enter a new value for the option, and hit the
69 <code>enter
</code> key, or the
<em>Refresh
</em> button.
</li>
70 <li>Some types require special consideration:
71 <li>integers, floats, strings and booleans can be entered
73 <li>arrays of elements can be comma-separated
<em>except string
74 arrays, which are (at the moment) semicolon-separated (anyone
75 interested in making a good string array parser, take a shot.
</em></li>
76 <li>Callbacks are defined in a (crappy tiny) dialog box. If the
77 function isn't defined, then a prototype of the function will be
78 presented to the user.
</li>
82 Then in the filter text box, type
"point". Set drawPoints: true and
88 <td valign=
"top"><div id=
"optionsPalette"></div></td>
92 <script type=
"text/javascript">
95 $(
"#toggleInstructions").click(function() {
96 $(
"#instructions").toggle(
500);