Refactoring
Fix bugs with chart legend and setting