Browse Source

Solve #309 with flake8 constrain

pull/343/head
qins 8 years ago
parent
commit
4b3fc71664
  1. 11
      pygal/graph/line.py
  2. 6
      pygal/test/test_line_log_none_max_solved.py

11
pygal/graph/line.py

@ -99,12 +99,9 @@ class Line(Graph):
for i, (x, y) in enumerate(view_values):
if None in (x, y):
continue
#modified
if self.logarithmic:
if points[i][1] == None or points[i][1] <= 0:
if points[i][1] is None or points[i][1] <= 0:
continue
if (serie.show_only_major_dots and
self.x_labels and i < len(self.x_labels) and
self.x_labels[i] not in self._x_labels_major):
@ -170,14 +167,12 @@ class Line(Graph):
else:
# plain vanilla rendering
sequences = [view_values]
#modified
if self.logarithmic:
for seq in sequences:
for ele in seq[::-1]:
if points[seq.index(ele)][1]==None or points[seq.index(ele)][1] <= 0:
y = points[seq.index(ele)][1]
if y is None or y <= 0:
del seq[seq.index(ele)]
for seq in sequences:
self.svg.line(
serie_node['plot'], seq, close=self._self_close,

6
pygal/test/test_line_log_none_max_solved.py

@ -8,8 +8,8 @@ from pygal import Line
from pygal.test.utils import texts
from math import cos, sin
chart = Line(title='test', x_label_rotation=90, human_readable=True, logarithmic=True)
chart.add('test 1', [None, None, None, None, -38, 48, None, 4422, 34443, 345586, 40003452, 1235533, 2235533])
chart.add('test 2', [ 1, 7, 19, 30, 40, 20, 38, 283, 2937, 29374, 20399, 293874, 3947])
chart = Line(title='test', logarithmic=True)
chart.add('test 1', [None, -38, 48, 4422, 35586, 1003452, 225533])
chart.add('test 2', [1, 40, 20, 38, 2937, 20399, 3947])
q = chart.render_pyquery()
assert len(q(".dots")) == 20

Loading…
Cancel
Save