feat: generate better looking curves

This commit is contained in:
mokurin000
2025-08-04 13:59:43 +08:00
parent e8749a8cd2
commit 468f7c9873

View File

@@ -53,7 +53,10 @@ y_data = df["dxRating"].to_list()
def init_chart(
x_type: Literal["value", "log"], x_min: int = 1, x_max: int = 5000
x_type: Literal["value", "log"],
x_min: int = 1,
x_max: int = 5000,
y_max: int = 330,
) -> Scatter:
return (
Scatter(
@@ -73,7 +76,8 @@ def init_chart(
type_="value",
axistick_opts=opts.AxisTickOpts(is_show=True),
splitline_opts=opts.SplitLineOpts(is_show=True),
max_=330,
min_=50,
max_=y_max,
),
tooltip_opts=opts.TooltipOpts(is_show=False),
visualmap_opts=opts.VisualMapOpts(max_=330),
@@ -89,5 +93,16 @@ def init_chart(
x_max = (x_data[-1] // 50 * 50) + 50
init_chart("value", 1, x_max).render(f"{user_id}-pc-rating-linear.html")
init_chart("log", 1, x_max).render(f"{user_id}-pc-rating-log.html")
y_max = min(330, (y_data[-1] // 50 * 50) + 50)
init_chart(
"value",
1,
x_max,
y_max=y_max,
).render(f"{user_id}-pc-rating-linear.html")
init_chart(
"log",
(x_max // 100) or 10,
x_max,
y_max=y_max,
).render(f"{user_id}-pc-rating-log.html")