broke up the updateChart function