var wijmo;define(["./wijmo.wijchartcore","exportUtil"],function(){(function(e){(function(t){function r(e){var n=new i(e.serviceUrl,e.method),r={fileName:e.fileName,height:e.height,width:e.width,widgetName:e.widgetName,widgetOptions:e.widgetOptions,HTMLContent:e.HTMLContent,widget:e.chart,type:e.exportFileType,pdfSetting:e.pdf},s=n.getExportData(r);t.exportFile(e,s)}function s(t,r,i,s,o){var u,a,f={},l,c;u=r===undefined?"png":r,u=u.substr(0,1).toUpperCase()+u.substr(1),a=o===undefined?"Options":o,a=a.substr(0,1).toUpperCase()+a.substr(1),typeof i=="string"&&arguments.length===3?l=i:(l=s===undefined?"http://demos.componentone.com/ASPNET/ExportService/exportapi/chart":s,f=i),$.isPlainObject(t)?c=t:c={serviceUrl:l,fileName:t===undefined?"export":t,pdf:f,method:n[a],chart:this,exportFileType:e.exporter.ExportFileType[u]},e.exporter.exportChart(c)}(function(e){e[e.Content=0]="Content",e[e.Options=1]="Options"})(t.ChartExportMethod||(t.ChartExportMethod={}));var n=t.ChartExportMethod;t.exportChart=r;var i=function(){function e(e,t){this.serviceUrl=e,this.method=t}return e.prototype.getExportData=function(e){var n;return this.options=e,this._handleExportOption(),n={fileName:e.fileName,width:e.width,height:e.height,type:e.type,pdfSettings:e.pdfSetting},this.method===0?n.content=e.HTMLContent:(n.options=e.widgetOptions,n.widgetName=e.widgetName),t.toJSON(n,function(e,t){if(e==="type")switch(t){case 6:return"bmp";case 7:return"gif";case 5:return"jpg";case 3:return"pdf";case 8:return"tiff";default:return"png"}return t})},e.prototype._handleExportOption=function(){var e=this.options;e.widget&&(this.method==0?e.HTMLContent=e.widget.chartElement[0].outerHTML:(e.widgetName=this._getWidgetName(),e.widgetOptions=t.toJSON(this._handleChartOptions(e.widget,e.widgetName),function(e,t){if(t!=null)return t})),e.width=e.widget.chartElement.width(),e.height=e.widget.chartElement.height())},e.prototype._getWidgetName=function(){return this.options.widget?this.options.widget.widgetName:""},e.prototype._handleChartOptions=function(e,t){var n=e.options,r=$.extend(!0,{},n,{animation:{enabled:!1},seriesTransition:{enabled:!1},hint:{enable:!1}});return delete r.wijCSS,delete r.seriesHoverStyles,t==="wijbarchart"?this._handleBarChartOptions(r):t==="wijcandlestickchart"?this._handleCandlestickChartOptions(r,e):t==="wijcompositechart"&&this._handleCompositeChartOptions(r,e),this._handleAxis(r),r},e.prototype._handleAxis=function(e){var t=this;this._removeAuto(e.axis.x),$.isArray(e.axis.y)?$.each(e.axis.y,function(e,n){t._removeAuto(n)}):this._removeAuto(e.axis.y)},e.prototype._handleBarChartOptions=function(e){if(e.horizontal){var t=e.axis.x.compass;e.axis.x.compass=e.axis.y.compass,e.axis.y.compass=t}},e.prototype._handleCandlestickChartOptions=function(e,t){$.each(e.seriesList,function(e,n){n.data&&n.data.x&&$.each(n.data.x,function(e,r){typeof r=="number"&&(n.data.x[e]=t.timeUtil.getTime(r))})})},e.prototype._handleCompositeChartOptions=function(e,t){t.isContainsCandlestick&&t.timeUtil&&$.each(e.seriesList,function(e,n){n.data&&n.data.x&&$.each(n.data.x,function(e,r){typeof r=="number"&&(n.data.x[e]=t.timeUtil.getTime(r))})})},e.prototype._removeAuto=function(e){e.autoMax&&delete e.max,e.autoMin&&delete e.min,e.autoMajor&&delete e.unitMajor,e.autoMinor&&delete e.unitMinor},e}();t.chartExport=i,t.innerExportChart=s,e.chart&&e.chart.wijchartcore&&(e.chart.wijchartcore.prototype.exportChart=s);var o=["wijbarchart","wijbubblechart","wijcandlestickchart","wijcompositechart","wijlinechart","wijpiechart","wijscatterchart"];$.each(o,function(e,t){if(!$.wijmo[t])return;$.wijmo[t].prototype.exportChart=s})})(e.exporter||(e.exporter={}));var t=e.exporter})(wijmo||(wijmo={}))});