Fix margin issue on stats graphs

master
trémeur 10 months ago
parent a6d39cf112
commit 266f7839eb

@ -424,7 +424,7 @@ def yeargen(local=False):
if exchangedict:
byevent.append(exchangedict)
byevent = sorted(byevent,key=lambda d: d["words"],reverse=True)
filewrite.write("<h2>By type</h2>\n<table class=\"charts-css column hide-data show-labels show-primary-axis data-spacing-2\" style=\"height:200px;max-width:" + str(len(byevent) * 200) + "px;\">\n<caption>Words per fic type</caption>\n<thead>\n<tr>\n<th scope=\"col\">Type</th>\n<th scope=\"col\">Words</th>\n</tr>\n</thead>\n<tbody>\n")
filewrite.write("<h2>By type</h2>\n<table class=\"charts-css column hide-data show-labels show-primary-axis data-spacing-2\" style=\"height:200px;max-width:" + str(len(byevent) * 200) + "px;\">\n<caption>Words per fic type</caption>\n<thead>\n<tr>\n<th scope=\"col\">Type</th>\n<th scope=\"col\">Words</th>\n</tr>\n</thead>\n<tbody style=\"height:inherit;\">\n")
for event in byevent:
filewrite.write("<tr>\n<th>" + event["type"] + "</th>\n<td style=\"--size:calc(" + str(event["words"]) + " / " + str((byevent[0])["words"]) + ");\"><span class=\"data\">" + str(event["words"]) + "</span><span class=\"tooltip\">" + str(event["fics"]) + " fic")
if event["fics"] > 1:
@ -474,7 +474,7 @@ def yeargen(local=False):
filewrite.write("<li>" + str(ficsum(int(fic["ficno"]),year,local=local)) + "</li>")
filewrite.write("</ol>\n</details>\n")
else:
filewrite.write("<table class=\"charts-css column hide-data show-labels show-primary-axis data-spacing-2\" style=\"height:200px;max-width:" + str(len(neweventslist) * 200) + "px;\">\n<caption>Words per event</caption>\n<thead>\n<tr>\n<th scope=\"col\">Event</th>\n<th scope=\"col\">Words</th>\n</tr>\n</thead>\n<tbody>\n")
filewrite.write("<table class=\"charts-css column hide-data show-labels show-primary-axis data-spacing-2\" style=\"height:200px;max-width:" + str(len(neweventslist) * 200) + "px;\">\n<caption>Words per event</caption>\n<thead>\n<tr>\n<th scope=\"col\">Event</th>\n<th scope=\"col\">Words</th>\n</tr>\n</thead>\n<tbody style=\"height:inherit;\">\n")
for event in neweventslist:
filewrite.write("<tr>\n<th>")
if event["eventlocation"] == "dwcomm":
@ -509,7 +509,7 @@ def yeargen(local=False):
for fic in ficdeets:
fandomlist.extend(fic["fandom"])
fandomlist = sorted(list(dict.fromkeys(fandomlist)))
filewrite.write("</details>\n<h2>By fandom</h2>\n<table class=\"charts-css column hide-data show-labels show-primary-axis data-spacing-2\" style=\"height:400px;max-width:" + str(len(fandomlist) * 200) + "px;\">\n<caption>Words per fandom</caption>\n<thead>\n<tr>\n<th scope=\"col\"> Fandom</th>\n<th scope=\"col\"> Words</th>\n</tr>\n</thead>\n<tbody>\n")
filewrite.write("</details>\n<h2>By fandom</h2>\n<table class=\"charts-css column hide-data show-labels show-primary-axis data-spacing-2\" style=\"height:400px;max-width:" + str(len(fandomlist) * 200) + "px;\">\n<caption>Words per fandom</caption>\n<thead>\n<tr>\n<th scope=\"col\"> Fandom</th>\n<th scope=\"col\"> Words</th>\n</tr>\n</thead>\n<tbody style=\"height:inherit;\">\n")
fandomdeets = []
for fandom in fandomlist:
fandomdict = {"name":fandom,"ficno":[],"words":0}
@ -530,7 +530,7 @@ def yeargen(local=False):
for fic in fandom["ficno"]:
filewrite.write("<li>" + str(ficsum(int(fic),year,showfandom=False,local=local)) + "</li>\n")
filewrite.write("</ol>\n")
filewrite.write("</details>\n<h2>By month</h2>\n<table class=\"charts-css column hide-data show-labels show-primary-axis data-spacing-2\" style=\"height:200px;max-width:2400px;\">\n<caption>Words per month</caption>\n<thead>\n<tr>\n<th scope=\"col\">Month</th>\n<th scope=\"col\">Words</th>\n</tr>\n</thead>\n<tbody>")
filewrite.write("</details>\n<h2>By month</h2>\n<table class=\"charts-css column hide-data show-labels show-primary-axis data-spacing-2\" style=\"height:200px;max-width:2400px;\">\n<caption>Words per month</caption>\n<thead>\n<tr>\n<th scope=\"col\">Month</th>\n<th scope=\"col\">Words</th>\n</tr>\n</thead>\n<tbody style=\"height:inherit;\">")
monthcombine = []
for fic in datesplit:
# read the file back in to get the right word count, because dicts are dynamic somehow??

Loading…
Cancel
Save