Stop messing with charting library and simply provide data through CSV. The UI will simply render sortable table.