fix drawing chart when using with ajax

When using with ajax, `chartCreated ` is always null which causes errors, as the chart hasn't been created until ajax succeeded.