refactored to new chart class