stats.lua: add option to control plot border width

This adds a new configuration option plot_bg_border_width, which
controls the border width of plots.
This commit is contained in:
nanahi 2024-04-15 00:45:18 -04:00 committed by Kacper Michajłow
parent 5370923a35
commit d283688939
2 changed files with 8 additions and 2 deletions

View File

@ -183,6 +183,11 @@ Configurable Options
Border color used for drawing graphs.
``plot_bg_border_width``
Default: 0.5
Border width used for drawing graphs.
``plot_bg_color``
Default: 262626

View File

@ -47,6 +47,7 @@ local o = {
plot_bg_border_color = "0000FF",
plot_bg_color = "262626",
plot_color = "FFFFFF",
plot_bg_border_width = 0.5,
-- Text style
font = "",
@ -235,8 +236,8 @@ local function generate_graph(values, i, len, v_max, v_avg, scale, x_tics)
s[#s+1] = format("%f %f %f %f", x, y_max, 0, y_max)
local bg_box = format("{\\bord0.5}{\\3c&H%s&}{\\1c&H%s&}m 0 %f l %f %f %f 0 0 0",
o.plot_bg_border_color, o.plot_bg_color, y_max, x_max, y_max, x_max)
local bg_box = format("{\\bord%f}{\\3c&H%s&}{\\1c&H%s&}m 0 %f l %f %f %f 0 0 0",
o.plot_bg_border_width, o.plot_bg_border_color, o.plot_bg_color, y_max, x_max, y_max, x_max)
return format("%s{\\rDefault}{\\pbo%f}{\\shad0}{\\alpha&H00}{\\p1}%s{\\p0}{\\bord0}{\\1c&H%s}{\\p1}%s{\\p0}%s",
o.prefix_sep, y_offset, bg_box, o.plot_color, table.concat(s), text_style())
end