RGraph=window.RGraph||{isRGraph:true};RGraph.Effects=RGraph.Effects||{};RGraph.Effects.Rose=RGraph.Effects.Rose||{};RGraph.Rose=function(conf) {if(typeof conf==='object'&&typeof conf.data==='object'&&typeof conf.id==='string'){var parseConfObjectForOptions=true;}else{var conf={id:conf};conf.data=arguments[1];} this.id=conf.id;this.canvas=document.getElementById(this.id);this.context=this.canvas.getContext?this.canvas.getContext("2d"):null;this.data=conf.data;this.canvas.__object__=this;this.type='rose';this.isRGraph=true;this.uid=RGraph.CreateUID();this.canvas.uid=this.canvas.uid?this.canvas.uid:RGraph.CreateUID();this.colorsParsed=false;this.coordsText=[];this.original_colors=[];this.firstDraw=true;this.centerx=0;this.centery=0;this.radius=0;this.max=0;this.angles=[];this.angles2=[];this.properties={'chart.background.axes':true,'chart.background.axes.color':'black','chart.background.grid':true,'chart.background.grid.color':'#ccc','chart.background.grid.size':null,'chart.background.grid.radials':null,'chart.background.grid.count':5,'chart.centerx':null,'chart.centery':null,'chart.radius':null,'chart.angles.start':0,'chart.colors':['rgba(255,0,0,0.5)','rgba(255,255,0,0.5)','rgba(0,255,255,0.5)','rgb(0,255,0)','gray','blue','rgb(255,128,255)','green','pink','gray','aqua'],'chart.linewidth':1,'chart.colors.sequential':false,'chart.colors.alpha':null,'chart.margin':0,'chart.strokestyle':'#aaa','chart.gutter.left':25,'chart.gutter.right':25,'chart.gutter.top':25,'chart.gutter.bottom':25,'chart.title':'','chart.title.background':null,'chart.title.hpos':null,'chart.title.vpos':null,'chart.title.bold':true,'chart.title.font':null,'chart.title.x':null,'chart.title.y':null,'chart.title.halign':null,'chart.title.valign':null,'chart.labels':null,'chart.labels.color':null,'chart.labels.position':'center','chart.labels.axes':'nsew','chart.labels.boxed':false,'chart.labels.offset':0,'chart.text.color':'black','chart.text.font':'Arial','chart.text.size':12,'chart.key':null,'chart.key.background':'white','chart.key.position':'graph','chart.key.halign':'right','chart.key.shadow':false,'chart.key.shadow.color':'#666','chart.key.shadow.blur':3,'chart.key.shadow.offsetx':2,'chart.key.shadow.offsety':2,'chart.key.position.gutter.boxed':false,'chart.key.position.x':null,'chart.key.position.y':null,'chart.key.color.shape':'square','chart.key.rounded':true,'chart.key.linewidth':1,'chart.key.colors':null,'chart.key.interactive':false,'chart.key.interactive.highlight.chart.stroke':'black','chart.key.interactive.highlight.chart.fill':'rgba(255,255,255,0.7)','chart.key.interactive.highlight.label':'rgba(255,0,0,0.2)','chart.key.text.color':'black','chart.contextmenu':null,'chart.tooltips':null,'chart.tooltips.event':'onclick','chart.tooltips.effect':'fade','chart.tooltips.css.class':'RGraph_tooltip','chart.tooltips.highlight':true,'chart.highlight.stroke':'rgba(0,0,0,0)','chart.highlight.fill':'rgba(255,255,255,0.7)','chart.annotatable':false,'chart.annotate.color':'black','chart.zoom.factor':1.5,'chart.zoom.fade.in':true,'chart.zoom.fade.out':true,'chart.zoom.hdir':'right','chart.zoom.vdir':'down','chart.zoom.frames':25,'chart.zoom.delay':16.666,'chart.zoom.shadow':true,'chart.zoom.background':true,'chart.zoom.action':'zoom','chart.resizable':false,'chart.resize.handle.adjust':[0,0],'chart.resize.handle.background':null,'chart.adjustable':false,'chart.ymax':null,'chart.ymin':0,'chart.scale.decimals':null,'chart.scale.point':'.','chart.scale.thousand':',','chart.variant':'stacked','chart.variant.threed.depth':10,'chart.exploded':0,'chart.events.mousemove':null,'chart.events.click':null,'chart.animation.roundrobin.factor':1,'chart.animation.roundrobin.radius':true,'chart.animation.grow.multiplier':1,'chart.labels.count':5,'chart.segment.highlight':false,'chart.segment.highlight.count':null,'chart.segment.highlight.fill':'rgba(0,255,0,0.5)','chart.segment.highlight.stroke':'rgba(0,0,0,0)'} var linear_data=RGraph.arrayLinearize(this.data);for(var i=0;i0&&prop['chart.key'].length>=3){this.centerx=this.centerx-this.gutterRight+5;} if(typeof prop['chart.centerx']=='number')this.centerx=prop['chart.centerx'];if(typeof prop['chart.centery']=='number')this.centery=prop['chart.centery'];if(typeof prop['chart.radius']=='number')this.radius=prop['chart.radius'];if(!this.colorsParsed){this.parseColors();this.colorsParsed=true;} if(prop['chart.variant'].indexOf('3d')!==-1){var scaleX=1.5;this.context.setTransform(scaleX,0,0,1,(ca.width*scaleX-ca.width)*-0.5,0);} this.drawBackground();if(prop['chart.variant'].indexOf('3d')!==-1){RG.setShadow(this,'rgba(0,0,0,0.35)',0,15,25);for(var i=prop['chart.variant.threed.depth'];i>0;i-=1){this.centery-=1;this.drawRose({storeAngles:false});RG.setShadow(this,'rgba(0,0,0,0)',0,0,0);for(var j=0,len=this.angles.length;j-1){for(var i=0;i-1){for(var i=0;i-1){for(var i=0;i-1){for(var i=0;i0){RG.Text2(this,{'font':font,'size':size,'x':centerx,'y':centery,'text':typeof(prop['chart.ymin'])=='number'?RG.number_format(this,Number(prop['chart.ymin']).toFixed(prop['chart.scale.decimals']),units_pre,units_post):'0','valign':'center','halign':'center','bounding':true,'boundingFill':color,'boundingStroke':prop['chart.labels.boxed']?'black':'rgba(0,0,0,0)','tag':'scale'});}};this.drawCircularLabels=this.DrawCircularLabels=function(co,labels,font,size,radius) {var variant=prop['chart.variant'],position=prop['chart.labels.position'],radius=radius+5+prop['chart.labels.offset'],centerx=this.centerx,centery=this.centery+(prop['chart.variant'].indexOf('3d')!==-1?prop['chart.variant.threed.depth']:0),labelsColor=prop['chart.labels.color']||prop['chart.text.color'] for(var i=0;icenterx){halign='left';}else if(Math.round(x)==centerx){halign='center';}else{halign='right';} RG.text2(this,{'color':labelsColor,'font':font,'size':size,'x':x,'y':y,'text':String(labels[i]),'halign':halign,'valign':'center','tag':'labels'});}};this.getShape=this.getSegment=function(e) {RG.fixEventObject(e);var angles=this.angles;var ret=[];var opt=arguments[1]?arguments[1]:{radius:true};for(var i=0;i0){co.arc(shape['x'],shape['y'],shape['radius.start'],shape['angle.end'],shape['angle.start'],true);}else{co.lineTo(shape['x'],shape['y']);} co.closePath();co.stroke();co.fill();}};this.getObjectByXY=function(e) {var mouseXY=RGraph.getMouseXY(e);var radius=RG.getHypLength(this.centerx,this.centery,mouseXY[0],mouseXY[1]);if(prop['chart.variant'].indexOf('3d')!==-1){radius/=-1;} if(mouseXY[0]>(this.centerx-this.radius)&&mouseXY[0]<(this.centerx+this.radius)&&mouseXY[1]>(this.centery-this.radius)&&mouseXY[1]<(this.centery+this.radius)&&radius<=this.radius){return this;}};this.positionTooltip=function(obj,x,y,tooltip,idx) {var centerX=this.angles[idx][4],centerY=this.angles[idx][5]-(prop['chart.variant'].indexOf('3d')!==-1?prop['chart.variant.threed.depth']:0),radiusStart=this.angles[idx][2],radiusEnd=this.angles[idx][3],coordX=this.angles[idx][4],coordY=this.angles[idx][5]-(prop['chart.variant'].indexOf('3d')!==-1?prop['chart.variant.threed.depth']:0),angleStart=this.angles[idx][0],angleEnd=this.angles[idx][1],radius=((radiusEnd-radiusStart)/2)+radiusStart,angleCenter=((angleEnd-angleStart)/2)+angleStart,canvasXY=RG.getCanvasXY(this.canvas),gutterLeft=this.gutterLeft,gutterTop=this.gutterTop,width=tooltip.offsetWidth,height=tooltip.offsetHeight tooltip.style.overflow='';var img=new Image();img.src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAFCAYAAACjKgd3AAAARUlEQVQYV2NkQAN79+797+RkhC4M5+/bd47B2dmZEVkBCgcmgcsgbAaA9GA1BCSBbhAuA/AagmwQPgMIGgIzCD0M0AMMAEFVIAa6UQgcAAAAAElFTkSuQmCC';img.style.position='absolute';img.id='__rgraph_tooltip_pointer__';img.style.top=(tooltip.offsetHeight-2)+'px';tooltip.appendChild(img);if((canvasXY[0]+coordX+(Math.cos(angleCenter)*radius)-(width/2))<10){tooltip.style.left=(canvasXY[0]+coordX+(Math.cos(angleCenter)*(radius*(prop['chart.variant'].indexOf('3d')!==-1?1.5:1)))-(width*0.1))+'px';tooltip.style.top=(canvasXY[1]+coordY+(Math.sin(angleCenter)*radius)-height-5)+'px';img.style.left=((width*0.1)-8.5)+'px';}else if((canvasXY[0]+coordX+(Math.cos(angleCenter)*radius)+(width/2))>(doc.body.offsetWidth-10)){tooltip.style.left=(canvasXY[0]+coordX+(Math.cos(angleCenter)*(radius*(prop['chart.variant'].indexOf('3d')!==-1?1.5:1)))-(width*0.9))+'px';tooltip.style.top=(canvasXY[1]+coordY+(Math.sin(angleCenter)*radius)-height-5)+'px';img.style.left=((width*0.9)-8.5)+'px';}else{tooltip.style.left=(canvasXY[0]+coordX+(ma.cos(angleCenter)*(radius*(prop['chart.variant'].indexOf('3d')!==-1?1.5:1)))-(width/2))+'px';tooltip.style.top=(canvasXY[1]+coordY+(ma.sin(angleCenter)*radius)-height-5)+'px';img.style.left=((width*0.5)-8.5)+'px';}};this.getRadius=function(value) {if(value<0||value>this.max){return null;} var r=(value/this.max)*this.radius;return r;};this.parseColors=function() {if(this.original_colors.length===0){this.original_colors['chart.colors']=RG.array_clone(prop['chart.colors']);this.original_colors['chart.key.colors']=RG.array_clone(prop['chart.key.colors']);this.original_colors['chart.text.color']=RG.array_clone(prop['chart.text.color']);this.original_colors['chart.title.color']=RG.array_clone(prop['chart.title.color']);this.original_colors['chart.highlight.stroke']=RG.array_clone(prop['chart.highlight.stroke']);this.original_colors['chart.highlight.fill']=RG.array_clone(prop['chart.highlight.fill']);} for(var i=0;i