Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fix for problem of "line" instead of "lines" #5

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pyflot/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DuplicateLabelException(Exception):
label a new series with a label already in use"""


LINE_TYPES = ('bars', 'line', 'points')
LINE_TYPES = ('bars', 'lines', 'points')


class Flot(object):
Expand Down Expand Up @@ -102,7 +102,7 @@ def options_json(self):
def __getattr__(self, value):
"""
add_bars
add_line
add_lines
add_points

provides shortcut methods for adding series using a particular line type
Expand All @@ -116,7 +116,9 @@ def add_series_type(self, line_type, series, label=None, **kwargs):
"""Used as a partial by __getattr__ to auto set the line_type
for the series."""
method = getattr(self, 'add_series')
return method(series, label, **{line_type: True})
new_kwargs = {line_type: True}
new_kwargs.update(kwargs)
return method(series, label, **new_kwargs)

def add_series(self, series, label=None, **kwargs):
"""
Expand Down Expand Up @@ -153,6 +155,11 @@ def add_series(self, series, label=None, **kwargs):
new_series.update({line_type: kwargs[line_type]})
else:
new_series.update({line_type: {'show': True}})

for k,v in kwargs.items():
if not k == line_type:
new_series[line_type].update({k:v})

self._series.append(new_series)

#def add_time_series(self, series, label=None, **kwargs):
Expand Down