Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
piks3l
Respect My Net
Commits
04853590
Commit
04853590
authored
Nov 19, 2011
by
stef
Browse files
[enh] less color classes in maps
parent
7d6ae138
Changes
3
Hide whitespace changes
Inline
Side-by-side
bt/views.py
View file @
04853590
...
@@ -216,8 +216,30 @@ def list_violations(request):
...
@@ -216,8 +216,30 @@ def list_violations(request):
reverse
=
True
)
reverse
=
True
)
legend
=
sorted
(
set
([(
w
,
"rgba(255,%d, 00, 0.4)"
%
(
w
*
768
/
(
countries
[
0
][
0
]
+
1
)
%
256
))
for
w
,
c
in
countries
]),
reverse
=
True
)
legend
=
sorted
(
set
([(
w
,
"rgba(255,%d, 00, 0.4)"
%
(
w
*
768
/
(
countries
[
0
][
0
]
+
1
)
%
256
))
for
w
,
c
in
countries
]),
reverse
=
True
)
countrycolors
=
json
.
dumps
(
dict
([(
c
.
lower
(),
"#ff%02x00"
%
(
w
*
768
/
(
countries
[
0
][
0
]
+
1
)
%
256
))
for
w
,
c
in
countries
]))
countrycolors
=
json
.
dumps
(
dict
([(
c
.
lower
(),
"#ff%02x00"
%
(
w
*
768
/
(
countries
[
0
][
0
]
+
1
)
%
256
))
for
w
,
c
in
countries
]))
tmp
=
sorted
(
set
([
w
for
w
,
c
in
countries
]),
reverse
=
True
)
legend
=
[]
countrycolors
=
{}
tmpd
=
{}
itemspercol
=
len
(
tmp
)
/
4
for
w
,
c
in
countries
:
if
w
not
in
tmpd
.
keys
():
if
len
(
tmpd
.
keys
())
>=
itemspercol
and
len
(
legend
)
<
3
:
countrycolors
.
update
([(
c1
.
lower
(),
"#ff%02x00"
%
(
68
*
(
4
-
len
(
legend
))
if
len
(
legend
)
else
255
))
for
w1
in
tmpd
.
keys
()
for
c1
in
tmpd
[
w1
]])
legend
.
append
((
"%s - %s"
%
(
max
(
tmpd
.
keys
()),
min
(
tmpd
.
keys
())),
len
(
legend
)))
tmpd
=
{
w
:
[
c
]}
else
:
tmpd
[
w
]
=
[
c
]
else
:
tmpd
[
w
].
append
(
c
)
if
tmpd
:
countrycolors
.
update
([(
c1
.
lower
(),
"#ff%02x00"
%
(
68
*
(
4
-
len
(
legend
))))
for
w1
in
tmpd
.
keys
()
for
c1
in
tmpd
[
w1
]])
legend
.
append
((
"%s - %s"
%
(
max
(
tmpd
.
keys
()),
min
(
tmpd
.
keys
())),
len
(
legend
)))
countrycolors
=
json
.
dumps
(
countrycolors
)
#legend=sorted(set([(w, "rgba(255,%d, 00, 0.4)" % (w*768/(countries[0][0]+1)%256)) for w,c in countries]),reverse=True)
#countrycolors=json.dumps(dict([(c.lower(),"#ff%02x00" % (w*768/(countries[0][0]+1)%256)) for w,c in countries]))
#confirms=sorted([(i['total'],i['country'])
#confirms=sorted([(i['total'],i['country'])
# for i in Violation.objects.values('country').filter(activationid='').annotate(total=Count('confirmation'))],
# for i in Violation.objects.values('country').filter(activationid='').annotate(total=Count('confirmation'))
# if i['total']>1],
# reverse=True)
# reverse=True)
return
render_to_response
(
'list.html'
,
return
render_to_response
(
'list.html'
,
{
"violations"
:
violations
,
{
"violations"
:
violations
,
...
...
media/css/style.css
View file @
04853590
...
@@ -688,3 +688,9 @@ tr.confirmed-status td { background: #fff !important; }
...
@@ -688,3 +688,9 @@ tr.confirmed-status td { background: #fff !important; }
tr.moreinfo-status td { background: yellow !important; }
tr.moreinfo-status td { background: yellow !important; }
tr.ooscope-status td { background: #aaa !important; }
tr.ooscope-status td { background: #aaa !important; }
*/
*/
.legendclass4
{
background
:
rgba
(
255
,
00
,
00
,
0.4
);
}
.legendclass3
{
background
:
rgba
(
255
,
68
,
00
,
0.4
);
}
.legendclass2
{
background
:
rgba
(
255
,
138
,
00
,
0.4
);}
.legendclass1
{
background
:
rgba
(
255
,
204
,
00
,
0.4
);}
.legendclass0
{
background
:
rgba
(
255
,
255
,
00
,
0.4
);}
templates/list.html
View file @
04853590
...
@@ -227,7 +227,7 @@
...
@@ -227,7 +227,7 @@
</svg>
</svg>
<div
id=
"legend"
>
<div
id=
"legend"
>
{% for w, col in legend %}
{% for w, col in legend %}
<span
style=
"background-color:
{{col}}
;
"
>
{{w}}
</span>
<span
class=
"legendclass
{{col}}"
>
{{w}}
</span>
{% endfor %}
{% endfor %}
{% trans "Reported Cases" %}
{% trans "Reported Cases" %}
</div>
</div>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment