diff options
Diffstat (limited to 'web/viewsjs')
-rw-r--r-- | web/viewsjs/key.js.erb | 38 | ||||
-rw-r--r-- | web/viewsjs/reports/frequently_used_keys_without_wiki_page.js.erb | 6 | ||||
-rw-r--r-- | web/viewsjs/taginfo/i18n.js.erb | 6 |
3 files changed, 50 insertions, 0 deletions
diff --git a/web/viewsjs/key.js.erb b/web/viewsjs/key.js.erb index e83bbdd..e8db21f 100644 --- a/web/viewsjs/key.js.erb +++ b/web/viewsjs/key.js.erb @@ -145,6 +145,44 @@ var create_flexigrid_for = { } }; +function create_chart(params) { + var y = 0; + params.data.forEach(function(d) { + d['y'] = y; + y += d['count']; + }); + + var scale = d3.scale.linear() + .domain([0, params.max]) + .range([0, params.height]); + + var color = d3.scale.ordinal() + .range(d3_colors()); + + var chart = d3.select('#canvas-values').append('svg') + .attr("width", params.width) + .attr("height", params.height); + + chart.selectAll("rect") + .data(params.data) + .enter() + .append("svg:a") + .attr('xlink:href', function(d) { return url_for_tag(params.key, d['value']); }) + .attr('transform', function(d) { return 'translate(10, ' + scale(d['y']) + ')'; }) + .call(function(c) { + c.append("rect") + .attr('width', 20) + .attr('height', function(d) { return scale(d['count']); }) + .style('fill', function(d, i) { return color(i); }); + }) + .append("text") + .attr('x', 25) + .attr('y', function(d) { return scale(d['count'] / 2); }) + .attr('dy', '0.5em') + .text(function(d) { return d['value']; }); + +} + function page_init() { jQuery('#josm_button').bind('click', function() { jQuery('#josmiframe')[0].src = jQuery('#josm_button')[0].href; diff --git a/web/viewsjs/reports/frequently_used_keys_without_wiki_page.js.erb b/web/viewsjs/reports/frequently_used_keys_without_wiki_page.js.erb index a31bb0d..680ba5d 100644 --- a/web/viewsjs/reports/frequently_used_keys_without_wiki_page.js.erb +++ b/web/viewsjs/reports/frequently_used_keys_without_wiki_page.js.erb @@ -37,4 +37,10 @@ function create_flexigrid_with_option(english) { function page_init() { page_init2(); + jQuery('#english').bind('click', function() { + jQuery('#grid-keys').flexOptions({ + url: '/api/4/keys/without_wiki_page?english=' + (jQuery('#english')[0].checked ? '1' : '0') + }); + jQuery('#grid-keys').flexReload(); + }); } diff --git a/web/viewsjs/taginfo/i18n.js.erb b/web/viewsjs/taginfo/i18n.js.erb new file mode 100644 index 0000000..38200ae --- /dev/null +++ b/web/viewsjs/taginfo/i18n.js.erb @@ -0,0 +1,6 @@ +function page_init() { + jQuery('span[title]').tipsy({ opacity: 1, delayIn: 500, gravity: 'w' }); + jQuery('#lang').bind('change', function() { + jQuery('form').submit(); + }); +} |