Added negative value check to prevent strange graphs