Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Low data plotting resolution depending on graph width #1251

Open
light opened this issue Apr 29, 2024 · 0 comments
Open

Low data plotting resolution depending on graph width #1251

light opened this issue Apr 29, 2024 · 0 comments

Comments

@light
Copy link

light commented Apr 29, 2024

Bug description

At some graph widths, data gets displayed with low resolution, even though underlying RRA has enough data points.

To Reproduce

I'm using rrdtool python from Debian testing :

rrdtool/testing,now 1.7.2-4+b10
python3-rrdtool/testing,now 1.7.2-4+b10
  1. Generate some test data :
#!/usr/bin/env python3

import rrdtool, time

RRD_RRAS = [
   (1   , 4032),
   (2   , 4608),
   (6   , 6144),
   (24  , 4560),
   (72  , 6000),
   (288 , 3660),
   (576 , 5000),
   (2016, 5228),
]

START_TIME = int(time.time()) - 86400*366*10

args = [
   "test.rrd", "--step", "300", '--start', str(START_TIME),
   "DS:x:GAUGE:600:U:U"
]
for rra in RRD_RRAS:
   args.append(f"RRA:AVERAGE:0.1:{rra[0]}:{rra[1]}")
rrdtool.create(args)

for i in range(1, int(86400*366*10/300)):
   t = i * 300
   x = t % (86400*366)
   rrdtool.update("test.rrd", f'{START_TIME + t}:{x}')
  1. Generate 2 test graphs :
  • rrdtool graph test1.png -w 512 -h 200 --start -10y DEF:x=test.rrd:x:AVERAGE AREA:x#00FF00:x
    image
  • rrdtool graph test2.png -w 600 -h 200 --start -10y DEF:x=test.rrd:x:AVERAGE AREA:x#00FF00:x
    image

At 512 pixels width the graph looks jagged, and zooming reveals that it is drawn with 2 pixel resolution. Whereas at 600px wide, the graph seems relatively smooth.

The 288:3660 RRA has enough data for 300x288x3660 = 10 years (if I'm rounding 1 year = 366 days), so it should get picked, which would provide almost the full 3660 data points for plotting. The next RRA 576:5000, at 10y width, should have 366x10x86400/576/300 = 1830 data points so still enough to plot over 512px smoothly. The last RRA 2016:5228 has 366x10x86400/2016/300 = 522 points for the period, still enough.

@light light changed the title Low data point resolution depending on graph width Low data plotting resolution depending on graph width Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant