Chart simplified as a function

Easier way to construct charts as chart generator code has been
converted in a js function