* ProtoChart is a charting lib on top of Prototype.
* This library is heavily motivated by excellent work done by:
* * Flot <http://code.google.com/p/flot/>
* * Flotr <http://solutoire.com/flotr/>
*
* Complete examples can be found at: <http://www.deensoft.com/lab/protochart>
*/
/**
* Events:
* ProtoChart:mousemove - Fired when mouse is moved over the chart
* ProtoChart:plotclick - Fired when graph is clicked
* ProtoChart:dataclick - Fired when graph is clicked AND the click is on a data point
* ProtoChart:selected - Fired when certain region on the graph is selected
* ProtoChart:hit - Fired when mouse is moved near or over certain data point on the graph
*/
if(!Proto)varProto={};
Proto.Chart=Class.create({
/**
* Function:
* {Object} elem
* {Object} data
* {Object} options
*/
initialize:function(elem,data,options)
{
options=options||{};
this.graphData=[];
/**
* Property: options
*
* Description: Various options can be set. More details in description.
*
* colors:
* {Array} - pass in a array which contains strings of colors you want to use. Default has 6 color set.
*
* legend:
* {BOOL} - show - if you want to show the legend. Default is false
* {integer} - noColumns - Number of columns for the legend. Default is 1
* {function} - labelFormatter - A function that returns a string. The function is called with a string and is expected to return a string. Default = null
* {string} - labelBoxBorderColor - border color for the little label boxes. Default #CCC
* {HTMLElem} - container - an HTML id or HTML element where the legend should be rendered. If left null means to put the legend on top of the Chart
* {string} - position - position for the legend on the Chart. Default value 'ne'
* {integer} - margin - default valud of 5
* {string} - backgroundColor - default to null (which means auto-detect)
* {float} - backgroundOpacity - leave it 0 to avoid background
*
* xaxis (yaxis) options:
* {string} - mode - default is null but you can pass a string "time" to indicate time series
* {integer} - min
* {integer} - max
* {float} - autoscaleMargin - in % to add if auto-setting min/max
* {mixed} - ticks - either [1, 3] or [[1, "a"], 3] or a function which gets axis info and returns ticks
* {function} - tickFormatter - A function that returns a string as a tick label. Default is null
* {float} - tickDecimals
* {integer} - tickSize
* {integer} - minTickSize
* {array} - monthNames
* {string} - timeformat
*
* Points / Lines / Bars options:
* {bool} - show, default is false
* {integer} - radius: default is 3
* {integer} - lineWidth : default is 2
* {bool} - fill : default is true
* {string} - fillColor: default is #ffffff
*
* Grid options:
* {string} - color
* {string} - backgroundColor - defualt is *null*
* {string} - tickColor - default is *#dddddd*
* {integer} - labelMargin - should be in pixels default is 3
* {integer} - borderWidth - default *1*
* {bool} - clickable - default *null* - pass in TRUE if you wish to monitor click events
f;a.runtimeStyle.height=k;if(arguments.length==3){c=arguments[1];d=arguments[2];h=(l=0);n=(e=q);o=(g=r)}elseif(arguments.length==5){c=arguments[1];d=arguments[2];e=arguments[3];g=arguments[4];h=(l=0);n=q;o=r}elseif(arguments.length==9){h=arguments[1];l=arguments[2];n=arguments[3];o=arguments[4];c=arguments[5];d=arguments[6];e=arguments[7];g=arguments[8]}else{throw"Invalid number of arguments";}vars=this.b(c,d),t=[],v=10,w=10;t.push(" <g_vml_:group",' coordsize="',m*v,",",m*w,'"',' coordorigin="0,0"',
g,";height:",h,';"',' coordorigin="0 0" coordsize="',m*g,"",m*h,'"',' stroked="',!a,'"',' strokeweight="',this.lineWidth,'"',' strokecolor="',d,'"',' path="');varl={x:null,y:null},n={x:null,y:null};for(varo=0;o<this.c.length;o++){varf=this.c[o];if(f.type=="moveTo"){b.push(" m ");vark=this.b(f.x,f.y);b.push(i(k.x),",",i(k.y))}elseif(f.type=="lineTo"){b.push(" l ");vark=this.b(f.x,f.y);b.push(i(k.x),",",i(k.y))}elseif(f.type=="close"){b.push(" x ")}elseif(f.type=="bezierCurveTo"){b.push(" c ");