Custom circle tweaks:
[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) {
605b6119 7 parent.innerHTML = [
10eef8e9
RK
8 "<div id='stock_div' style='width: 600px; height: 300px;'></div><br/>",
9 "<div style='width: 600px; text-align: center;'>",
605b6119
RK
10 " <button id='linear'>Linear Scale</button>&nbsp;",
11 " <button id='log' disabled='true'>Log Scale</button>",
12 "</div>"].join("\n");
3381d8fa
RK
13 },
14 run: function() {
3c10a0f3 15 var g = new Dygraph(document.getElementById("stock_div"), stockData,
3381d8fa
RK
16 {
17 customBars: true,
18 logscale: true
19 });
20
3c10a0f3
RK
21 var linear = document.getElementById("linear");
22 var log = document.getElementById("log");
23 linear.onclick = function() { setLog(false); }
24 log.onclick = function() { setLog(true); }
25 var setLog = function(val) {
3381d8fa 26 g.updateOptions({ logscale: val });
3c10a0f3
RK
27 linear.disabled = !val;
28 log.disabled = val;
3381d8fa
RK
29 }
30 }
31 });