rewrite cost graphs with flot