/* this file was automatically generated */ static char graph_js[] = "/* darkstat 3\n" " * copyright (c) 2006, 2007 Emil Mikulic.\n" " *\n" " * graph.js: graph renderer\n" " *\n" " * You may use, modify and redistribute this file under the terms of the\n" " * GNU General Public License version 2. (see COPYING.GPL)\n" " *\n" " * ---------------------------------------------------------------------\n" " * In my testing, this script worked correctly in:\n" " * - Firefox 1.5.0.4, 2.0.0.1\n" " * - IE 6.0\n" " * - Opera 8.53\n" " */\n" "\n" "/* need:\n" " * - graph_width\n" " * - graph_height\n" " * - bar_gap\n" " *\n" " * - graphs [ {id, name, title, bar_secs} ]\n" " * - graphs_uri\n" " *\n" " * - window.onload = graph_loader\n" " *\n" " * in CSS:\n" " * - div.graph\n" " * - div.graph div.bar_in\n" " * - div.graph div.bar_out\n" " * - div.graphtitle\n" " */\n" "\n" "function killChildren(elem) {\n" " while (elem.childNodes.length > 0)\n" " elem.removeChild( elem.childNodes.item(0) );\n" "}\n" "\n" "function thousands(n) {\n" " var s = String(n);\n" " var out = \"\";\n" " while (s.length > 3) {\n" " out = \",\" + s.substr(-3) + out;\n" " s = s.substr(0, s.length - 3);\n" " }\n" " return s+out;\n" "}\n" "\n" "var xh;\n" "\n" "function graph_loader() {\n" " for (var i=0; i4G? */\n" " if (b_total > total_max)\n" " total_max = b_total;\n" " data.push( [b_pos, b_in, b_out] );\n" " }\n" "\n" " var igraph = document.createElement(\"div\"); // inner graph\n" " igraph.setAttribute(\"class\", \"graph\");\n" " igraph.setAttribute(\"className\", \"graph\"); //IE\n" " igraph.style.cssText =\n" " \"width:\"+graph_width+\"px; \"+\n" " \"height:\"+graph_height+\"px; \"+\n" " \"position:relative;\";\n" " igraph.setAttribute(\"style\", igraph.style.cssText);\n" "\n" " var nbars = data.length;\n" " var b_width = (graph_width - bar_gap * (nbars-1)) / nbars;\n" " var next_xofs = 0;\n" "\n" " for (var i=0; i