html5 graphing with high order procedure