var RColor=function(){this.hue=Math.random(),this.goldenRatio=.618033988749895};RColor.prototype.hsvToRgb=function(t,a,e){var r=Math.floor(6*t),i=6*t-r,s=e*(1-a),o=e*(1-i*a),h=e*(1-(1-i)*a),l=255,n=255,u=255;switch(r){case 0:l=e,n=h,u=s;break;case 1:l=o,n=e,u=s;break;case 2:l=s,n=e,u=h;break;case 3:l=s,n=o,u=e;break;case 4:l=h,n=s,u=e;break;case 5:l=e,n=s,u=o}return[Math.floor(256*l),Math.floor(256*n),Math.floor(256*u)]},RColor.prototype.get=function(t,a,e){this.hue+=this.goldenRatio,this.hue%=1,"number"!=typeof a&&(a=.5),"number"!=typeof e&&(e=.95);var r=this.hsvToRgb(this.hue,a,e);return t?"#"+r[0].toString(16)+r[1].toString(16)+r[2].toString(16):r};var WysijaCharts={charts:[],axes:{},chartsCount:0,current:null,getData:function(t){return void 0===t?!1:(jQuery.get(t,function(t){return t.result.success===!0&&t.result.data?(this.current.dataProvider=t.result.data,this.current.validateData(),!0):void 0}.bind(this)),!1)},generateChart:function(t,a,e){void 0!==WysijaCharts[t+"Chart"]&&WysijaCharts[t+"Chart"](a,e)},serialChart:function(t,a){var e=new AmCharts.AmSerialChart;e.categoryField=a.category,e.color="#333333",e.fontSize=12,e.startDuration=0,e.plotAreaFillAlphas=.2;var r=e.categoryAxis;return r.gridAlpha=.2,r.gridPosition="start",r.gridColor="#AAAAAA",r.axisColor="#AAAAAA",r.axisAlpha=.5,r.dashLength=5,jQuery.each(a.axes,function(t,a){var r=new AmCharts.ValueAxis;r.gridAlpha=.2,r.gridColor="#AAAAAA",r.axisColor="#AAAAAA",r.axisAlpha=.5,r.dashLength=5,r.title=a.title,r.titleColor="#999999",void 0!==a.stackType&&(r.stackType=a.stackType),r.position=a.position||"left",void 0!==a.valueMin&&(r.minimum=a.valueMin),void 0!==a.valueMax&&(r.maximum=a.valueMax),e.addValueAxis(r),WysijaCharts.axes[t]=r,jQuery.each(a.graphs,function(r,i){var s=new AmCharts.AmGraph;switch(s.title=i.title,s.valueField=i.valueField,s.type=a.graphType,s.type){case"line":s.lineThickness=1,s.bullet="square";break;case"column":s.lineAlpha=1,s.fillAlphas=.6}s.valueAxis=WysijaCharts.axes[t],s.balloonText="[[value]] [[title]]",e.addGraph(s)});var i=new AmCharts.ChartCursor;i.zoomable=!1,i.cursorAlpha=0,e.addChartCursor(i);var s=new AmCharts.AmLegend;e.addLegend(s)}),void 0!==a.title&&e.addTitle(a.title),void 0===a.data?(alert("missing data provider"),!1):(e.dataProvider=a.data,e.validateData(),this.chartsCount=this.charts.push(e),this.charts[this.chartsCount-1].elementId=t,this.current=this.charts[this.chartsCount-1],void this.current.write(this.current.elementId))},pieChart:function(t,a){var e=null;if(e=new AmCharts.AmPieChart,e.titleField=a.titleField,e.color="#333333",e.fontSize=12,e.valueField=a.valueField,e.sequencedAnimation=!0,e.startEffect="elastic",e.innerRadius="30%",e.startDuration=0,e.labelRadius=15,void 0!==a.threeD&&(e.depth3D=10,e.angle=15),void 0!==a.title&&e.addTitle(a.title),void 0!==a.data)e.dataProvider=a.data,e.validateData();else{if(void 0===a.url)return alert("missing data provider"),!1;this.getData(a.url,function(t){e.dataProvider=t}.bind(e))}this.chartsCount=this.charts.push(e),this.charts[this.chartsCount-1].elementId=t,this.current=this.charts[this.chartsCount-1],this.current.write(this.current.elementId)}};