Skip to content

Commit

Permalink
Working on key
Browse files Browse the repository at this point in the history
  • Loading branch information
katerina7479 committed Jul 14, 2014
1 parent 2ffa98b commit 6689ee1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pypdflite/pdfobjects/pdfgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@


class PDFGraph(object):
def __init__(self, session, page, cursor, width, height, title=None, background_style="S", background_size=1, background_border_color=None, background_fill_color=None, padding=0.1):
def __init__(self, session, page, cursor, width, height, title=None, background_style="S", background_size=1, background_border_color=None, background_fill_color=None, padding=0.1, key=False):
self.session = session
self.page = page
self.font = self.session.parent.document.font
self.origin = cursor
self.axis_labels = None
self.base_color = PDFColor(77, 77, 77)
self._set_title(title, padding, width, height)
self._set_accessories(title, key, padding, width, height)
self._draw_background(width, height, background_style, background_size, background_border_color, background_fill_color)
self._pad(width, height)
self._draw_title()
Expand All @@ -23,12 +23,15 @@ def __init__(self, session, page, cursor, width, height, title=None, background_
PDFColor(208, 146, 167), PDFColor(162, 200, 22), PDFColor(231, 188, 41),
PDFColor(156, 133, 192), PDFColor(243, 164, 71), PDFColor(128, 158, 194)]

def _set_title(self, title, padding, width, height):
def _set_accessories(self, title, key, padding, width, height):
self.title = title
self.key = key
if title is None:
self.padding = (padding * width, padding * height)
else:
self.padding = (padding * width, (padding * 1.2 * height))
if key is True:
self.padding = (self.padding[0] * 0.7, self.padding[1])

def _draw_background(self, width, height, style, size, border_color, fill_color):
cursor_end = PDFCursor(self.origin.x + width, self.origin.y - height)
Expand Down

0 comments on commit 6689ee1

Please sign in to comment.