Skip to content

Commit

Permalink
Merge pull request #21 from haard/master
Browse files Browse the repository at this point in the history
Flot integration
  • Loading branch information
schmichael committed Mar 24, 2012
2 parents bba00d7 + 9994205 commit 3a756e8
Show file tree
Hide file tree
Showing 6 changed files with 11,156 additions and 0 deletions.
18 changes: 18 additions & 0 deletions mmstats/mmash.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,24 @@ def find_labels():
def stats():
return json.dumps(sorted(find_labels()), indent=4)

@app.route('/flot/')
def flot():

string_stats = []
numeric_stats = []
for fn, label, value in iter_stats():
try:
float(value)
except ValueError:
string_stats.append({'label': label, 'value': value, 'jsid': label.replace('.', '_')})
else:
numeric_stats.append({'label': label, 'value': value, 'jsid': label.replace('.', '_')})
return flask.render_template('flot.html',
mmstats_dir=app.config['MMSTATS_DIR'],
string_stats=sorted(string_stats, key=lambda x: x['label']),
numeric_stats=sorted(numeric_stats, key=lambda x: x['label']))



aggregators = {
'avg': lambda v: float(sum(v)) / len(v),
Expand Down
4 changes: 4 additions & 0 deletions mmstats/static/base.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
body {
font-family: sans-serif;
}

div.hidden {
display: none;
}
Loading

0 comments on commit 3a756e8

Please sign in to comment.