From 772c2ffeba5aefc48327bc8e49e72184928589ce Mon Sep 17 00:00:00 2001 From: Felipe Arruda Pontes Date: Sun, 2 Dec 2012 21:15:19 -0200 Subject: [PATCH 1/4] Update pyflot/graph.py small fix... now instead of line is lines --- pyflot/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyflot/graph.py b/pyflot/graph.py index d67e4d5..860ca96 100644 --- a/pyflot/graph.py +++ b/pyflot/graph.py @@ -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): From fe0c4e5296d57110d3d5518e5623f6c505931c3c Mon Sep 17 00:00:00 2001 From: Felipe Arruda Pontes Date: Sun, 2 Dec 2012 21:17:39 -0200 Subject: [PATCH 2/4] Update pyflot/graph.py Fixing docstring to match the last commit change --- pyflot/graph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyflot/graph.py b/pyflot/graph.py index 860ca96..5be5ead 100644 --- a/pyflot/graph.py +++ b/pyflot/graph.py @@ -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 From 6ef72d573de93533860b461cc87e2151bc4c8804 Mon Sep 17 00:00:00 2001 From: Felipe Arruda Pontes Date: Mon, 3 Dec 2012 15:27:06 -0200 Subject: [PATCH 3/4] Allow user to pass kwargs like:"fill:true" to the add_lines, to add option for each series type. --- pyflot/graph.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pyflot/graph.py b/pyflot/graph.py index 5be5ead..390c31e 100644 --- a/pyflot/graph.py +++ b/pyflot/graph.py @@ -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): """ @@ -153,6 +155,10 @@ 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.update({line_type: {k:v}}) self._series.append(new_series) #def add_time_series(self, series, label=None, **kwargs): From 90d2a0cd6bb1879e587673f97d9312697eb9883f Mon Sep 17 00:00:00 2001 From: Felipe Arruda Pontes Date: Mon, 3 Dec 2012 21:30:33 -0200 Subject: [PATCH 4/4] small fix, last commit wasn't ok --- pyflot/graph.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyflot/graph.py b/pyflot/graph.py index 390c31e..4282997 100644 --- a/pyflot/graph.py +++ b/pyflot/graph.py @@ -158,7 +158,8 @@ def add_series(self, series, label=None, **kwargs): for k,v in kwargs.items(): if not k == line_type: - new_series.update({line_type: {k:v}}) + new_series[line_type].update({k:v}) + self._series.append(new_series) #def add_time_series(self, series, label=None, **kwargs):