folk from https://code.google.com/p/jqbargraph/