Typo again
This commit is contained in:
parent
cab9498f2b
commit
e5a1948f59
@ -29,14 +29,14 @@ def name_from_field(field: str) -> str :
|
|||||||
def main():
|
def main():
|
||||||
stats_fn, web_render = parse_args()
|
stats_fn, web_render = parse_args()
|
||||||
data = load_data(stats_fn)
|
data = load_data(stats_fn)
|
||||||
|
|
||||||
render(data, web_render)
|
render(data, web_render)
|
||||||
|
|
||||||
|
|
||||||
def load_data(stats_fn: str):
|
def load_data(stats_fn: str):
|
||||||
with open(stats_fn) as stats_f:
|
with open(stats_fn) as stats_f:
|
||||||
data = json.load(stats_f)
|
data = json.load(stats_f)
|
||||||
|
|
||||||
data_dict = {name_from_field(field): [0]*len(data) for field in data[0]}
|
data_dict = {name_from_field(field): [0]*len(data) for field in data[0]}
|
||||||
print("Found", len(data), "points")
|
print("Found", len(data), "points")
|
||||||
|
|
||||||
@ -55,7 +55,6 @@ def load_data(stats_fn: str):
|
|||||||
def render(data: dict, web_render:bool=False):
|
def render(data: dict, web_render:bool=False):
|
||||||
bar_chart = pygal.StackedBar(height=400, legend_box_size=5, x_label_rotation=25)
|
bar_chart = pygal.StackedBar(height=400, legend_box_size=5, x_label_rotation=25)
|
||||||
labels = [d.strftime("%B %d %H:%M") for d in data["date"]]
|
labels = [d.strftime("%B %d %H:%M") for d in data["date"]]
|
||||||
print(labels)
|
|
||||||
bar_chart.x_labels = labels
|
bar_chart.x_labels = labels
|
||||||
for k in data:
|
for k in data:
|
||||||
if k == "date":
|
if k == "date":
|
||||||
@ -63,7 +62,7 @@ def render(data: dict, web_render:bool=False):
|
|||||||
#if "db" in k or "database" in k or "mysql" in k or "mongo" in k or "postgre" in k:
|
#if "db" in k or "database" in k or "mysql" in k or "mongo" in k or "postgre" in k:
|
||||||
# continue
|
# continue
|
||||||
bar_chart.add(k, data[k])
|
bar_chart.add(k, data[k])
|
||||||
|
|
||||||
if web_render:
|
if web_render:
|
||||||
bar_chart.render_in_browser()
|
bar_chart.render_in_browser()
|
||||||
else:
|
else:
|
||||||
|
@ -15,7 +15,7 @@ if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then
|
|||||||
echo " - stats_file: path to stats file"
|
echo " - stats_file: path to stats file"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " - w: do rende1r using web browser"
|
echo " - w: do render using web browser"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user