diff options
author | Arun Persaud <arun@nubati.net> | 2012-01-23 23:58:53 -0800 |
---|---|---|
committer | Arun Persaud <apersaud@lbl.gov> | 2012-01-24 00:00:06 -0800 |
commit | 8a26a320c6804949a140cc0b62de507c1d19f345 (patch) | |
tree | 1351672551c7383d0429f935cb9c42635fea24a0 /index.php | |
parent | 79761af3ff298c01b9892a3f7e6cd94a325b9005 (diff) | |
download | photo-tags-8a26a320c6804949a140cc0b62de507c1d19f345.tar.gz photo-tags-8a26a320c6804949a140cc0b62de507c1d19f345.tar.bz2 photo-tags-8a26a320c6804949a140cc0b62de507c1d19f345.zip |
added a tag cloud
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -55,6 +55,7 @@ else </datalist> </form> Current tags:<span id="currenttags"></span> + <button class="next" type="button" onclick="cloud()">tag cloud</button> </div> <div class="pics"> </div> @@ -180,6 +181,26 @@ function right() { load_content(page); } +function cloud() { + + url = "<?php echo $webbase?>/getjson.php?CLOUD=1"; + + pics.selectAll("li").remove(); + + var svgelement=pics.append("li") + .append("svg").attr("width",400).attr("height",400); + + /* update pics */ + d3.json(url, function(json) { + svgelement.selectAll("text").data(json).enter().append("text") + .style("font-size", function(d){return Math.log(d.count+1)+"em"}) + .text(function(d) { return d.name; }) + .on("mouseover", function(d){ d3.select(this).style("color","red")} ) + .on("mouseout", function(d){ d3.select(this).style("color","white")} ) + .on("click", function(d) { document.location.href='<?php echo $webbase?>/tag/'+d.name }) + }); +} + function checkbutton() { |