Describe the bug
Only occurs if you are using a non-typical RRA profil. In my case only archive LAST will be created and used within the graph template.
Graph debug returns more than 20 times "Undefined offset: 1 ...." .
Solution
Simple to fix as the issue occurs in /lib/functions.php -- function generate_graph_best_cf:

Due to the reason that $avail_cf_functions hasn't been touched before line 2707
$best_cf = current($avail_cf_functions);
would be appropriate to return the first element.
Screenshots

- Version
Cacti 1.2.19 and above