/*!@license * Infragistics.Web.ClientUI infragistics.dv_dataseriesadapter.js 19.1.20191.172 * * Copyright (c) 2011-2019 Infragistics Inc. * * http://www.infragistics.com/ * * Depends: * jquery-1.4.4.js * jquery.ui.core.js * jquery.ui.widget.js * infragistics.util.js * infragistics.ext_core.js * infragistics.ext_collections.js * infragistics.dv_core.js * infragistics.dv_datasource.js */ (function(factory){if(typeof define==="function"&&define.amd){define(["./infragistics.util","./infragistics.ext_core","./infragistics.ext_collections","./infragistics.dv_core","./infragistics.dv_datasource"],factory)}else{factory(igRoot)}})(function($){$.ig=$.ig||{};var $$t={};$.ig.globalDefs=$.ig.globalDefs||{};$.ig.globalDefs.$$x=$$t;$$0=$.ig.globalDefs.$$0;$$4=$.ig.globalDefs.$$4;$$1=$.ig.globalDefs.$$1;$$w=$.ig.globalDefs.$$w;$$y=$.ig.globalDefs.$$y;$$6=$.ig.globalDefs.$$6;$.ig.$currDefinitions=$$t;$.ig.util.bulkDefine(["IDataSeriesAdapterRule:b","DataSeriesAdapterRunContext:c","DataSeriesDataProviderAnalyzer:d","IExternalDataSeriesAdapter:l","DataSeriesAdapterUpdateNotifier:m","DataSeriesAdapterRuleCollection:n","DataSeriesAdapterRemovingDuplicatesEventHandler:p","DataSeriesAdapterRemovingDuplicatesEventArgs:q","DataSeriesAdapterRunEventHandler:r","DataSeriesAdapterRunEventArgs:s","DataSeriesAdapterImplementation:t"]);var $a=$.ig.intDivide,$b=$.ig.util.cast,$c=$.ig.util.defType,$d=$.ig.util.defEnum,$e=$.ig.util.getBoxIfEnum,$f=$.ig.util.getDefaultValue,$g=$.ig.util.getEnumValue,$h=$.ig.util.getValue,$i=$.ig.util.intSToU,$j=$.ig.util.nullableEquals,$k=$.ig.util.nullableIsNull,$l=$.ig.util.nullableNotEquals,$m=$.ig.util.toNullable,$n=$.ig.util.toString$1,$o=$.ig.util.u32BitwiseAnd,$p=$.ig.util.u32BitwiseOr,$q=$.ig.util.u32BitwiseXor,$r=$.ig.util.u32LS,$s=$.ig.util.unwrapNullable,$t=$.ig.util.wrapNullable,$u=String.fromCharCode,$v=$.ig.util.castObjTo$t,$w=$.ig.util.compare,$x=$.ig.util.replace,$y=$.ig.util.stringFormat,$z=$.ig.util.stringFormat1,$0=$.ig.util.stringFormat2,$1=$.ig.util.stringCompare1,$2=$.ig.util.stringCompare2,$3=$.ig.util.stringCompare3,$4=$.ig.util.isDigit,$5=$.ig.util.isDigit1,$6=$.ig.util.isLetter,$7=$.ig.util.isNumber,$8=$.ig.util.isLetterOrDigit,$9=$.ig.util.isLower,$aa=$.ig.util.toLowerCase,$ab=$.ig.util.toUpperCase,$ac=$.ig.util.compareSimple,$ad=$.ig.util.tryParseNumber,$ae=$.ig.util.tryParseNumber1,$af=$.ig.util.numberToString,$ag=$.ig.util.numberToString1,$ah=$.ig.util.parseNumber;$d("DataSeriesMarker:k",false,false,{Automatic:0,None:1,Circle:2,Triangle:3,Pyramid:4,Square:5,Diamond:6,Pentagon:7,Hexagon:8,Tetragram:9,Pentagram:10,Hexagram:11,Hidden:12});$d("DataSeriesAxisType:j",false,false,{Category:0,Linear:1,Logarithmic:2,ContinuousDateTime:3,DiscreteDateTime:4});$d("DataSeriesType:i",false,false,{Line:0,Column:1,Area:2,Bar:3,StepLine:4,StepArea:5,Spline:6,SplineArea:7,Waterfall:8,Stacked:9,Point:10,ScatterPoint:11,ScatterLine:12,ScatterSpline:13,ScatterArea:14,ScatterContour:15,ScatterHighDensity:16,ScatterBubble:17,ScatterPolygon:18,ScatterPolyline:19,FinancialPrice:20,FinancialIndicator:21,FinancialOverlay:22,ValueOverlay:23,Unknown:24,ItemToolTipLayer:25,CategoryToolTipLayer:26,CrosshairLayer:27,CalloutLayer:28,FinalValueLayer:29,CategoryHighlightLayer:30,CategoryItemHighlightLayer:31});$d("DataSeriesIntent:h",false,false,{PrimarySeriesValue:0,SeriesX:1,SeriesY:2,SeriesFill:3,SeriesLabel:4,SeriesRadius:5,SeriesAngle:6,SeriesShape:7,SeriesValue:8,SeriesGroup:9,SeriesTitle:10,OpenSeriesValue:11,HighSeriesValue:12,LowSeriesValue:13,CloseSeriesValue:14,VolumeSeriesValue:15,AxisLabelValue:16,AxisDateValue:17,DontPlot:18,SalesUnit:19,SalesFixedCost:20,SalesVariableCost:21,SalesTotalCost:22,SalesRevenue:23,SalesMarginalProfit:24,GenerationInput:25});$c("IExternalDataSeriesAdapter:l","Object",{$type:new $.ig.Type("IExternalDataSeriesAdapter",null)},true);$c("DataSeriesAdapter:a","Object",{_e:null,f:null,init:function(){this.f=new $$4.x($$0.$e.$type.specialize($$t.$a.$type,Array),0);$.ig.$op.init.call(this);this._e=new $$t.t;this._e._q=this;var a=this._e.dataSeries();a.collectionChanged=$.ig.Delegate.prototype.combine(a.collectionChanged,this.j.runOn(this))},j:function(a,b){for(var c=0;c0;var i=c>1;if(f==e){if(h){b.add(" ")}c++}else if(g==e){if(i){b.insert(b.count()-1," ")}c=0}else{c=0}b.add(e)}var j=String.empty();for(var k=0;k0},getAllStringProperties:function(){return this.n(function(a){return a==0},null)},isCollection:function(a){if($b($$0.$bt.$type,a)!==null||$b(Array,a)!==null){return true}return false},getAllPropertiesWithName:function(a){return this.n(null,function(b){return b==a})},getAllNumericProperties:function(){return this.n(this.ae.runOn(this),null)},getAllObjectProperties:function(){return this.n(this.af.runOn(this),null)},getAllCollectionProperties:function(){var a=this.getAllObjectProperties();if(a.length==0){return new Array(0)}var b=this._p.getCurrentDataSource();var c=new $$4.x(String,0);for(var d=0;d0},ab:function(a){if(a==8||a==9){return true}return false},q:function(a){var b=this._p.getCurrentDataSource();if(b==null){return 11}var c=b.actualSchema();if(c==null){return 11}var d=-1;for(var e=0;e1){continue}if(c&&k.length<2){continue}if(String.equalsStatic(a.toLowerCase(),k[0].toLowerCase())){g++}}}var l=new Array(g);g=0;for(var m=0;m1){continue}if(c&&p.length<2){continue}if(String.equalsStatic(a.toLowerCase(),o.toLowerCase())){l[g]=e.propertyNames()[m];g++}}}return l},getAllDateTimeProperties:function(){return this.n(this.ab.runOn(this),null)},getFirstDateTimeProperty:function(){var a=this.getAllDateTimeProperties();if(a.length==0){return null}return a[0]},getFirstStringProperty:function(){var a=this.getAllStringProperties();if(a.length==0){return null}return a[0]},hasDateTimeProperties:function(){return this.getAllDateTimeProperties().length>0},ae:function(a){return a==1||a==3||a==4||a==7||a==5||a==6||a==10},af:function(a){return a==11},isMonotonic:function(a,b,c){if(a==null){return false}var d=false;var e=false;var f=a.actualCount();for(var g=0;gh;e=true}if(h==i){continue}if(e){var j=i>h;if(j!=d){return false}}}return true},aw:function(a,b,c){var d=this._p.getCurrentDataSource();var e=d.actualSchema();if(e==null){return null}var f=this.n(b,null);if(f.length==0){return null}if(d.actualCount()>a){return null}for(var g=0;g0&&g!=e){d+=" - "+g}e=g}}}}if(d==null){var h=this.getAllPropertiesWithValuelessIntent($$t.$h.$getName(10));if(h!=null&&h.length>0){d=h[0];d=this.aq(a,c,d)}}if(d==null){if(this.getParentTitle()!=null){d=this.getParentTitle()}}if(d==null&&a!=null){var i=this.getAllStringProperties();for(var k=0;k0){return c[0]}return function(d){return d!=null?d:a.analyzer().getFirstDateTimeProperty()}(a.analyzer().getFirstDistinctDateTimeProperty(b))},b:function(a,b){var c=a.analyzer().getAllPropertiesWithIntent($$t.$h.$getName(17));if(c.length>0){return c[0]}c=a.analyzer().getAllPropertiesWithIntent($$t.$h.$getName(16));if(c.length>0){return c[0]}return function(d){return d!=null?d:function(e){return e!=null?e:function(f){return f!=null?f:a.analyzer().getFirstStringProperty()}(a.analyzer().getFirstDistinctMonotonicNumericProperty(b))}(a.analyzer().getFirstDistinctStringProperty(b))}(a.analyzer().getFirstDistinctDateTimeProperty(b))},evaluate:function(a){var b=$$t.$u.d(a,this.distinctCheckThreshold());var c=$$t.$u.b(a,this.distinctCheckThreshold());var d=new $$4.x(String,1,a.analyzer().getAllPropertiesWithIntent($$t.$h.$getName(11)));var e=new $$4.x(String,1,a.analyzer().getAllPropertiesWithIntent($$t.$h.$getName(12)));var f=new $$4.x(String,1,a.analyzer().getAllPropertiesWithIntent($$t.$h.$getName(13)));var g=new $$4.x(String,1,a.analyzer().getAllPropertiesWithIntent($$t.$h.$getName(14)));var h=new $$4.x(String,1,a.analyzer().getAllPropertiesWithIntent($$t.$h.$getName(15)));var i=Math.min(d.count(),Math.min(e.count(),Math.min(f.count(),g.count())));if(i==0){var j=new $$4.x(String,1,a.analyzer().getAllNumericProperties());var l=j.getEnumerator();while(l.moveNext()){var k=l.current();if(String.equalsStatic(k.toLowerCase(),"open")){d.add(k);continue}if(String.equalsStatic(k.toLowerCase(),"high")){e.add(k);continue}if(String.equalsStatic(k.toLowerCase(),"low")){f.add(k);continue}if(String.equalsStatic(k.toLowerCase(),"close")){g.add(k);continue}if(String.equalsStatic(k.toLowerCase(),"volume")){h.add(k);continue}}this.e(j,d);this.e(j,e);this.e(j,f);this.e(j,g);this.e(j,h);var m=d.count()+e.count()+f.count()+g.count()+j.count();if(m==0){return}i=m<=4?1:$.ig.truncate(Math.floor(m/5));var n=[d,e,f,g,h];var o=0;while(j.count()>0){n[o++%n.length].add(j.__inner[0]);j.removeAt(0)}}var p=this.c(a.getCurrentDataSource());for(var q=0;qq?d.__inner[q]:null;var s=e.count()>q?e.__inner[q]:null;var t=f.count()>q?f.__inner[q]:null;var u=g.count()>q?g.__inner[q]:null;var v=function(){var $ret=new $$t.f;$ret.name($.ig.util.stringJoin("_",[r,s,t,u]));$ret.title(a.analyzer().getTitleString(null,[r,s,t,u]));$ret.suggestedSeries(20);$ret.suggestedPrimaryAxis(0);$ret.suggestedSecondaryAxis(1);return $ret}();v.addMemberPathHint(function(){var $ret=new $$t.g;$ret.intent(11);$ret.path(r);return $ret}());v.addMemberPathHint(function(){var $ret=new $$t.g;$ret.intent(12);$ret.path(s);return $ret}());v.addMemberPathHint(function(){var $ret=new $$t.g;$ret.intent(13);$ret.path(t);return $ret}());v.addMemberPathHint(function(){var $ret=new $$t.g;$ret.intent(14);$ret.path(u);return $ret}());if(h.count()>q){v.addMemberPathHint(function(){var $ret=new $$t.g;$ret.intent(15);$ret.path(h.__inner[q]);return $ret}())}if(b!=null){v.addMemberPathHint(function(){var $ret=new $$t.g;$ret.intent(17);$ret.path(b);return $ret}())}v.addMemberPathHint(function(){var $ret=new $$t.g;$ret.intent(16);$ret.path(c);return $ret}());a.addDataSeries(v,this);a.popParentTitle()}},c:function(a){var b=a==null?null:a.dataSource();if(b==null){return null}var c=typeof b.title==="function";return c?b.title():b.title?b.title:null},$type:new $.ig.Type("SimpleFinancialPriceSeriesRule",$.ig.$ot,[$$t.$b.$type])},true);$c("SimpleScatterSeriesRule:v","Object",{init:function(){$.ig.$op.init.call(this);this.priority(9);this.monotonicCheckAmount(1e4)},_priority:0,priority:function(a){if(arguments.length===1){this._priority=a;return a}else{return this._priority}},_monotonicCheckAmount:0,monotonicCheckAmount:function(a){if(arguments.length===1){this._monotonicCheckAmount=a;return a}else{return this._monotonicCheckAmount}},evaluate:function(a){var b=a.analyzer().getAllNumericProperties();if(b.length==0){return}var c=a.getCurrentDataSource().actualCount();var d=new $$4.x(String,0);for(var e=0;e0&&i.length>0&&h.length==i.length){f.clear();g.clear();d.clear();for(var j=0;j=d.count()){continue}var o=new Array(2);o[0]=d.__inner[n];o[1]=d.__inner[n+1];var p=a.analyzer().getTitleString(null,o);this.f(a,d.__inner[n],d.__inner[n+1],p)}},d:function(a){var b=new $$4.x(String,0);for(var c=0;cthis.monotonicCheckAmount()){e.suggestedSeries(11)}else{if(a.analyzer().isMonotonic(h,b,this.monotonicCheckAmount())){e.suggestedSeries(12)}else{e.suggestedSeries(11)}}e.suggestedPrimaryAxis(1);e.suggestedSecondaryAxis(1);a.addDataSeries(e,this)},$type:new $.ig.Type("SimpleScatterSeriesRule",$.ig.$ot,[$$t.$b.$type])},true);$c("SubCollectionsRule:w","Object",{init:function(){$.ig.$op.init.call(this);this.priority(0);this.collectionTransformationThreshold(50)},_priority:0,priority:function(a){if(arguments.length===1){this._priority=a;return a}else{return this._priority}},_collectionTransformationThreshold:0,collectionTransformationThreshold:function(a){if(arguments.length===1){this._collectionTransformationThreshold=a;return a}else{return this._collectionTransformationThreshold}},evaluate:function(a){var b=a.getCurrentDataSource();if(b==null){return}if(b.actualCount()==0||b.actualCount()>this.collectionTransformationThreshold()){return}var c=b.getItemAtIndex(0);if(a.analyzer().isCollection(c)){for(var d=0;d0){return c[0]}return function(d){return d!=null?d:function(e){return e!=null?e:function(f){return f!=null?f:a.analyzer().getFirstStringProperty()}(a.analyzer().getFirstDistinctMonotonicNumericProperty(b))}(a.analyzer().getFirstDistinctDateTimeProperty(b))}(a.analyzer().getFirstDistinctStringProperty(b))},evaluate:function(a){var b=$$t.$x.c(a,this.distinctCheckThreshold());var c=null;var d=a.analyzer().getAllPropertiesWithIntent($$t.$h.$getName(0));if(d.length>0){c=d}if(c==null){c=a.analyzer().getAllNumericProperties()}if(c==null||c.length==0){return}var e=a.getCurrentDataSource().actualCount();for(var f=0;f1){continue}var g=new Array(1);g[0]=c[f];var h=a.analyzer().getTitleString(null,g);var i=new $$t.f;var j=new $$t.g;j.intent(0);j.path(c[f]);var k=new $$t.g;k.intent(16);k.path(b);i.addMemberPathHint(j);i.addMemberPathHint(k);if(e>this.useColumnThreshold()){i.suggestedSeries(0)}else{i.suggestedSeries(1)}this.d(i,a);i.suggestedPrimaryAxis(0);i.suggestedSecondaryAxis(1);i.name(c[f]);if(h!=null){i.title(h)}else{i.title(c[f]);i.title(a.analyzer().expandCamelCasedWords(i.title())); }a.addDataSeries(i,this)}},d:function(a,b){if(!b.hasValidType(a)){a.suggestedSeries(0);if(b.hasValidType(a)){return}a.suggestedSeries(1);if(b.hasValidType(a)){return}a.suggestedSeries(2);if(b.hasValidType(a)){return}a.suggestedSeries(6);if(b.hasValidType(a)){return}a.suggestedSeries(7);if(b.hasValidType(a)){return}a.suggestedSeries(4);if(b.hasValidType(a)){return}a.suggestedSeries(5);if(b.hasValidType(a)){return}a.suggestedSeries(10);if(b.hasValidType(a)){return}a.suggestedSeries(8);if(b.hasValidType(a)){return}a.suggestedSeries(0)}},$type:new $.ig.Type("SimpleCategorySeriesRule",$.ig.$ot,[$$t.$b.$type])},true);$c("DataSeriesAdapterUpdateNotifier:m","Object",{a:null,b:null,init:function(a,b){$.ig.$op.init.call(this);this.a=a;this.b=b},notifyClearItems:function(){this.a.ad(this.b)},notifyInsertItem:function(a,b){this.a.ae(this.b,a,b)},notifyRemoveItem:function(a,b){this.a.af(this.b,a,b)},notifySetItem:function(a,b,c){this.a.ag(this.b,a,b,c)},$type:new $.ig.Type("DataSeriesAdapterUpdateNotifier",$.ig.$ot,[$.ig.IDataSourceDataProviderUpdateNotifier.prototype.$type])},true);$c("DataSeriesAdapterRuleCollection:n","ObservableCollection$1",{init:function(){$$4.$f.init.call(this,$$t.$b.$type,0)},$type:new $.ig.Type("DataSeriesAdapterRuleCollection",$$4.$f.$type.specialize($$t.$b.$type))},true);$c("DataSeriesCollection:o","ObservableCollection$1",{init:function(){$$4.$f.init.call(this,$$t.$f.$type,0)},$type:new $.ig.Type("DataSeriesCollection",$$4.$f.$type.specialize($$t.$f.$type))},true);$c("DataSeriesAdapterRemovingDuplicatesEventArgs:q","Object",{init:function(){$.ig.$op.init.call(this)},_runContext:null,runContext:function(a){if(arguments.length===1){this._runContext=a;return a}else{return this._runContext}},_dataSourcePath:null,dataSourcePath:function(a){if(arguments.length===1){this._dataSourcePath=a;return a}else{return this._dataSourcePath}},_duplicatePath:null,duplicatePath:function(a){if(arguments.length===1){this._duplicatePath=a;return a}else{return this._duplicatePath}},_matchingSeries:null,matchingSeries:function(a){if(arguments.length===1){this._matchingSeries=a;return a}else{return this._matchingSeries}},_handled:false,handled:function(a){if(arguments.length===1){this._handled=a;return a}else{return this._handled}},$type:new $.ig.Type("DataSeriesAdapterRemovingDuplicatesEventArgs",$.ig.$ot)},true);$c("DataSeriesAdapterRunEventArgs:s","Object",{init:function(){$.ig.$op.init.call(this)},_runContext:null,runContext:function(a){if(arguments.length===1){this._runContext=a;return a}else{return this._runContext}},_handled:false,handled:function(a){if(arguments.length===1){this._handled=a;return a}else{return this._handled}},$type:new $.ig.Type("DataSeriesAdapterRunEventArgs",$.ig.$ot)},true);$c("DataSeriesAdapterImplementation:t","Object",{init:function(){this.m=new $$4.h($.ig.$op.$type,$.ig.IDataSourceLocalDataProvider.prototype.$type,0);this.c=null;this.b=null;this.a=null;$.ig.$op.init.call(this);this.rules(new $$t.n);this.dataSeries(new $$t.o);this.ah(this.rules());var a=this.rules();a.collectionChanged=$.ig.Delegate.prototype.combine(a.collectionChanged,this.an.runOn(this))},_p:null,u:function(a,b){var c=String.empty();if(this._p!=null){c=this._p(a)}if(String.isNullOrEmpty(c)){return b}return c},ah:function(a){},an:function(a,b){this.refresh()},_q:null,g:function(){return this._q},m:null,n:null,propertyChanged:null,itemsSource:function(a){if(arguments.length===1){var b=this.n;this.n=a;if(b!=this.n){this.ac("ItemsSource",b,this.n)}return a}else{return this.n}},c:null,supportedSeriesTypes:function(a){if(arguments.length===1){var b=this.c;this.c=a;if(b!=this.c){this.ac("SupportedSeriesTypes",b,this.c)}return a}else{return this.c}},b:null,includedProperties:function(a){if(arguments.length===1){var b=this.b;this.b=a;if(b!=this.b){this.ac("IncludedProperties",b,this.b)}return a}else{return this.b}},a:null,excludedProperties:function(a){if(arguments.length===1){var b=this.a;this.a=a;if(b!=this.a){this.ac("ExcludedProperties",b,this.a)}return a}else{return this.a}},_rules:null,rules:function(a){if(arguments.length===1){this._rules=a;return a}else{return this._rules}},_dataSeries:null,dataSeries:function(a){if(arguments.length===1){this._dataSeries=a;return a}else{return this._dataSeries}},ac:function(a,b,c){this.ai(a,b,c);if(this.propertyChanged!=null){this.propertyChanged(this,new $$0.b7(a))}},ai:function(a,b,c){switch(a){case"ItemsSource":this.refresh();break;case"SupportedSeriesTypes":this.refresh();break;case"IncludedProperties":this.refresh();break;case"ExcludedProperties":this.refresh();break}},refresh:function(){this.x();var a=new $$t.c(this);var b=this.l(this.itemsSource());this.w(b,null,false);a.pushDataSource(b);this.ap(a);this.ar(a)},x:function(){var b=this.m.keys().getEnumerator();while(b.moveNext()){var a=b.current();var c=this.m.item(a);c.updateNotifier(null)}this.m.clear()},ar:function(a){this.am(a);this.al(a);this.aq(a)},am:function(a){var b=true;if(this.removingUnsupported!=null){var c=function(){var $ret=new $$t.s;$ret.runContext(a);return $ret}();this.removingUnsupported(this,c);b=!c.handled()}if(b){if(this.supportedSeriesTypes()==null){return}var d=new $$4.q($$t.$i.$type,0);for(var e=0;e=0;f--){var g=a.getDataSeriesAt(f);if(!d.contains(g.suggestedSeries())){a.removeDataSeries(g)}}}},aq:function(a){var b=0;for(;b1){var j=new Array(b.item(h).count());var k=b.item(h);var l=k.count();for(var m=0;mp){p=s.priority();q=s}}for(var t=0;t