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

Flex 4图表使用实例ColumnChart

发布时间:2020-12-15 04:28:23 所属栏目:百科 来源:网络整理
导读:本例子针对 flash .com/article/flex' target='_blank' flex 的ColumnChart组件写的例子,通过设置ColumnChar的type为不同的类型,得出不同的列状图表。 ColumnChar的type有100%、clustered、overlaid、stacked四种。四种例子都是用到的代码: ?xml version=

本例子针对flash.com/article/flex' target='_blank'>flex的ColumnChart组件写的例子,通过设置ColumnChar的type为不同的类型,得出不同的列状图表。

ColumnChar的type有100%、clustered、overlaid、stacked四种。四种例子都是用到的代码:

<?xml version="1.0" encoding="utf-8"?>
< s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flash.com/article/flex' target='_blank'>flex/spark"
xmlns:mx="library://ns.adobe.com/flash.com/article/flex' target='_blank'>flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;

[Bindable]
private var money:ArrayCollection = new ArrayCollection( [
{ month:6,Fare:120,CostOfLiving:470,Play:231,other:510 },
{ month:7,CostOfLiving:500,Play:106,other:23},
{ month:8,CostOfLiving:650,Play:43,other:342},
{ month:9,CostOfLiving:704,Play:180,other:18},
{ month:10,CostOfLiving:512,Play:410,other:123},
{ month:11,CostOfLiving:823,Play:123,other:124},
])
]]>
</fx:Script>
<mx:ColumnChart id="column" type="stackedclustered overlaid"
dataProvider="{money}">
<mx:horizontalAxis>
<mx:CategoryAxis categoryField="month" />
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries displayName="Fare" yField="Fare">
<mx:fill>
<mx:RadialGradient>
<mx:entries>
<mx:GradientEntry color="#f23f0" />
<mx:GradientEntry color="#f0420" ratio="0"/>
</mx:entries>
</mx:RadialGradient>
</mx:fill>
</mx:ColumnSeries>
<mx:ColumnSeries displayName="CostOfLiving" yField="CostOfLiving">
<mx:fill>
<mx:SolidColor color="#0350f">
</mx:SolidColor>
</mx:fill>
</mx:ColumnSeries>
<mx:ColumnSeries displayName="Play" yField="Play">
<mx:fill>
<mx:SolidColor color="#0af00"/>
</mx:fill>
</mx:ColumnSeries>
<mx:ColumnSeries displayName="other" yField="other">
<mx:fill>
<mx:SolidColor color="#f08788"/>
</mx:fill>
</mx:ColumnSeries>
</mx:series>
</mx:ColumnChart>
<mx:Legend dataProvider="{column}" x="424" y="14"/>
< /s:Application>

(1)type="100%"时,显示如下:

(2)、type="clustered"显示如下:

(3)、type="overlaid"显示如下:

(4)、type="stacked":显示如下:

(编辑:李大同)

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

    推荐文章
      热点阅读