Merge lp:~jderose/ubuntu/karmic/pybootchartgui/fix-441660 into lp:ubuntu/karmic/pybootchartgui

Proposed by Jason Gerard DeRose
Status: Merged
Merge reported by: Jason Gerard DeRose
Merged at revision: not available
Proposed branch: lp:~jderose/ubuntu/karmic/pybootchartgui/fix-441660
Merge into: lp:ubuntu/karmic/pybootchartgui
Diff against target: 21 lines
1 file modified
pybootchartgui/draw.py (+8/-2)
To merge this branch: bzr merge lp:~jderose/ubuntu/karmic/pybootchartgui/fix-441660
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Approve
Ubuntu branches Pending
Review via email: mp+12830@code.launchpad.net
To post a comment you must log in.
5. By Jason Gerard DeRose

A better fix for lp:441660

Revision history for this message
Daniel Holbach (dholbach) wrote :

This was merged already.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pybootchartgui/draw.py'
2--- pybootchartgui/draw.py 2009-04-18 22:48:24 +0000
3+++ pybootchartgui/draw.py 2009-10-03 21:53:11 +0000
4@@ -162,9 +162,15 @@
5 x = (point[0] - x_base) * xscale + x_trans
6 y = (point[1] - y_base) * -yscale + y_trans + bar_h
7 return x, y
8+
9+ def safe_divisor(i):
10+ d = max(p[i] for p in data)
11+ if d == 0:
12+ return 1.0 # FIXME: Is a reasonable failsafe value?
13+ return float(d)
14
15- xscale = float(chart_bounds[2]) / max(x for (x,y) in data)
16- yscale = float(chart_bounds[3]) / max(y for (x,y) in data)
17+ xscale = chart_bounds[2] / safe_divisor(0)
18+ yscale = chart_bounds[3] / safe_divisor(1)
19
20 first = transform_point_coords(data[0], x_shift, 0, xscale, yscale, chart_bounds[0], chart_bounds[1])
21 last = transform_point_coords(data[-1], x_shift, 0, xscale, yscale, chart_bounds[0], chart_bounds[1])

Subscribers

People subscribed via source and target branches