};
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
<script src="link-interaction.js"></script>
<script src="per-series.js"></script>
<script src="synchronize.js"></script>
+ <script src="range-selector.js"></script>
<!-- These might not remain in the gallery -->
<script src="dygraph-simple.js"></script>
--- /dev/null
+Gallery.register(
+ 'range-selector',
+ {
+ name: 'Range Selector',
+ title: 'Demo of the Range Selector',
+ setup: function(parent) {
+ parent.innerHTML =
+ "<p>No roll period.</p>" +
+ "<div id='noroll' style='width:800px; height:320px;'></div>" +
+ "<p>Roll period of 14 timesteps, custom range selector height and plot color.</p>" +
+ "<div id='roll14' style='width:800px; height:320px;'></div>";
+ },
+ 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'
+ });
+ }
+ });