1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
<%
osm = @trans.t.osm
misc = @trans.t.misc
%>
var create_flexigrid_for = {
whitespace: function() {
create_flexigrid('grid-whitespace', {
url: '/api/2/db/keys?filters=characters_space&include=prevalent_values',
colModel: [
{ display: '<%= osm.key %>', name: 'key', width: 250, sortable: true },
{ display: '<span title="<%= misc.objects_tooltip %>"><img src="/img/types/all.16.png" width="16" height="16" alt=""/> <%= osm.objects %></span>', name: 'count_all', width: 250, sortable: true, align: 'center' },
{ display: '<span title="<%= misc.users_tooltip %>"><%= osm.users %></span>', name: 'users_all', width: 44, sortable: true, align: 'right' },
{ display: '<img src="/img/sources/wiki.16.png" width="16" height="16" alt="Wiki" title="<%= misc.in_wiki_tooltip %>"/>', name: 'in_wiki', width: 20, sortable: true, align: 'center' },
{ display: '<img src="/img/sources/josm.16.png" width="16" height="16" alt="JOSM" title="<%= misc.in_josm_tooltip %>"/>', name: 'in_josm', width: 20, sortable: true, align: 'center' },
{ display: '<span title="<%= misc.values_tooltip %>"><%= osm.values %></span>', name: 'values_all', width: 70, sortable: true, align: 'right' },
{ display: '<span title="<%= misc.prevalent_values_tooltip %>"><%= misc.prevalent_values %></span>', name: 'prevalent_values', width: 500, sortable: true }
],
searchitems: [
{ display: '<%= osm.key %>', name: 'key' }
],
sortname: 'count_all',
sortorder: 'desc',
preProcess: function(data) {
data.rows = jQuery.map(data.data, function(row, i) {
return { 'cell': [
link_to_key(row.key),
print_value_with_percent(row.count_all, row.count_all_fraction),
print_with_ts(row.users_all),
row.in_wiki ? '✔' : '-',
row.in_josm ? '✔' : '-',
print_with_ts(row.values_all),
print_prevalent_value_list(row.key, row.prevalent_values)
] };
});
return data;
}
});
},
problematic: function() {
create_flexigrid('grid-problematic', {
url: '/api/2/db/keys?filters=characters_problematic&include=prevalent_values',
colModel: [
{ display: '<%= osm.key %>', name: 'key', width: 250, sortable: true },
{ display: '<span title="<%= misc.objects_tooltip %>"><img src="/img/types/all.16.png" width="16" height="16" alt=""/> <%= osm.objects %></span>', name: 'count_all', width: 250, sortable: true, align: 'center' },
{ display: '<span title="<%= misc.users_tooltip %>"><%= osm.users %></span>', name: 'users_all', width: 44, sortable: true, align: 'right' },
{ display: '<img src="/img/sources/wiki.16.png" width="16" height="16" alt="Wiki" title="<%= misc.in_wiki_tooltip %>"/>', name: 'in_wiki', width: 20, sortable: true, align: 'center' },
{ display: '<img src="/img/sources/josm.16.png" width="16" height="16" alt="JOSM" title="<%= misc.in_josm_tooltip %>"/>', name: 'in_josm', width: 20, sortable: true, align: 'center' },
{ display: '<span title="<%= misc.values_tooltip %>"><%= osm.values %></span>', name: 'values_all', width: 70, sortable: true, align: 'right' },
{ display: '<span title="<%= misc.prevalent_values_tooltip %>"><%= misc.prevalent_values %></span>', name: 'prevalent_values', width: 500, sortable: true }
],
searchitems: [
{ display: '<%= osm.key %>', name: 'key' }
],
sortname: 'count_all',
sortorder: 'desc',
preProcess: function(data) {
data.rows = jQuery.map(data.data, function(row, i) {
return { 'cell': [
link_to_key(row.key),
print_value_with_percent(row.count_all, row.count_all_fraction),
print_with_ts(row.users_all),
row.in_wiki ? '✔' : '-',
row.in_josm ? '✔' : '-',
print_with_ts(row.values_all),
print_prevalent_value_list(row.key, row.prevalent_values)
] };
});
return data;
}
});
}
};
function page_init() {
init_tabs([]);
var data = <%= i = '@'; %w(plain colon letters space problem rest).map{ |type| i=i.next; [ { :label => i, :value => @db.stats('characters_in_keys_' + type) } ] }.to_json %>;
var w=968, h=50;
var vis = new pv.Panel()
.canvas('canvas')
.width(w + 20)
.height(h);
var colors = <%= { :A => '#2ca02c', :B => '#98df8a', :C => '#dbdb8d', :D => '#d62728', :E => '#ff9896', :F => '#aec7e8' }.to_json %>;
var scale = pv.Scale.linear(0, <%= @db.stats('num_keys') %>).range(0, w);
vis.add(pv.Layout.Stack)
.orient('left-top')
.left(10)
.layers(data)
.x(10)
.y(function(d) { return scale(d.value); })
.layer.add(pv.Bar)
.fillStyle(function(d) { return colors[d.label]; })
.height(20)
.anchor('bottom')
.add(pv.Label)
.font('12px Arial,sans-serif')
.top(46)
.text(function(d) { return d.label; });
vis.render();
}
|