fixed "divide by zero" exception when calling clearChart()