//>>built
define("dojox/charting/DataSeries",["dojo/_base/lang","dojo/_base/declare","dojo/_base/array","dojo/_base/connect","dojox/lang/functional"],function(d,l,e,f,m){return l("dojox.charting.DataSeries",null,{constructor:function(a,c,b){this.store=a;this.kwArgs=c;b?d.isFunction(b)?this.value=b:d.isObject(b)?this.value=d.hitch(this,"_dictValue",m.keys(b),b):this.value=d.hitch(this,"_fieldValue",b):this.value=d.hitch(this,"_defaultValue");this.data=[];this._events=[];this.store.getFeatures()["dojo.data.api.Notification"]&&
this._events.push(f.connect(this.store,"onNew",this,"_onStoreNew"),f.connect(this.store,"onDelete",this,"_onStoreDelete"),f.connect(this.store,"onSet",this,"_onStoreSet"));this._initialRendering=!0;this.fetch()},destroy:function(){e.forEach(this._events,f.disconnect)},setSeriesObject:function(a){this.series=a},_dictValue:function(a,c,b,g){var h={};e.forEach(a,function(k){h[k]=b.getValue(g,c[k])});return h},_fieldValue:function(a,c,b){return c.getValue(b,a)},_defaultValue:function(a,c){return a.getValue(c,
"value")},fetch:function(){if(!this._inFlight){this._inFlight=!0;var a=d.delegate(this.kwArgs);a.onComplete=d.hitch(this,"_onFetchComplete");a.onError=d.hitch(this,"onFetchError");this.store.fetch(a)}},_onFetchComplete:function(a,c){this.items=a;this._buildItemMap();this.data=e.map(this.items,function(b){return this.value(this.store,b)},this);this._pushDataChanges();this._inFlight=!1},onFetchError:function(a,c){this._inFlight=!1},_buildItemMap:function(){if(this.store.getFeatures()["dojo.data.api.Identity"]){var a=
{};e.forEach(this.items,function(c,b){a[this.store.getIdentity(c)]=b},this);this.itemMap=a}},_pushDataChanges:function(){this.series&&(this.series.chart.updateSeries(this.series.name,this,this._initialRendering),this._initialRendering=!1,this.series.chart.delayedRender())},_onStoreNew:function(){this.fetch()},_onStoreDelete:function(a){this.items&&e.some(this.items,function(c,b){return c===a?(this.items.splice(b,1),this._buildItemMap(),this.data.splice(b,1),!0):!1},this)&&this._pushDataChanges()},
_onStoreSet:function(a){if(this.itemMap){var c=this.store.getIdentity(a);c=this.itemMap[c];"number"==typeof c&&(this.data[c]=this.value(this.store,this.items[c]),this._pushDataChanges())}else this.items&&e.some(this.items,function(b,g){return b===a?(this.data[g]=this.value(this.store,b),!0):!1},this)&&this._pushDataChanges()}})});