/* * RRD graphing libraries, based on Flot * Part of the javascriptRRD package * Copyright (c) 2010 Frank Wuerthwein, fkw@ucsd.edu * Igor Sfiligoi, isfiligoi@ucsd.edu * * Original repository: http://javascriptrrd.sourceforge.net/ * * MIT License [http://www.opensource.org/licenses/mit-license.php] * */ /* * * Flot is a javascript plotting library developed and maintained by * Ole Laursen [http://code.google.com/p/flot/] * */ /* * The rrd_files is a list of * [rrd_id,rrd_file] pairs * All rrd_files must have the same step, the same DSes and the same number of RRAs. * */ /* * The ds_list is a list of * [ds_id, ds_title] pairs * If not defined, the list will be created from the RRDs * */ /* * Local dependencies: * rrdFlotSupport.py * * External dependencies: * [Flot]/jquery.py * [Flot]/jquery.flot.js * [Flot]/jquery.flot.selection.js */ /* graph_options defaults (see Flot docs for details) * { * legend: { position:"nw",noColumns:3}, * lines: { show:true }, * yaxis: { autoscaleMargin: 0.20} * } * * rrd_graph_options is a dictionary of rrd_id, * with each element being a graph_option * The defaults for each element are * { * title: label or rrd_name // this is what is displayed in the checkboxes * checked: true // boolean * label: title or rrd_name // this is what is displayed in the legend * color: rrd_index // see Flot docs for details * lines: { show:true, fill: true, fillColor:color } // see Flot docs for details * } */ function rrdFlotMatrix(html_id, rrd_files, ds_list, graph_options, rrd_graph_options) { this.html_id=html_id; this.rrd_files=rrd_files; if (ds_list==null) { this.ds_list=[]; var rrd_file=this.rrd_files[0][1]; // get the first one... they are all the same var nrDSs=rrd_file.getNrDSs(); for (var i=0; i0) { for (var i=0; i=1) { // wraparound, change them a little idiv=Math.floor(i/std_colors.length); c1=parseInt(color[1]+color[2],16); c2=parseInt(color[3]+color[4],16); c3=parseInt(color[5]+color[6],16); m1=Math.floor((c1-128)/Math.sqrt(idiv+1))+128; m2=Math.floor((c2-128)/Math.sqrt(idiv+1))+128; m3=Math.floor((c3-128)/Math.sqrt(idiv+1))+128; if (m1>15) s1=(m1).toString(16); else s1="0"+(m1).toString(16); if (m2>15) s2=(m2).toString(16); else s2="0"+(m2).toString(16); if (m3>15) s3=(m3).toString(16); else s3="0"+(m3).toString(16); color="#"+s1+s2+s3; } rrd_colors.push(color); } } } else { // single element is not treated as an array if (oCB.rrd.checked==true) { // no sense trying to stack a single element rrd_list.push(this.rrd_files[0]); rrd_colors.push(std_colors[0]); } } // then extract RRA data about those DSs... to be finished var flot_obj=rrdRRAMultiStackFlotObj(rrd_list,rra_idx,ds_id); // fix the colors, based on the position in the RRD for (var i=0; i