init nchart using new function after dom has been loaded