improved javascript charts refresh mechanism