move chart logic into Telegraph so we can save chart type