Mercurial > hg > numerics
changeset 148:279f5ae33564
this now generates something
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 12 Apr 2015 19:22:33 -0700 |
parents | b8a7604adf6f |
children | dcedbe63d2c6 |
files | numerics/bar.py |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/numerics/bar.py Sun Apr 12 19:18:28 2015 -0700 +++ b/numerics/bar.py Sun Apr 12 19:22:33 2015 -0700 @@ -12,6 +12,7 @@ # imports import argparse +import json import os import sys import tempita @@ -41,7 +42,8 @@ template = tempita.Template.from_filename(bar_template) bar_chart = template.substitute(title=title or '', d3=d3, - data=data) + data=json.dumps(data)) + return bar_chart class BarChartParser(ManipulationParser): """command line options parser for bar charts""" @@ -83,7 +85,7 @@ data = data[0] # generate bar chart - bar_chart(data, parser.plot_filename(), title=options.title) + options.output.write(bar_chart(data, parser.plot_filename(), title=options.title)) if __name__ == '__main__':