Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
1ad23b82
Commit
1ad23b82
authored
Feb 18, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show Y axis label
parent
989122c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
weblate/trans/charts.py
weblate/trans/charts.py
+21
-0
No files found.
weblate/trans/charts.py
View file @
1ad23b82
...
@@ -30,6 +30,7 @@ from django.core.urlresolvers import reverse
...
@@ -30,6 +30,7 @@ from django.core.urlresolvers import reverse
import
cairo
import
cairo
import
pango
import
pango
import
pangocairo
import
pangocairo
import
math
def
render_activity
(
activity
):
def
render_activity
(
activity
):
...
@@ -64,9 +65,29 @@ def render_activity(activity):
...
@@ -64,9 +65,29 @@ def render_activity(activity):
pangocairo_context
.
set_antialias
(
cairo
.
ANTIALIAS_SUBPIXEL
)
pangocairo_context
.
set_antialias
(
cairo
.
ANTIALIAS_SUBPIXEL
)
font
=
pango
.
FontDescription
(
'Sans 8'
)
font
=
pango
.
FontDescription
(
'Sans 8'
)
# Rotate context for vertical text
ctx
.
rotate
(
-
math
.
pi
/
2
)
# Create Y axis label
layout
=
pangocairo_context
.
create_layout
()
layout
.
set_width
(
80
)
layout
.
set_alignment
(
pango
.
ALIGN_RIGHT
)
layout
.
set_font_description
(
font
)
layout
.
set_text
(
str
(
maximum
))
# Render Y axis label
ctx
.
move_to
(
-
5
,
0
)
ctx
.
set_source_rgb
(
0
,
0
,
0
)
pangocairo_context
.
update_layout
(
layout
)
pangocairo_context
.
show_layout
(
layout
)
# Rotate context back
ctx
.
rotate
(
math
.
pi
/
2
)
# Counter for rendering ticks
# Counter for rendering ticks
last
=
-
40
last
=
-
40
# Render activity itself
for
offset
,
value
in
enumerate
(
activity
):
for
offset
,
value
in
enumerate
(
activity
):
# Calculate position
# Calculate position
current
=
offset
*
step
current
=
offset
*
step
...
...
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