From: Robert Konigsberg Date: Sun, 15 Jan 2012 15:57:12 +0000 (-0500) Subject: Add range-selector X-Git-Tag: v1.0.0~320^2~21 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=72c8bf9993215da78476fa918af09e12b297a34c;p=dygraphs.git Add range-selector --- diff --git a/gallery/gallery.js b/gallery/gallery.js index dc50813..10128ff 100644 --- a/gallery/gallery.js +++ b/gallery/gallery.js @@ -70,7 +70,9 @@ Gallery.register = function(id, demo) { }; Gallery.hashChange = function(event) { - var id = location.hash.substring(1) + "-toc"; - var elem = document.getElementById(id); - elem.onclick(); + if (location.hash) { + var id = location.hash.substring(1) + "-toc"; + var elem = document.getElementById(id); + elem.onclick(); + } }; \ No newline at end of file diff --git a/gallery/index.html b/gallery/index.html index af021e5..13d6ab0 100644 --- a/gallery/index.html +++ b/gallery/index.html @@ -22,6 +22,7 @@ + diff --git a/gallery/range-selector.js b/gallery/range-selector.js new file mode 100644 index 0000000..4d9a82a --- /dev/null +++ b/gallery/range-selector.js @@ -0,0 +1,43 @@ +Gallery.register( + 'range-selector', + { + name: 'Range Selector', + title: 'Demo of the Range Selector', + setup: function(parent) { + parent.innerHTML = + "

No roll period.

" + + "
" + + "

Roll period of 14 timesteps, custom range selector height and plot color.

" + + "
"; + }, + run: function() { + g1 = new Dygraph( + document.getElementById("noroll"), + data_temp, + { + customBars: true, + title: 'Daily Temperatures in New York vs. San Francisco', + ylabel: 'Temperature (F)', + legend: 'always', + labelsDivStyles: { 'textAlign': 'right' }, + showRangeSelector: true + } + ); + g2 = new Dygraph( + document.getElementById("roll14"), + data_temp, + { + rollPeriod: 14, + showRoller: true, + customBars: true, + title: 'Daily Temperatures in New York vs. San Francisco', + ylabel: 'Temperature (F)', + legend: 'always', + labelsDivStyles: { 'textAlign': 'right' }, + showRangeSelector: true, + rangeSelectorHeight: 30, + rangeSelectorPlotStrokeColor: 'yellow', + rangeSelectorPlotFillColor: 'lightyellow' + }); + } + });