Generalize fragment for chart/table, clean some js