From c45adf16fa3c26f01e9d45324c6bd3c1cf4f97f5 Mon Sep 17 00:00:00 2001 From: Wesley Moore Date: Tue, 21 Sep 2010 18:00:15 +1000 Subject: [PATCH] Add buttons to show different time ranges --- output/js/weather.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/output/js/weather.js b/output/js/weather.js index d53ed9b..e81399b 100644 --- a/output/js/weather.js +++ b/output/js/weather.js @@ -33,6 +33,41 @@ jQuery(function() { }; jQuery.plot(self, data.history, options); + + + $("#year").click(function () { + $.plot(self, data.history, { + xaxis: { + mode: "time", + minTickSize: [1, "month"] //, + // min: (new Date("1990/01/01")).getTime(), + // max: (new Date()).getTime() + } + + }); + }); + + $("#month").click(function () { + $.plot(self, data.history, { + xaxis: { + mode: "time", + min: (new Date("2010/08/21")).getTime(), + max: (new Date()).getTime() + } + }); + }); + + $("#day").click(function () { + $.plot(self, data.history, { + xaxis: { + mode: "time", + min: (new Date("2010/09/21 00:00")).getTime(), + max: (new Date()).getTime() + } + }); + }); + }); + }); });