# [rrd-users] Working with linear slope calculations

Simon Hobson linux at thehobsons.co.uk
Tue Jan 22 09:00:39 CET 2008

```A Darren Dunham wrote:
>I'm doing some calculations with the Linear Slope tools in RRD.  While
>the y axis appears to be in normal value units (same as the data being
>graphed), the x axis seems to be in graph pixel units, not in UTC
>seconds or something like that.
>
>How do I convert from an arbitrary point along the graph (like 110.2)
>that I get from this calculation to the point in time that represents?

Each pixel is "t/p" units of time - where t is the time span of the
graph (you set it) and p is the number of pixels (you set that too).

So, if you draw a graph 400 pixels wide, to cover a period of 1 day,
then each pixel would be 86400/400 seconds, or 216seconds/pixel.

If you are looking for your pixels to match the stored data (eg 5
minute samples), then you will need to adjust one or other of the
values. Eg, 120,000seconds (1 day, 9 hours, 20 minutes) & 400 pixels;
or 1day & 288 pixels.

If you need to convert within the graph, then simply plug in the
correct figures to an RPN expression, eg :

t=p,400,*,86400,/,s,+

Given p as the number of pixels found from some other calculation,
400 & 86400 are the graph width and duration as given in the graph
command, and s is the graph start time (also given implicitly or
explicitly in the graph command); then t is the time you are looking
for.

```