added chart function