加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ArcGISServer Flex API 内嵌饼状图

发布时间:2020-12-15 03:59:55 所属栏目:百科 来源:网络整理
导读:InfoSymbol 符号内嵌 PieChart 控件,饼图的 dataProvider 属性绑定的是 {data.thematic} ,它代表的其实就是 Graphic 对象的 attributes 属性的 thematic 对象, InfoSymbol 中的 data 代表的就是其对应的 Graphic 对象的 attributes 属性。 ???????? fx:De

InfoSymbol符号内嵌PieChart控件,饼图的dataProvider属性绑定的是{data.thematic},它代表的其实就是Graphic对象的attributes属性的thematic对象,InfoSymbol中的data代表的就是其对应的Graphic对象的attributes属性。

???????? <fx:Declarations>

?????????????????<!--将非可视元素(例如服务、值对象)放在此处 -->???????????????

?????????????????<esri:InfoSymbolid="infoSymbol" infoPlacement="center" >

?????????????????????????<esri:infoRenderer>

??????????????????????????????????<fx:Component>

???????????????????????????????????????????<s:ItemRenderer>??????????????????????????????????????

????????????????????????????????????????????????????<mx:PieChartshowDataTips="true" width="150" height="150"dataProvider="{data.thematic}">

????????????????????????????????????????????????????????????<mx:series>

?????????????????????????????????????????????????????????????????????<mx:PieSeriesfield="value" displayName="数值" nameField="item"/>

????????????????????????????????????????????????????????????</mx:series>

????????????????????????????????????????????????????</mx:PieChart>

???????????????????????????????????????????</s:ItemRenderer>

??????????????????????????????????</fx:Component>

?????????????????????????</esri:infoRenderer>

?????????????????</esri:InfoSymbol>

???????? </fx:Declarations>

?

注意:要将PieChart控件嵌入到s:ItemRenderer中,否则会提示data属性未定义

?

查询得到的Graphic中取出要显示在饼图中的属性值(如:p2009p2010p2011,组合成包含itemvalue两字段的对象存放在ArrayCollection中,其中itemvalue用于PieChartPieSeries绑定,最后将这个ArrayCollection设置给Graphic.attributes.thematic

?

???????????????????????????????????????????foreach( var gra:Graphic in featureSet.features)

???????????????????????????????????????????{

????????????????????????????????????????????????????varppoint:MapPoint = gra.geometry as MapPoint;

????????????????????????????????????????????????????varmp:MapPoint = new MapPoint(ppoint.x,ppoint.y);

????????????????????????????????????????????????????varg:Graphic = new Graphic(mp);

????????????????????????????????????????????????????g.attributes= new Object();

????????????????????????????????????????????????????varthematic:ArrayCollection = new ArrayCollection( [??????????????????????????????????? ????????

????????????????????????????????????????????????????????????{item: "项目1",value: gra.attributes["p2009"] },

????????????????????????????????????????????????????????????{item: "项目2",value: gra.attributes["p2010"] },

????????????????????????????????????????????????????????????{item: "项目3",value: gra.attributes["p2011"] } ]);

????????????????????????????????????????????????????g.attributes.thematic= thematic;

????????????????????????????????????????????????????templyr.add(g);?

}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读