fix drawing chart when using with ajax