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