Fixed error in chart calculation