From 90b71e52161baab2887da92d44c41c79c99129b9 Mon Sep 17 00:00:00 2001 From: Forrest Voight Date: Thu, 18 Oct 2012 00:58:53 -0400 Subject: [PATCH] changed graph switching to use links instead of event handlers. individual views can now be linked to and refresh works. --- web-static/graphs.html | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/web-static/graphs.html b/web-static/graphs.html index ad4f1ca..fc30140 100644 --- a/web-static/graphs.html +++ b/web-static/graphs.html @@ -363,13 +363,17 @@ }); } + periods = ["Hour", "Day", "Week", "Month", "Year"]; + d3.select("#period_chooser").selectAll().data(periods).enter().append("a") + .text(function(period) { return period }) + .attr('href', function(period){ return "?" + period }) + .attr("style", function(d, i) { return (i == 0 ? "" : "margin-left:.4em;") + "color:blue;text-decoration:underline;cursor:pointer" }); + period = window.location.search.substr(1); + if(period == "") { + window.location.search = "Day"; + } d3.json('/web/currency_info', function(currency_info) { - periods = ["Hour", "Day", "Week", "Month", "Year"]; - d3.select("#period_chooser").selectAll().data(periods).enter().append("span") - .text(function(period) { return period }) - .on("click", function(period){ change_period(period, currency_info) }) - .attr("style", function(d, i) { return (i == 0 ? "" : "margin-left:.4em;") + "color:blue;text-decoration:underline;cursor:pointer" }); - change_period(periods[1], currency_info); + change_period(period, currency_info); }); -- 1.7.1