diff options
author | Jochen Topf <jochen@topf.org> | 2014-09-19 10:52:10 +0200 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2014-09-19 10:52:10 +0200 |
commit | 0a140baa74348cf3270c9614f3288ec1bcf9c9db (patch) | |
tree | b07b5644a6c0c97ab50b90d8e38dba611b2fea4b /web/views | |
parent | 47f60085e9ed997e7f8b2b9d829094c94e26eb25 (diff) | |
download | taginfo-0a140baa74348cf3270c9614f3288ec1bcf9c9db.tar taginfo-0a140baa74348cf3270c9614f3288ec1bcf9c9db.tar.gz |
Make chart in overview tab on key page smaller if page is small.
This fixes #60. If the chart gets to small it doesn't look good any more,
because labels will overlap. But it is better than before.
Diffstat (limited to 'web/views')
-rw-r--r-- | web/views/key.erb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/web/views/key.erb b/web/views/key.erb index 49f0c94..b13aaf5 100644 --- a/web/views/key.erb +++ b/web/views/key.erb @@ -110,6 +110,17 @@ <iframe id="josmiframe" name="josmiframe"></iframe> <% javascript do JS.raw(<<"JAVASCRIPT") +function redraw_chart() { + jQuery('#canvas-values').html(''); + var max_height = jQuery(window).height() - 300; + create_chart({ + key: #{ @key.to_json }, + width: 160, + height: Math.min(440, max_height), + max: #{ @count_all_values }, + data: #{ @prevalent_values.to_json() } + }); +} function page_init2() { var filter = #{ @filter_type.to_json }, key = #{ @key.to_json }; @@ -129,13 +140,9 @@ function page_init2() { }); init_tabs([key, filter, #{ r18n.locale.code.to_json }]); - create_chart({ - key: key, - width: 160, - height: 440, - max: #{ @count_all_values }, - data: #{ @prevalent_values.to_json() } - }); + + redraw_chart(); + jQuery(window).resize(redraw_chart); } JAVASCRIPT end |