leftover
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
from openpyxl import Workbook
|
||||
from openpyxl.chart import LineChart, Reference, Series
|
||||
|
||||
wb = Workbook()
|
||||
ws = wb.active
|
||||
ws.title = "Simulation"
|
||||
|
||||
gewicht_werte = [50, 65, 80]
|
||||
r_frauen = 0.68
|
||||
promille_stufen = [0.5, 1.0, 1.5, 2.0]
|
||||
alkohol_pro_ball_g = 0.2
|
||||
balls_per_pack = 18
|
||||
preis_pro_pack = 6.5
|
||||
|
||||
ws.append(["Promille"] + [f"Kugeln ({g}kg Frau)" for g in gewicht_werte] + ["Kosten (€)"])
|
||||
|
||||
for p in promille_stufen:
|
||||
row = [p]
|
||||
for g in gewicht_werte:
|
||||
alk = p * g * r_frauen
|
||||
kugeln = round(alk / alkohol_pro_ball_g)
|
||||
row.append(kugeln)
|
||||
|
||||
kosten = round((row[2] / balls_per_pack) * preis_pro_pack, 2)
|
||||
row.append(kosten)
|
||||
ws.append(row)
|
||||
|
||||
chart = LineChart()
|
||||
chart.title = "Rumkugel-Bedarf vs. Promille"
|
||||
chart.style = 13
|
||||
chart.y_axis.title = "Anzahl Rumkugeln"
|
||||
chart.x_axis.title = "Promille"
|
||||
|
||||
data = Reference(ws, min_col=2, max_col=4, min_row=1, max_row=len(promille_stufen)+1)
|
||||
cats = Reference(ws, min_col=1, min_row=2, max_row=len(promille_stufen)+1)
|
||||
chart.add_data(data, titles_from_data=True)
|
||||
chart.set_categories(cats)
|
||||
|
||||
s2 = LineChart()
|
||||
data_kosten = Reference(ws, min_col=5, max_col=5, min_row=1, max_row=len(promille_stufen)+1)
|
||||
s2.add_data(data_kosten, titles_from_data=True)
|
||||
s2.y_axis.axId = 200
|
||||
s2.y_axis.title = "Kosten (€)"
|
||||
s2.y_axis.crosses = "max"
|
||||
|
||||
chart += s2
|
||||
|
||||
ws.add_chart(chart, "G2")
|
||||
wb.save("rum_kugel_fix.xlsx")
|
||||
Reference in New Issue
Block a user