RGraph=window.RGraph||{isRGraph:true};(function(win,doc,undefined) {var RG=RGraph,ua=navigator.userAgent,ma=Math;RGraph.installWindowMousedownListener=RGraph.InstallWindowMousedownListener=function(obj) {if(!RGraph.window_mousedown_event_listener){RGraph.window_mousedown_event_listener=function(e) {if(navigator.userAgent.indexOf('Firefox')>=0)win.event=e;e=RGraph.FixEventObject(e);if(RGraph.HideTooltip&&RGraph.Registry.Get('chart.tooltip')){RGraph.clear(RGraph.Registry.Get('chart.tooltip').__canvas__);RGraph.redraw();RGraph.hideTooltip();}};win.addEventListener('mousedown',RGraph.window_mousedown_event_listener,false);}};RGraph.installWindowMouseupListener=RGraph.InstallWindowMouseupListener=function(obj) {if(!RGraph.window_mouseup_event_listener){RGraph.window_mouseup_event_listener=function(e) {if(navigator.userAgent.indexOf('Firefox')>=0)win.event=e;e=RGraph.FixEventObject(e);if(RGraph.annotating_window_onmouseup){RGraph.annotating_window_onmouseup(e);return;} if(RGraph.Registry.Get('chart.adjusting')||RGraph.Registry.Get('chart.adjusting.gantt')){var obj=RGraph.Registry.Get('chart.adjusting');if(obj&&obj.type==='line'){obj.data_arr=RGraph.arrayLinearize(obj.data);} RGraph.FireCustomEvent(RGraph.Registry.Get('chart.adjusting'),'onadjustend');} RGraph.Registry.Set('chart.adjusting',null);RGraph.Registry.Set('chart.adjusting.shape',null);RGraph.Registry.Set('chart.adjusting.gantt',null);var tags=document.getElementsByTagName('canvas');for(var i=0;i=0)window.event=e;e=RGraph.fixEventObject(e);var objects=RGraph.ObjectRegistry.getObjectsByXY(e);if(objects){for(var i=0,len=objects.length;i=0)window.event=e;e=RGraph.FixEventObject(e);var objects=RGraph.ObjectRegistry.getObjectsByXY(e);if(objects&&objects.length>0){for(var i=0,len=objects.length;i=obj.coords.key[i][0]&&mouseXY[0]<=(obj.coords.key[i][0]+obj.coords.key[i][2])&&mouseXY[1]>=obj.coords.key[i][1]&&mouseXY[1]<=(obj.coords.key[i][1]+obj.coords.key[i][3])){RG.Registry.set('key-element',obj.coords.key[i]);overkey=true;} if(!overkey){RG.Registry.set('key-element',null);}}} var func=obj.Get('chart.events.mousemove');if(!func&&typeof obj.onmousemove=='function'){var func=obj.onmousemove;} if(shape){var index=shape['object'].type=='scatter'?shape['index_adjusted']:shape['index'];if(typeof(obj['$'+index])=='object'&&typeof(obj['$'+index].onmousemove)=='function'){var func2=obj['$'+index].onmousemove;}} if(shape&&(typeof(func)=='function'||typeof(func2)=='function'||typeof obj.Get('link')==='string')){if(obj.Get('chart.events.mousemove.revertto')==null){obj.Set('chart.events.mousemove.revertto',e.target.style.cursor);} if(typeof(func)=='function')func(e,shape);if(typeof(func2)=='function')func2(e,shape);}else if(typeof(obj.Get('chart.events.mousemove.revertto'))=='string'){RGraph.cursor.push('default');obj.Set('chart.events.mousemove.revertto',null);} if(shape&&(obj.Get('chart.tooltips')&&obj.Get('chart.tooltips')[shape['index']]||shape['tooltip'])&&(obj.Get('chart.tooltips.event')=='onmousemove'||obj.Get('chart.tooltips.event')=='mousemove')&&(RGraph.is_null(RGraph.Registry.Get('chart.tooltip'))||RGraph.Registry.Get('chart.tooltip').__index__!=shape['index']||(typeof(shape['dataset'])=='number'&&shape['dataset']!=RGraph.Registry.Get('chart.tooltip').__shape__['dataset'])||obj.uid!=RGraph.Registry.Get('chart.tooltip').__object__.uid)){RGraph.Clear(obj.canvas);RGraph.Redraw();obj.canvas.rgraph_mouseup_event_listener(e);return;} if(obj&&obj.Get('chart.adjustable')){obj.Adjusting_mousemove(e);} if(shape||(obj.overChartArea&&obj.overChartArea(e))){break;}}} if(e.target&&e.target.__object__&&e.target.__object__.Get('chart.crosshairs')){RGraph.DrawCrosshairs(e,e.target.__object__);} if(e.target.__object__&&e.target.__object__.Get('chart.annotatable')&&RGraph.annotating_canvas_onmousemove){RGraph.annotating_canvas_onmousemove(e);} RGraph.EvaluateCursor(e);};obj.canvas.addEventListener('mousemove',obj.canvas.rgraph_mousemove_event_listener,false);}};RGraph.installCanvasMousedownListener=RGraph.InstallCanvasMousedownListener=function(obj) {if(!obj.canvas.rgraph_mousedown_event_listener){obj.canvas.rgraph_mousedown_event_listener=function(e) {if(navigator.userAgent.indexOf('Firefox')>=0)window.event=e;e=RG.fixEventObject(e);if(e.target.__object__&&e.target.__object__.Get('chart.annotatable')&&RGraph.annotating_canvas_onmousedown){RGraph.annotating_canvas_onmousedown(e);return;} var obj=RG.ObjectRegistry.getObjectByXY(e);if(obj){var id=obj.id;if(obj&&obj.isRGraph&&obj.Get('chart.adjustable')){var obj=RGraph.ObjectRegistry.getObjectByXY(e);if(obj&&obj.isRGraph){switch(obj.type){case'bar':var shape=obj.getShapeByX(e);break;case'gantt':var shape=obj.getShape(e);if(shape){var mouseXY=RG.getMouseXY(e);RG.Registry.Set('chart.adjusting.gantt',{'index':shape['index'],'object':obj,'mousex':mouseXY[0],'mousey':mouseXY[1],'event_start':obj.data[shape['index']][0],'event_duration':obj.data[shape['index']][1],'mode':(mouseXY[0]>(shape['x']+shape['width']-5)?'resize':'move'),'shape':shape});} break;case'line':var shape=obj.getShape(e);break;default:var shape=null;} RG.Registry.Set('chart.adjusting.shape',shape);RGraph.fireCustomEvent(obj,'onadjustbegin');RG.Registry.Set('chart.adjusting',obj);RGraph.Clear(obj.canvas);RGraph.Redraw();obj.canvas.rgraph_mousemove_event_listener(e);}} RGraph.Clear(obj.canvas);RGraph.Redraw();}};obj.canvas.addEventListener('mousedown',obj.canvas.rgraph_mousedown_event_listener,false);}};RGraph.installCanvasClickListener=RGraph.InstallCanvasClickListener=function(obj) {if(!obj.canvas.rgraph_click_event_listener){obj.canvas.rgraph_click_event_listener=function(e) {if(navigator.userAgent.indexOf('Firefox')>=0)window.event=e;e=RG.FixEventObject(e);var objects=RG.ObjectRegistry.getObjectsByXY(e);for(var i=0,len=objects.length;iobj.coords.key[j][0]&&mouseX<(obj.coords.key[j][0]+obj.coords.key[j][2])&&mouseY>obj.coords.key[j][1]&&mouseY<(obj.coords.key[j][1]+obj.coords.key[j][3])){var pointer=true;}}}} if(!RGraph.is_null(shape)&&!RGraph.is_null(obj)){if(!RGraph.is_null(obj.Get('chart.events.mousemove'))&&typeof(obj.Get('chart.events.mousemove'))=='function'){var str=(obj.Get('chart.events.mousemove')).toString();if(str.match(/pointer/)&&str.match(/cursor/)&&str.match(/style/)){var pointer=true;}} if(!RGraph.is_null(obj.onmousemove)&&typeof(obj.onmousemove)=='function'){var str=(obj.onmousemove).toString();if(str.match(/pointer/)&&str.match(/cursor/)&&str.match(/style/)){var pointer=true;}} var index=shape['object'].type=='scatter'?shape['index_adjusted']:shape['index'];if(!RGraph.is_null(obj['$'+index])&&typeof(obj['$'+index].onmousemove)=='function'){var str=(obj['$'+index].onmousemove).toString();if(str.match(/pointer/)&&str.match(/cursor/)&&str.match(/style/)){var pointer=true;}}} var objects=RGraph.ObjectRegistry.objects.byCanvasID;for(var i=0,len=objects.length;i(e.target.width-32)&&mouseY>(e.target.height-16)){pointer=true;} if(pointer){e.target.style.cursor='pointer';}else if(e.target.style.cursor=='pointer'){e.target.style.cursor='default';}else{e.target.style.cursor=null;} if(resizable&&mouseX>=(e.target.width-15)&&mouseY>=(e.target.height-15)){e.target.style.cursor='move';}else if(e.target.style.cursor==='move'){e.target.style.cursor='default';} if(typeof mouse_over_key=='boolean'&&mouse_over_key){e.target.style.cursor='pointer';} if(obj&&obj.type=='line'&&obj.Get('chart.adjustable')){if(obj.getShape&&obj.getShape(e)){e.target.style.cursor='ns-resize';}else{e.target.style.cursor='default';}} if(e.target.__object__&&e.target.__object__.Get('chart.annotatable')){e.target.style.cursor='crosshair';} if(obj&&obj.type==='drawing.text'&&shape&&typeof obj.Get('link')==='string'){e.target.style.cursor='pointer';}};RGraph.parseTooltipText=function(tooltips,idx) {if(!tooltips){return null;} if(typeof tooltips=='function'){var text=tooltips(idx);}else if(typeof tooltips=='string'){var text=tooltips;}else if(typeof tooltips=='object'&&typeof tooltips[idx]=='function'){var text=tooltips[idx](idx);}else if(typeof tooltips[idx]=='string'&&tooltips[idx]){var text=tooltips[idx];}else{var text='';} if(text=='undefined'){text='';}else if(text=='null'){text='';} return RGraph.getTooltipTextFromDIV?RGraph.getTooltipTextFromDIV(text):text;};RGraph.drawCrosshairs=RGraph.DrawCrosshairs=function(e,obj) {var e=RGraph.FixEventObject(e);var width=obj.canvas.width;var height=obj.canvas.height;var mouseXY=RGraph.getMouseXY(e);var x=mouseXY[0];var y=mouseXY[1];var gutterLeft=obj.gutterLeft;var gutterRight=obj.gutterRight;var gutterTop=obj.gutterTop;var gutterBottom=obj.gutterBottom;var Mathround=Math.round;var prop=obj.properties;var co=obj.context;var ca=obj.canvas;RGraph.RedrawCanvas(ca);if(x>=gutterLeft&&y>=gutterTop&&x<=(width-gutterRight)&&y<=(height-gutterBottom)){var linewidth=prop['chart.crosshairs.linewidth']?prop['chart.crosshairs.linewidth']:1;co.lineWidth=linewidth?linewidth:1;co.beginPath();co.strokeStyle=prop['chart.crosshairs.color'];if(prop['chart.crosshairs.snap']){var point=null;var dist=null;var len=null;if(obj.type=='line'){for(var i=0;i '+xCoord+'
'+prop['chart.crosshairs.coords.labels.y']+': '+yCoord;obj.canvas.addEventListener('mouseout',RGraph.HideCrosshairCoords,false);ca.__crosshairs_labels__=div;ca.__crosshairs_x__=xCoord;ca.__crosshairs_y__=yCoord;}else if(prop['chart.crosshairs.coords']){alert('[RGRAPH] Showing crosshair coordinates is only supported on the Scatter chart');} RGraph.FireCustomEvent(obj,'oncrosshairs');}else{RGraph.HideCrosshairCoords();}};RG.allowSegmentHighlight=function(opt) {var obj=opt.object;var count=opt.count;var fill=opt.fill;var stroke=opt.stroke;if(!RGraph.segmentHighlightFunction){RGraph.segmentHighlightFunction=function(e) {var mouseXY=RG.getMouseXY(e);var angle=RG.getAngleByXY(obj.centerx,obj.centery,mouseXY[0],mouseXY[1]);angle+=RG.HALFPI;if(angle>RG.TWOPI){angle-=RG.TWOPI;} RG.redraw();var start=0;var end=0;var a=(ma.PI*2)/count;var r=obj.radius;(function() {for(i=0;i