Skip to content

load-graph: Improve y-axis plotting

Previously, when a particular data point had f(t)=1 (e.g. CPU at 100%
utilization), then the corresponding line was drawn to y=0 on the graph.
The problem with that is that it falls outside the crop area,
so it is not visible.

`create_background()` renders the top (i.e. i=0) horizontal line at
y=FRAME_WIDTH, and the bottom one (i.e. i=graph->num_bars) at
y=FRAME_WIDTH+graph->num_bars*graph->graph_dely. Luckily,
`graph->num_bars * graph->graph_dely` is already calculated and saved
into `graph->real_draw_height` so use that to scale the value of
the data point and apply a y-offset of `FRAME_WIDTH` to make sure
that the line remains (at least partially) visible at its extremes.

Closes #277 (closed)

Merge request reports