fixing calculateGraphFormula(