avoid race conditions by always updating the chart in the gui thread