Refactoring data processing and chart updating.