Fix drawing.js bug
[dygraphs.git] / gallery / stock.js
CommitLineData
3381d8fa
RK
1Gallery.register(
2 'stock',
3 {
4 name: 'Stock Chart Demo',
5 title: 'Stock Chart Demo',
6 setup: function(parent) {
7 parent.innerHTML = "<div id='stock_div' style='width: 800px; height: 400px;'></div><br/>" +
8 "<div style='width: 800px; text-align: center;'>" +
3c10a0f3
RK
9 "<button id='linear'>Linear Scale</button>&nbsp;" +
10 "<button id='log' disabled='true'>Log Scale</button>" +
3381d8fa
RK
11 "</div>";
12 },
13 run: function() {
3c10a0f3 14 var g = new Dygraph(document.getElementById("stock_div"), stockData,
3381d8fa
RK
15 {
16 customBars: true,
17 logscale: true
18 });
19
3c10a0f3
RK
20 var linear = document.getElementById("linear");
21 var log = document.getElementById("log");
22 linear.onclick = function() { setLog(false); }
23 log.onclick = function() { setLog(true); }
24 var setLog = function(val) {
3381d8fa 25 g.updateOptions({ logscale: val });
3c10a0f3
RK
26 linear.disabled = !val;
27 log.disabled = val;
3381d8fa
RK
28 }
29 }
30 });