var DvtLegend=function(){};DvtObj.createSubclass(DvtLegend,DvtContainer,"DvtLegend");DvtLegend.newInstance=function(a,b,d,e){var g=new DvtLegend;g.Init(a,b,d,e);return g};
DvtLegend.prototype.Init=function(a,b,d,e){DvtLegend.superclass.Init.call(this,a);this._callback=b;this._callbackObj=d;this.setOptions(e);this.setId("legend1000"+Math.floor(1E4*Math.random()));this._eventHandler=new DvtLegendEventManager(this);this._eventHandler.addListeners(this);d&&d.__isDataCursorEnabled()&&this._eventHandler.setSeriesFocusHandler(new DvtChartSeriesFocusHandler(d,this));"dim"==this.__getOptions().rolloverBehavior&&this._eventHandler.setSeriesRolloverHandler(new DvtLegendSeriesRolloverHandler(d,
this._eventHandler,this));this._peers=[];this._scrollableSections=[]};DvtLegend.prototype.setOptions=function(a){this.Options=DvtLegendDefaults.calcOptions(a)};
DvtLegend.prototype.getPreferredSize=function(a,b,d){this.Options.isLayout=!0;this.Data=DvtJSONUtils.clone(a);b=new DvtRectangle(0,0,b,d);DvtLegendRenderer.render(this,b);a=b.w;b=b.h;a+=2*DvtLegendDefaults.getGapSize(this.Options,this.Options.layout.outerGapWidth);b+=2*DvtLegendDefaults.getGapSize(this.Options,this.Options.layout.outerGapHeight);this.Options.isLayout=!1;return{width:a,height:b}};
DvtLegend.prototype.render=function(a,b,d){this.Data=DvtJSONUtils.clone(a);this.removeChildren();a=new DvtRectangle(0,0,b,d);DvtLegendRenderer.render(this,a);this.getContext().queueRender()};
DvtLegend.prototype.processEvent=function(a,b){var d=a.getType();if(d==DvtCategoryRolloverEvent.TYPE_OVER||d==DvtCategoryRolloverEvent.TYPE_OUT){"dim"==this.Options.rolloverBehavior&&DvtCategoryRolloverHandler.processEvent(a,this.__getObjects());for(d=0;d<this._scrollableSections.length;d++)this._scrollableSections[d].processCategoryRollover(a)}this===b&&this.__dispatchEvent(a)};
DvtLegend.prototype.__dispatchEvent=function(a){DvtEventDispatcher.dispatchEvent(this._callback,this._callbackObj,this,a)};DvtLegend.prototype.__getData=function(){return this.Data?this.Data:{}};DvtLegend.prototype.__getOptions=function(){return this.Options};DvtLegend.prototype.__getEventManager=function(){return this._eventHandler};DvtLegend.prototype.__registerObject=function(a){this._peers.push(a)};DvtLegend.prototype.__getObjects=function(){return this._peers};
DvtLegend.prototype.__registerScrollableSection=function(a){this._scrollableSections.push(a)};var DvtLegendDefaults={};DvtObj.createSubclass(DvtLegendDefaults,DvtObj,"DvtLegendDefaults");
DvtLegendDefaults.VERSION_1={position:null,backgroundColor:null,borderColor:null,textStyle:"font-size: 11px; color: #333333;",titleStyle:"font-size: 12px; color: #003d5b;",titleHalign:"start",hideAndShowBehavior:"none",rolloverBehavior:"none",scrolling:"off",layout:{gapRatio:1,outerGapWidth:3,outerGapHeight:3,titleGap:3,markerSize:10,markerGap:5,rowGap:0,columnGap:8,sectionGap:6},isLayout:!1};
DvtLegendDefaults.calcOptions=function(a){var b=DvtLegendDefaults._getDefaults(a);return a?DvtJSONUtils.merge(a,b):b};DvtLegendDefaults._getDefaults=function(){return DvtJSONUtils.clone(DvtLegendDefaults.VERSION_1)};DvtLegendDefaults.getGapSize=function(a,b){return Math.ceil(b*a.layout.gapRatio)};var DvtLegendEventManager=function(a){this.Init(a.getContext(),a.processEvent,a);this._legend=a;this.SeriesRolloverHandler=this.SeriesFocusHandler=null};
DvtObj.createSubclass(DvtLegendEventManager,DvtEventManager,"DvtLegendEventManager");DvtLegendEventManager.prototype.setSeriesFocusHandler=function(a){this.SeriesFocusHandler=a};DvtLegendEventManager.prototype.setSeriesRolloverHandler=function(a){this.SeriesRolloverHandler=a};
DvtLegendEventManager.prototype.OnClick=function(a){DvtLegendEventManager.superclass.OnClick.call(this,a);var b=this.GetLogicalObject(a.target);if(b){var d=this._context.getRelativePosition(a.pageX,a.pageY);this.SeriesFocusHandler&&this.SeriesFocusHandler.processSeriesFocus(d,b);this._handleHideShow(b)&&a.stopPropagation()}};
DvtLegendEventManager.prototype.OnMouseOver=function(a){DvtLegendEventManager.superclass.OnMouseOver.call(this,a);var b=this.GetLogicalObject(a.target);if(b){var d=!1;this.SeriesRolloverHandler&&(this.SeriesRolloverHandler.processMouseOver(b),d=this.SeriesRolloverHandler.isRolloverHandled());d&&a.stopPropagation()}};
DvtLegendEventManager.prototype.OnMouseOut=function(a){DvtLegendEventManager.superclass.OnMouseOut.call(this,a);var b=this.GetLogicalObject(a.target);if(b){var d=!1;this.SeriesRolloverHandler&&(this.SeriesRolloverHandler.processMouseOut(b),d=this.SeriesRolloverHandler.isRolloverHandled());d&&a.stopPropagation()}};
DvtLegendEventManager.prototype.HandleTouchClickInternal=function(a){var b=a.touch,d=a.touchEvent;if(a=this.GetLogicalObject(a.targetObj))this._handleHideShow(a)&&d?d.preventDefault():(b=this._context.getRelativePosition(b.pageX,b.pageY),this.SeriesFocusHandler&&this.SeriesFocusHandler.processSeriesFocus(b,a))};
DvtLegendEventManager.prototype._handleHideShow=function(a){return"none"!=this._legend.__getOptions().hideAndShowBehavior&&(a=DvtLegendEventManager._processHideAndShow(this._legend,a))?(this.FireEvent(a,this._legend),!0):!1};
DvtLegendEventManager._processHideAndShow=function(a,b){var d=b.getCategories?b.getCategories():null;if(!d||0>=d.length)return null;for(var e=b.getDisplayables(),g=0;g<e.length;g++){var h=e[g];h instanceof DvtMarker&&h.setHollow(b.getColor())}d=d[0];e=b.getData();if("hidden"==e.visibility)return e.visibility="visible",new DvtHideShowCategoryEvent(DvtHideShowCategoryEvent.TYPE_SHOW,d);e.visibility="hidden";return new DvtHideShowCategoryEvent(DvtHideShowCategoryEvent.TYPE_HIDE,d)};
DvtLegendEventManager.prototype.HandleTouchHoverStartInternal=function(a){a=this.GetLogicalObject(a.targetObj);this.SeriesRolloverHandler&&this.SeriesRolloverHandler.processMouseOver(a)};DvtLegendEventManager.prototype.HandleTouchHoverEndInternal=function(a){a=this.GetLogicalObject(a.targetObj);this.SeriesRolloverHandler&&this.SeriesRolloverHandler.processMouseOut(a)};
DvtLegendEventManager.prototype.HandleTouchHoverOverInternal=function(a){a=this.GetLogicalObject(a.targetObj);this.SeriesRolloverHandler&&this.SeriesRolloverHandler.processMouseOver(a)};DvtLegendEventManager.prototype.HandleTouchHoverOutInternal=function(a){a=this.GetLogicalObject(a.targetObj);this.SeriesRolloverHandler&&this.SeriesRolloverHandler.processMouseOut(a)};var DvtLegendObjPeer=function(a,b,d,e){this.Init(a,b,d,e)};DvtObj.createSubclass(DvtLegendObjPeer,DvtObj,"DvtLegendObjPeer");
DvtLegendObjPeer.prototype.Init=function(a,b,d,e){this._legend=a;this._displayables=b;this._item=d;this._id=d.id;this._tooltip=e};DvtLegendObjPeer.associate=function(a,b,d,e){if(!a||!d)return null;d.id?(d=new DvtLegendObjPeer(b,a,d,e),b.__registerObject(d)):d=new DvtSimpleObjPeer(e);for(e=0;e<a.length;e++)b.__getEventManager().associate(a[e],d);return d};DvtLegendObjPeer.prototype.getData=function(){return this._item};DvtLegendObjPeer.prototype.getColor=function(){return this._item.color};
DvtLegendObjPeer.prototype.getDisplayables=function(){return this._displayables};DvtLegendObjPeer.prototype.getCategories=function(){return[this._id]};DvtLegendObjPeer.prototype.getTooltip=function(){return this._tooltip};var DvtLegendRenderer={};DvtObj.createSubclass(DvtLegendRenderer,DvtObj,"DvtLegendRenderer");DvtLegendRenderer._LINE_WIDTH=3;DvtLegendRenderer._LINE_MARKER_SIZE=7;DvtLegendRenderer._DEFAULT_ITEM_WIDTH=10;
DvtLegendRenderer.render=function(a,b){var d=a.__getOptions();if(!d.isLayout){var e=DvtLegendDefaults.getGapSize(d,d.layout.outerGapWidth),g=DvtLegendDefaults.getGapSize(d,d.layout.outerGapHeight);if(b.w===2*e)return;DvtLegendRenderer._renderBackground(a,b);b.x+=e;b.y+=g;b.w-=2*e;b.h-=2*g}e="vertical"==d.orientation?!1:!0;g=DvtLegendRenderer._renderTitle(a,a.__getData().title,b,!1);b.y+=g.height;b.h-=g.height;var h=DvtLegendRenderer._getRowHeight(a);e?DvtLegendRenderer._renderHorizontalSections(a,
b,h):DvtLegendRenderer._renderVerticalSections(a,b,h,g.width,"asNeeded"==d.scrolling);b.w=Math.max(b.w,g.width);b.h+=g.height};DvtLegendRenderer._renderBackground=function(a,b){var d=a.__getOptions(),e;d.backgroundColor&&(e=e?e:new DvtRect(a.getContext(),b.x,b.y,b.w,b.h),e.setFill(new DvtSolidFill(d.backgroundColor)));d.borderColor&&(e=e?e:new DvtRect(a.getContext(),b.x,b.y,b.w,b.h),e.setStroke(new DvtSolidStroke(d.borderColor)),e.setPixelHinting(!0));e&&a.addChild(e)};
DvtLegendRenderer._renderTitle=function(a,b,d,e){var g=a.__getOptions();if(!b)return{width:0,height:0};b=new DvtText(a.getContext(),b,d.x,d.y);b.setCSSStyle(new DvtCSSStyle(e?g.sectionTitleStyle:g.titleStyle));var h=b.getTextString();if(b=b.truncateToSpace(a,d.w,d.h)){h.length>b.getTextString().length&&a.__getEventManager().associate(b,new DvtSimpleObjPeer(h));a.addChild(b);var h=b.getDimensions(),k=DvtLegendDefaults.getGapSize(g,g.layout.titleGap);g.isLayout?a.removeChild(b):(DvtLayoutUtils.alignTextStart(b),
DvtLayoutUtils.align(d,e?g.sectionTitleHalign:g.titleHalign,b,h.w));a=h.h+k;return{width:Math.min(h.w,d.w),height:a}}return{width:0,height:0}};DvtLegendRenderer._getLegendSections=function(a,b){var d=a.sections;b.push(a);if(d)for(var e=0;e<d.length;e++)DvtLegendRenderer._getLegendSections(d[e],b)};
DvtLegendRenderer._renderVerticalSections=function(a,b,d,e,g){for(var h=a.__getData(),k=a.__getOptions(),m=DvtLegendRenderer._calcSectionSpaces(a,b,d,g),n=b.x,o=[],q=0;q<h.sections.length;q++)DvtLegendRenderer._getLegendSections(h.sections[q],o);h=o.length;k=DvtLegendDefaults.getGapSize(k,k.layout.sectionGap);b=new DvtRectangle(b.x,b.y,Math.max(b.w,e),b.h);for(q=0;q<o.length;q++)b.h=m[q],DvtLegendRenderer._renderSection(a,o[q],q,b,d,g),b.x=n,q!=h-1&&o[q].items&&(b.h-=k,b.y+=k)};
DvtLegendRenderer._renderHorizontalSections=function(a,b,d){for(var e=a.__getData(),g=a.__getOptions(),h=0,k=0,m=b.y,n=[],o=0;o<e.sections.length;o++)DvtLegendRenderer._getLegendSections(e.sections[o],n);for(var q=n.length,s=0,o=0;o<n.length;o++)n[o].items&&(s+=n[o].items.length);var g=DvtLegendDefaults.getGapSize(g,g.layout.sectionGap),t=b.w-g*(q-1),u=b.h;if(e.sections)for(var v=e=0,o=0;o<q;o++){b.h=u;var w=n[o].items;w?(0<e&&(b.y+=v,b.h-=v),b.w=Math.round(w.length/s*t),DvtLegendRenderer._renderSection(a,
n[o],o,b,d,!1),0<e&&(b.h+=v,e--),h=Math.max(b.h,h),k+=b.w,o!=q-1&&(k+=g),b.x=k):(e=n[o].sections.length,DvtLegendRenderer._renderSection(a,n[o],o,b,d,!1),v=b.h);b.y=m}b.w=k;b.h=h};
DvtLegendRenderer._renderSection=function(a,b,d,e,g,h){if(b){var k=a.__getOptions(),m=a.getContext(),n=e.y,o=k.layout.markerSize,q=DvtLegendDefaults.getGapSize(k,k.layout.markerGap),s=DvtLegendDefaults.getGapSize(k,k.layout.rowGap),t=DvtLegendDefaults.getGapSize(k,k.layout.columnGap),u=DvtLegendRenderer._renderTitle(a,b.title,e,!0);e.y+=u.height;if(b.items){e.h-=u.height;var n=n+u.height,v=DvtLegendRenderer._calcSectionSpace(a,e,g,b.items,h),w=v.numCols,x=v.numRows,v=v.width;e.h=Math.min(e.h,x*(g+
s)-s)+u.height;e.w=v*w+t*(w-1);if(k.isLayout){if(1==x){for(d=g=0;d<b.items.length;d++)h=b.items[d],v=Math.ceil(DvtLegendRenderer._getTextWidth(a,h.text)),g+=v+o+q+t;e.w=g-t}}else if(!(0==x||0==w)){var y=null,z=null,A=x*(g+s)-s+u.height,u=b.items.length;"vertical"===k.orientation&&h&&A>e.h&&(z=DvtLegendRenderer._createHandle(a,m,e,d),y=DvtLegendRenderer._createScrollableLegend(a,m,e,z,A,u),a.__registerScrollableSection(y));var A=v-o-q,F=DvtStyleUtils.isLocaleR2L(),C=0,E=1;if(1==x){for(d=y=0;d<u;d++)h=
b.items[d],v=Math.ceil(DvtLegendRenderer._getTextWidth(a,h.text)),v<A&&(y+=A-v);for(d=0;d<u;d++){var h=b.items[d],I,G;F?(I=e.w-o,G=e.w-o-q):(I=e.x,G=e.x+o+q);I=DvtLegendRenderer._createLegendMarker(m,I,e.y,g,o,h);var L=h.text,v=Math.ceil(DvtLegendRenderer._getTextWidth(a,h.text)),B=null;L&&(v<A?B=DvtLegendRenderer._createLegendText(a,m,e,A,L,k.textStyle):(B=DvtLegendRenderer._createLegendText(a,m,e,A+y,L,k.textStyle),null!=B&&(v=Math.ceil(DvtLegendRenderer._getTextWidth(a,B.getTextString())),y-=A-
v)),v=null!=B?Math.ceil(DvtLegendRenderer._getTextWidth(a,B.getTextString())):0,B&&(B.setX(G),B.setY(e.y+g/2),F?DvtLayoutUtils.alignTextEnd(B):DvtLayoutUtils.alignTextStart(B)));a.addChild(I);B&&a.addChild(B);G=B?DvtLegendObjPeer.associate([I,B],a,h,B.isTruncated()?L:null):DvtLegendObjPeer.associate([I],a,h,L);"hidden"==h.visibility&&G&&I.setHollow(G.getColor());e.y+=g+s;C++;v+=o;C===x&&E!==w&&(e.y=n,F?e.w-=v+t:e.x+=v+t,C=0,E++)}}else for(d=0;d<u;d++){h=b.items[d];F?(I=e.w-o,G=e.w-o-q):(I=e.x,G=e.x+
o+q);I=DvtLegendRenderer._createLegendMarker(m,I,e.y,g,o,h);L=h.text;B=null;if(L&&(B=DvtLegendRenderer._createLegendText(a,m,e,A,L,k.textStyle)))B.setX(G),B.setY(e.y+g/2),F?DvtLayoutUtils.alignTextEnd(B):DvtLayoutUtils.alignTextStart(B);y?(z.addChild(I),B&&z.addChild(B)):(a.addChild(I),B&&a.addChild(B));G=B?DvtLegendObjPeer.associate([I,B],a,h,B.isTruncated()?L:null):DvtLegendObjPeer.associate([I],a,h,L);y&&G instanceof DvtLegendObjPeer&&y.__registerObject(G);"hidden"==h.visibility&&G&&I.setHollow(G.getColor());
e.y+=g+s;C++;C===x&&E!==w&&(e.y=n,F?e.w-=v+t:e.x+=v+t,C=0,E++)}}}else e.h=u.height}};
DvtLegendRenderer._calcSectionSpaces=function(a,b,d,e){var g=a.__getData(),h=a.__getOptions(),k=h.isLayout;a.Options.isLayout=!0;for(var m=0,n=0,o=b.x,q=b.y,s=[],t=0;t<g.sections.length;t++)DvtLegendRenderer._getLegendSections(g.sections[t],s);for(var g=s.length,h=DvtLegendDefaults.getGapSize(h,h.layout.sectionGap),u=b.h-h*(g-1),v=b.w,w=[],t=0;t<g;t++)b.h=u,b.w=v,DvtLegendRenderer._renderSection(a,s[t],t,b,d,e),w[t]=b.h;arSectionSpaceNeeded=[];extraSpace=numShortSections=0;for(var x=u/g,t=0;t<g;t++)u=
w[t]-x,0>=u?(arSectionSpaceNeeded[t]=0,extraSpace-=u):(w[t]=x,arSectionSpaceNeeded[t]=u,numShortSections++);for(;0<extraSpace&&0<numShortSections;){x=extraSpace/numShortSections;for(t=0;t<g;t++)0<arSectionSpaceNeeded[t]&&(u=arSectionSpaceNeeded[t]-x,0>=u?(w[t]+=arSectionSpaceNeeded[t],arSectionSpaceNeeded[t]=0,extraSpace-=x+u,numShortSections--):(w[t]+=x,extraSpace-=x,arSectionSpaceNeeded[t]=u))}b.x=o;b.y=q;b.w=v;for(t=0;t<g;t++)b.h=w[t],DvtLegendRenderer._renderSection(a,s[t],t,b,d,e),b.x=o,n=Math.max(b.w,
n),m+=b.h,t!=g-1&&(b.y=b.h+q+h,m+=h);b.w=n;b.h=m;b.x=o;b.y=q;a.Options.isLayout=k;return w};
DvtLegendRenderer._calcSectionSpace=function(a,b,d,e,g){for(var h=a.__getOptions(),k=0,m=0;m<e.length;m++){var n=DvtLegendRenderer._getTextWidth(a,e[m].text);n>k&&(k=n)}var a=h.layout.markerSize,o=DvtLegendDefaults.getGapSize(h,h.layout.markerGap),m=DvtLegendDefaults.getGapSize(h,h.layout.rowGap),n=DvtLegendDefaults.getGapSize(h,h.layout.columnGap),k=h.isLayout?Math.round(a+o+k):b.w;"vertical"==h.orientation?g?(h=1,g=e.length):(g=Math.min(Math.floor((b.h+m)/(d+m)),e.length),h=Math.ceil(e.length/g)):
(h=Math.min(Math.floor(b.w/k),e.length),g=Math.ceil(((k+n)*e.length-n)/b.w),g*(d+m)-m>b.h&&(g=Math.floor((b.h+m)/(d+m)),h=Math.ceil(e.length/g)));b=Math.min(k,Math.floor((b.w-n*(h-1))/h));return b<a?{width:0,height:0,numCols:0,numRows:0}:{width:b,numCols:h,numRows:g}};
DvtLegendRenderer._getRowHeight=function(a){var b=a.__getOptions(),d=new DvtText(a.getContext(),"Test");d.setCSSStyle(new DvtCSSStyle(b.textStyle));d.alignCenter();a.addChild(d);var e=d.getDimensions();a.removeChild(d);return Math.ceil(Math.max(e.h,b.layout.markerSize))};DvtLegendRenderer._getTextWidth=function(a,b){var d=a.__getOptions(),e=new DvtText(a.getContext(),b),g=a.getContext().getStage();e.setCSSStyle(new DvtCSSStyle(d.textStyle));g.addChild(e);d=e.getDimensions();g.removeChild(e);return d.w};
DvtLegendRenderer._createLegendText=function(a,b,d,e,g,h){b=new DvtText(b,g);b.alignCenter();b.setCSSStyle(new DvtCSSStyle(h));return b=b.truncateToSpace(a,e,d.h)};DvtLegendRenderer._createLegendMarker=function(a,b,d,e,g,h){var k=h.shape;"line"==k?g=DvtLegendRenderer._createLine(a,b,d,e,h):"lineWithMarker"==k?(g=DvtLegendRenderer._createLine(a,b,d,e,h),g.addChild(DvtLegendRenderer._createMarker(a,b,d,e,DvtLegendRenderer._LINE_MARKER_SIZE,h))):g=DvtLegendRenderer._createMarker(a,b,d,e,g,h);return g};
DvtLegendRenderer._createMarker=function(a,b,d,e,g,h){var k=h.markerShape?h.markerShape:h.shape;k||(k="square");var m=h.markerColor?h.markerColor:h.color;m||(m="#999999");var n=h.pattern,k=DvtMarker.convertShapeString(k),a=new DvtMarker(a,k,"lineWithMarker"==h.shape?b+(DvtLegendRenderer._DEFAULT_ITEM_WIDTH-g)/2:b,d+(e-g)/2,g,g);n?a.setFill(new DvtPatternFill(n,m,"#FFFFFF")):a.setFill(new DvtSolidFill(m));h.borderColor&&a.setStroke(new DvtSolidStroke(h.borderColor));return a};
DvtLegendRenderer._createLine=function(a,b,d,e,g){d+=e/2;a=new DvtLine(a,b,d,b+DvtLegendRenderer._DEFAULT_ITEM_WIDTH,d);b=g.lineStyle;g=new DvtSolidStroke(g.color,1,DvtLegendRenderer._LINE_WIDTH);g.setType(DvtStroke.convertTypeString(b));a.setStroke(g);return a};DvtLegendRenderer._createHandle=function(a,b,d,e){var g=[d.x,d.y,d.x+d.w,d.y+d.h],d=new DvtRectangle(d.x,d.y,d.w,d.h),e=a.getId()+"_"+e,b=new DvtHandle(b,"legendHandler",g,d,e);a.addChild(b);return b};
DvtLegendRenderer._createScrollableLegend=function(a,b,d,e,g,h){b=new DvtScrollableLegend(b,d.x,d.y,d.w,d.h,g,e,h);a.addChild(b);e.render();return b};var DvtLegendAttrGroupsRenderer=function(){};DvtObj.createSubclass(DvtLegendAttrGroupsRenderer,DvtObj,"DvtLegendAttrGroupsRenderer");DvtLegendAttrGroupsRenderer._LEGEND_MAX_HEIGHT=0.4;DvtLegendAttrGroupsRenderer._CONTINUOUS_GROUP_GAP=1;DvtLegendAttrGroupsRenderer._CONTINUOUS_ITEM_WIDTH=60;DvtLegendAttrGroupsRenderer._CONTINUOUS_ITEM_HEIGHT=15;
DvtLegendAttrGroupsRenderer._CONTINUOUS_ITEM_GAP=5;DvtLegendAttrGroupsRenderer._LABEL_SIZE=11;DvtLegendAttrGroupsRenderer._LABEL_COLOR="#636363";DvtLegendAttrGroupsRenderer._LABEL_VALUE_COLOR="#333333";
DvtLegendAttrGroupsRenderer.renderAttrGroups=function(a,b,d,e,g,h,k){var m=null;h&&(h instanceof DvtContinuousAttrGroups?m=DvtLegendAttrGroupsRenderer._renderAttrGroupsContinuous(a,b,d,e,g,h,k):h instanceof DvtDiscreteAttrGroups&&(m=DvtLegendAttrGroupsRenderer._renderAttrGroupsDiscrete(a,b,d,e,g,h,k)));return m};
DvtLegendAttrGroupsRenderer._renderAttrGroupsContinuous=function(a,b,d,e,g,h,k){var m=DvtStyleUtils.isLocaleR2L(),n=DvtLegendAttrGroupsRenderer._CONTINUOUS_ITEM_HEIGHT/2+DvtLegendAttrGroupsRenderer._CONTINUOUS_GROUP_GAP,g=new DvtContainer(a);d.addChild(g);var d=h.getMinLabel(),o=new DvtText(a,d,0,n);o.setCSSStyle(k.labelStyle);DvtLayoutUtils.alignTextStart(o);o.alignCenter();g.addChild(o);var q=new DvtRect(a,0,DvtLegendAttrGroupsRenderer._CONTINUOUS_GROUP_GAP,DvtLegendAttrGroupsRenderer._CONTINUOUS_ITEM_WIDTH,
DvtLegendAttrGroupsRenderer._CONTINUOUS_ITEM_HEIGHT),s=m?h.getRamp().slice().reverse():h.getRamp();q.setFill(new DvtLinearGradientFill(0,s));q.setStroke(new DvtSolidStroke("#000000"));g.addChild(q);s=DvtLegendAttrGroupsRenderer._CONTINUOUS_ITEM_WIDTH+DvtLegendAttrGroupsRenderer._CONTINUOUS_ITEM_GAP;h=h.getMaxLabel();a=new DvtText(a,h,0,n);a.setCSSStyle(k.labelStyle);DvtLayoutUtils.alignTextStart(a);a.alignCenter();g.addChild(a);m?(k=a.getDimensions().w+DvtLegendAttrGroupsRenderer._CONTINUOUS_ITEM_GAP,
q.setTranslateX(k),o.setX(k+s)):(k=o.getDimensions().w+DvtLegendAttrGroupsRenderer._CONTINUOUS_ITEM_GAP,q.setTranslateX(k),a.setX(k+s));b.associate(q,new DvtSimpleObjPeer(d+" - "+h));g.getDimensions().w>e&&(g.removeChild(o),g.removeChild(a),q.setTranslateX(0));return g};
DvtLegendAttrGroupsRenderer._renderAttrGroupsDiscrete=function(a,b,d,e,g,h,k){for(var b=[],h=h.getMappingsArray(),m=0;m<h.length;m++){var n=h[m];b.push({text:n.groupLabel,color:n.params.color,pattern:n.params.pattern,borderColor:"#000000"})}b={sections:[{items:b}]};k=DvtLegend.newInstance(a,null,null,{layout:{outerGapWidth:0,outerGapHeight:0},textStyle:k.labelStyle.toString()});d.addChild(k);d=k.getPreferredSize(b,e,g*DvtLegendAttrGroupsRenderer._LEGEND_MAX_HEIGHT);k.render(b,e,d.height);e=k.getDimensions();
a=new DvtRect(a,0,0,e.w,d.height);a.setFill(new DvtSolidFill("#FFFFFF",0.01));k.addChildAt(a,0);return k};