(function(){u8.Base.Charts.AnyRenderer=function(e){$.extend(this,e);this.bind(e)};var e={Bar2D:{name:"Bar"},BarStacked2D:{name:"BarStacked"},Pie2D:{name:"Pie"},Line2D:{name:"Line"},AreaStacked2D:{name:"AreaStacked"}};u8.Base.Charts.AnyRenderer.makeClass({name:"AnyRenderer",events:["Click"]});$.extend(u8.Base.Charts.AnyRenderer.prototype,{render:function(a,t,r){var n=this;var s=$w(a);var i=s.$;var d=$p(s);n.chartModel=t;if(typeof s.AnyCharts=="undefined"){return d.factory.scripts.load([[d.resolveUrl("~/scripts/lib/anycharts/AnyChart.js")],[d.resolveUrl("~/scripts/lib/anycharts/AnyChartHTML5.js")]],l)}l();function l(){var d={chart:{chart_settings:{legend:{enabled:t.options.showLegend?true:false}},data_plot_settings:{},data:{series:[]}}};var l,o,c=t.options&&t.options.chartType||"Bar";var h=e[c]||{type:"Bar"};switch(h.name){case"Pie":n._createPieChartModel(t,d);break;case"BarStacked":n._createBarStackedChartModel(t,d);break;case"Line":n._createLineChartModel(t,d);break;case"AreaStacked":n._createAreaStackedChartModel(t,d);break;default:n._createBarChartModel(t,d);break}i.extend(true,d,t.options.rendererOptions);l=i.extend({charts:n._createSeries(t,d)},{});if(n.useFlash){s.AnyChart.renderingType=s.anychart.RenderingType.FLASH_ONLY}else{s.AnyChart.renderingType=s.anychart.RenderingType.SVG_ONLY}o=i(a).data("any-chart");if(o){i(a).empty()}o=new s.AnyChart;o.width=t.options.width||400;o.height=t.options.height||300;o.addEventListener("pointClick",n._onPointClick.bind(n));i(a).data("any-chart",o);o.setData(s.AnyChart.utils.JSConverter.convert(l));o.write(a);if(r){r(n,{})}}},_onPointClick:function(e){var a=this.chartModel.series.findKey(u8._.eqish("label",e.data.Series.Name));var t=e.data.Index;var r=this;var n={seriesIndex:a===undefined?-1:a,valueIndex:t===undefined?-1:t,elEvent:jQuery.Event("click",{clientX:e.mouseX,clientY:e.mouseY,originalEvent:e})};(function(){r.raise("Click",n)}).defer(0)},_createBarChartModel:function(e,a){a.chart.data_plot_settings={default_series_type:"Bar",enable_3d_mode:false,bar_series:{label_settings:{enabled:e.options.showValues?true:false}}}},_createBarStackedChartModel:function(e,a){a.chart.data_plot_settings={default_series_type:"Bar",enable_3d_mode:false,bar_series:{label_settings:{enabled:e.options.showValues?true:false}}};a.chart.chart_settings.axes={y_axis:{scale:{mode:"Stacked"}}}},_createLineChartModel:function(e,a){a.chart.data_plot_settings={default_series_type:"Line",enable_3d_mode:false,line_series:{label_settings:{enabled:e.options.showValues?true:false}}}},_createPieChartModel:function(e,a){a.chart.data_plot_settings={pie_series:{label_settings:{enabled:e.options.showValues?true:false}}};a.chart.plot_type="Pie"},_createAreaStackedChartModel:function(e,a){a.chart.data_plot_settings={default_series_type:"Area",enable_3d_mode:false,area_series:{label_settings:{enabled:e.options.showValues?true:false}}};a.chart.chart_settings.axes={y_axis:{scale:{mode:"Stacked"}}}},_createSeries:function(e,a){var t=e.series||[];var r=e.values;var n=t.length;for(var s=0;s<n;s++){var i=0;var d=t[s];var l={point:(r||[]).map(function(e){return $.extend({name:e.label,y:d.values[i++]},e.rendererOptions)}),name:d.label};a.chart.data.series[s]=$.extend(l,d.rendererOptions)}return a}});$.extend(u8.Base.Charts.renderers,{any:{ctor:u8.Base.Charts.AnyRenderer,options:{}}})})();