if options.sort_values:
data = [[value,key] for key,value in data.items()]
data.sort(reverse=True)
else:
# sort by keys
data = [[key,value] for key,value in data.items()]
data.sort()
data = [[value, key] for key,value in data]
format = "%" + str(max_length) + "s [%6d] %s"
for value,key in data:
print format % (key[:max_length], value, (value / scale) * "*")
Need to modify bar_chart.py as follows: