Improve chart performance, fix chart bugs