Browse Source

Whitespace cleanup and comments cleanup

pull/20/head
Wiktor Niesiobedzki 12 years ago
parent
commit
2f640560dd
  1. 24
      pygal/graph/graph.py
  2. 4
      pygal/graph/line.py

24
pygal/graph/graph.py

@ -61,8 +61,6 @@ class Graph(BaseGraph):
self.height - self.margin.y,
self._box)
def _make_graph(self):
"""Init common graph svg structure"""
self.nodes['graph'] = self.svg.node(
@ -198,27 +196,16 @@ class Graph(BaseGraph):
text.attrib['transform'] = "rotate(%d %f %f)" % (
self.y_label_rotation, x, y)
# TODO:
# - shall we do separate axis 2y node, or use the above (and have an inner
# loop condition)
# - it
# 10 is a magic number around here - margin size, don't know,
# what stands for the additional 2 px
if self._y_2nd_labels:
secondary_ax = self.svg.node(self.nodes['plot'], class_="axis 2y")
#self.svg.node(secondary_ax, 'path',
# d='M%f %f v%f' % (self.view.width-12, 0, self.view.height),
# class_='major line'
#)
secondary_ax = self.svg.node(self.nodes['plot'], class_="axis y2")
for label, position in self._y_2nd_labels:
major = is_major(position)
# it is needed, to have the same structure
# it is needed, to have the same structure as primary axis
guides = self.svg.node(secondary_ax, class_='guides')
x = self.view.width + 5
y = self.view.y(position)
text = self.svg.node(guides, 'text',
x = x,
# XXX: plus or minus?
y = y + .35 * self.label_font_size,
class_ = 'major' if major else ''
)
@ -228,7 +215,6 @@ class Graph(BaseGraph):
self.y_label_rotation, x, y)
def _legend(self):
"""Make the legend box"""
if not self.show_legend:
@ -263,10 +249,14 @@ class Graph(BaseGraph):
# if legends at the bottom, we dont split the windows
counter = count()
# gen structure - (i, (j, (l, tf)))
# i - global serie number - used for coloring and identification
# j - position within current legend box
# l - label
# tf - whether it is secondary label
gen = enumerate(enumerate(chain(
izip(self._legends, repeat(False)),
izip(self._secondary_legends, repeat(True)))))
secondary_legends = legends
secondary_legends = legends # svg node is the same
else:
gen = enumerate(chain(
enumerate(izip(self._legends, repeat(False))),

4
pygal/graph/line.py

@ -100,7 +100,6 @@ class Line(Graph):
x / (self._len - 1) for x in range(self._len)
] if self._len != 1 else [.5] # Center if only one value
# XXX: we need to have rescaled serie.values to execute this
self._points(x_pos)
x_labels = zip(self.x_labels, x_pos)
@ -143,9 +142,6 @@ class Line(Graph):
self._scale_diff = y_pos[0]
self._scale_min_2nd = min_2nd
def _plot(self):
for index, serie in enumerate(self.series):
self.line(self._serie(index), serie)

Loading…
Cancel
Save