Time series plot uses data retrieved from database