UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

3 lines (2 loc) 2.87 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */ import{__decorate as e}from"tslib";import t from"../Color.js";import{isSome as r}from"../core/arrayUtils.js";import{ClonableMixin as o}from"../core/Clonable.js";import{toPt as i}from"../core/screenUtils.js";import{property as s,subclass as l}from"../core/accessorSupport/decorators.js";import{collectArcadeFieldNames as p}from"../layers/support/fieldUtils.js";import a from"./Renderer.js";import{VisualVariablesMixin as n}from"./mixins/VisualVariablesMixin.js";import m from"./support/AttributeColorInfo.js";import{rendererBackgroundFillSymbolProperty as u}from"./support/commonProperties.js";import y from"./support/OthersCategory.js";import d from"./support/RendererLegendOptions.js";import b from"./visualVariables/OpacityVariable.js";import c from"./visualVariables/SizeVariable.js";import h from"./visualVariables/VisualVariable.js";import f from"../symbols/SimpleLineSymbol.js";import j from"../symbols/SimpleMarkerSymbol.js";import{enumeration as g}from"../core/accessorSupport/decorators/enumeration.js";const v={base:h,key:"type",typeMap:{size:c,opacity:b}};let S=class extends(n(o(a))){constructor(e){super(e),this.attributes=null,this.backgroundFillSymbol=null,this.defaultColor=new t([0,0,0,0]),this.defaultLabel=null,this.holePercentage=0,this.othersCategory=new y,this.legendOptions=null,this.outline=null,this.type="pie-chart",this.visualVariables=null}get size(){return this._get("size")??12}set size(e){this._set("size",e)}getSymbol(){return new j({size:this.size?this.size/2+(this.outline?.width||0):0})}async getSymbolAsync(){return this.getSymbol()}get symbols(){return[this.getSymbol(),this.backgroundFillSymbol].filter(r)}getAttributeHash(){return this.visualVariables?.reduce((e,t)=>e+t.getAttributeHash(),"")??""}getMeshHash(){return this.symbols.reduce((e,t)=>e+JSON.stringify(t),"")}async collectRequiredFields(e,t){await this.collectVVRequiredFields(e,t);for(const r of this.attributes)r.valueExpression&&await p(e,t,null,r.valueExpression),r.field&&e.add(r.field)}};e([s({type:[m],json:{write:!0}})],S.prototype,"attributes",void 0),e([s(u)],S.prototype,"backgroundFillSymbol",void 0),e([s({type:t,json:{write:!0}})],S.prototype,"defaultColor",void 0),e([s({type:String,json:{write:!0}})],S.prototype,"defaultLabel",void 0),e([s({type:Number,range:{min:0,max:1},json:{write:!0}})],S.prototype,"holePercentage",void 0),e([s({type:y,json:{write:!0}})],S.prototype,"othersCategory",void 0),e([s({type:d,json:{write:!0}})],S.prototype,"legendOptions",void 0),e([s({type:f,json:{default:null,write:!0}})],S.prototype,"outline",void 0),e([s({type:Number,cast:i,json:{write:!0}})],S.prototype,"size",null),e([g({pieChart:"pie-chart"})],S.prototype,"type",void 0),e([s({types:[v]})],S.prototype,"visualVariables",void 0),S=e([l("esri.renderers.PieChartRenderer")],S);export{S as default};