Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
Respect My Net
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
piks3l
Respect My Net
Commits
04853590
Commit
04853590
authored
Nov 19, 2011
by
stef
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[enh] less color classes in maps
parent
7d6ae138
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
bt/views.py
bt/views.py
+23
-1
media/css/style.css
media/css/style.css
+6
-0
templates/list.html
templates/list.html
+1
-1
No files found.
bt/views.py
View file @
04853590
...
...
@@ -216,8 +216,30 @@ def list_violations(request):
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
]))
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'])
# 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)
return
render_to_response
(
'list.html'
,
{
"violations"
:
violations
,
...
...
media/css/style.css
View file @
04853590
...
...
@@ -688,3 +688,9 @@ tr.confirmed-status td { background: #fff !important; }
tr.moreinfo-status td { background: yellow !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 @@
</svg>
<div
id=
"legend"
>
{% for w, col in legend %}
<span
style=
"background-color: {{col}};
"
>
{{w}}
</span>
<span
class=
"legendclass{{col}}
"
>
{{w}}
</span>
{% endfor %}
{% trans "Reported Cases" %}
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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