aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2018-10-10 15:59:24 +0100
committerDaniel Thompson <daniel.thompson@linaro.org>2018-10-10 15:59:24 +0100
commit19b383a1b2ac1a54108b20283a36ed41fbb0ccfc (patch)
tree63deae90f1202985c0f0e170765da9ac5c1a6954
parent45bad55009299522bf85f4282d9f70c9bc13598d (diff)
96btool: piechart: Allow piecharts to be simplified too
-rwxr-xr-xbin/96btool6
1 files changed, 6 insertions, 0 deletions
diff --git a/bin/96btool b/bin/96btool
index 144b6ef..fdeccc9 100755
--- a/bin/96btool
+++ b/bin/96btool
@@ -578,6 +578,10 @@ def do_piechart(args):
posts = [ Post(p) for p in count ]
count = collect.accumulate(posts,
lambda p: p['topic']['category'])
+ if args.simplify:
+ remaining = collect.simplify(count, args.simplify / 100)
+ collect['Other'] = remaining + collect['Uncategorized']
+ del collect['Uncategorized']
chart.piechart(count, args.output, args.title)
def do_pull(args):
@@ -888,6 +892,8 @@ def main(argv):
s = new_parser(do_piechart)
s.add_argument("--title", default=None)
s.add_argument("--output", default="96btool.png")
+ s.add_argument('--simplify', type=float,
+ help="Combine values less than N percent")
s = new_parser(do_pull, no_json_arg=True)
s.add_argument('--debug', action='store_true',