From 30a1660e4fe6138822fdc323da71c8831941bc1c Mon Sep 17 00:00:00 2001 From: Florian Mounier Date: Wed, 21 May 2014 17:54:38 +0200 Subject: [PATCH] Start working on a render_table method to generate a HTML table with the chart values. --- CHANGELOG | 1 + demo/moulinrouge/__init__.py | 52 +++++++++++ demo/moulinrouge/static/js.js | 84 +++++++++++++----- demo/moulinrouge/templates/index.jinja2 | 55 +++++++----- demo/moulinrouge/templates/table.jinja2 | 18 ++++ pygal/ghost.py | 7 ++ pygal/table.py | 110 ++++++++++++++++++++++++ pygal/test/test_table.py | 32 +++++++ 8 files changed, 315 insertions(+), 44 deletions(-) create mode 100644 demo/moulinrouge/templates/table.jinja2 create mode 100644 pygal/table.py create mode 100644 pygal/test/test_table.py diff --git a/CHANGELOG b/CHANGELOG index b3f4d5d..13d6fd4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ V 1.5.0 UNRELEASED Add per serie configuration Add half pie (thanks philt2001) + Add render_table (WIP) V 1.4.6 Add support for \n separated multiline titles (thanks sirlark) diff --git a/demo/moulinrouge/__init__.py b/demo/moulinrouge/__init__.py index 3963523..359a63b 100644 --- a/demo/moulinrouge/__init__.py +++ b/demo/moulinrouge/__init__.py @@ -96,6 +96,13 @@ def create_app(): graph.add(title, values) return graph.render_response() + @app.route("/table///") + def table(type, series, config): + graph = getattr(pygal, type)(pickle.loads(b64decode(str(config)))) + for title, values in pickle.loads(b64decode(str(series))): + graph.add(title, values) + return graph.render_table() + @app.route("/sparkline/