The yuan weakened against the dollar in offshore and onshore markets, dragged by China’s latest weak economic data.