Chinaunix首页 | 论坛 | 博客
  • 博客访问: 30480273
  • 博文数量: 708
  • 博客积分: 12163
  • 博客等级: 上将
  • 技术积分: 8240
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-04 20:59
文章分类

全部博文(708)

分类: 系统运维

2008-08-27 18:36:18

使用横跨整行的项目渲染器

您可以在一个分层数据上使用某一项目渲染器设置其显示整行数据。下面示例是一个PieChart(饼图)控件来显示分层数据中的detail字段数据。每行包含的detail信息是各个代表的销售收入信息,下面是其中一个显示图表:

img

以下代码实现该示例:

"1.0"?>

"">


[CDATA[
import mx.collections.ArrayCollection;

[Bindable]
private var dpHierarchy:ArrayCollection= new ArrayCollection([
{name:"Barbara Jennings", region: "Arizona", total:70, children:[
{detail:[{amount:5},{amount:10},{amount:20},{amount:45}]}]},
{name:"Dana Binn", region: "Arizona", total:130, children:[
{detail:[{amount:15},{amount:25},{amount:35},{amount:55}]}]},
{name:"Joe Smith", region: "California", total:229, children:[
{detail:[{amount:26},{amount:32},{amount:73},{amount:123}]}]},
{name:"Alice Treu", region: "California", total:230, children:[
{detail:[{amount:159},{amount:235},{amount:135},{amount:155}]}
]}
]);
]]>


"myADG"
width="100%" height="100%"
variableRowHeight="true">

"{dpHierarchy}"/>


"name" headerText="Name"/>
"total" headerText="Total"/>



dataField="detail"
renderer="myComponents.ChartRenderer"
columnIndex="0"
columnSpan="0"/>


您可以修改该示例以在单列中显示PieChart控件。在下面的例子中,增加了一个Detail列给该控件,然后将该控件指定为第2列的项目渲染器:

"1.0"?>

"">


[CDATA[
import mx.collections.ArrayCollection;

[Bindable]
private var dpHierarchy:ArrayCollection= new ArrayCollection([
{name:"Barbara Jennings", region: "Arizona", total:70, children:[
{detail:[{amount:5},{amount:10},{amount:20},{amount:45}]}]},
{name:"Dana Binn", region: "Arizona", total:130, children:[
{detail:[{amount:15},{amount:25},{amount:35},{amount:55}]}]},
{name:"Joe Smith", region: "California", total:229, children:[
{detail:[{amount:26},{amount:32},{amount:73},{amount:123}]}]},
{name:"Alice Treu", region: "California", total:230, children:[
{detail:[{amount:159},{amount:235},{amount:135},{amount:155}]}
]}
]);
]]>


"myADG"
width="100%" height="100%"
variableRowHeight="true">

"{dpHierarchy}"/>


"name" headerText="Name"/>
"total" headerText="Total"/>
"detail" headerText="Detail"/>



dataField="detail"
renderer="myComponents.ChartRenderer"
columnIndex="2"/>


阅读(2622) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~