Flex 学习笔记 LineChart双坐标

 

如何实现纵坐标左右两边都绑定数据显示呢,实现代码如下

AS

 

    <fx:Script>
        <![CDATA[
             import mx.collections.ArrayCollection;
            
            [Bindable] 
             private  var monthData:ArrayCollection=new ArrayCollection([                 
                {xname:'1月',yname:2000,y2name:800},                 
                {xname:'2月',yname:1000,y2name:500},                 
                {xname:'3月',yname:3000,y2name:700},                 
                {xname:'4月',yname:1000,y2name:800},                 
                {xname:'5月',yname:1300,y2name:800}]); 
                        
            [Bindable] 
             private  var monthGrowData:ArrayCollection=new ArrayCollection([ 
                {xname:'1月',y3name:1000,y4name:60},             
                {xname:'2月',y3name:1200,y4name:100},                 
                {xname:'3月',y3name:4300,y4name:800},                 
                {xname:'4月',y3name:200,y4name:800},                 
                {xname:'5月',y3name:2700,y4name:800}]); 
        ]]>
    </fx:Script>

MXML

    <mx:LineChart showDataTips="true" dataProvider="{monthData}" secondDataProvider="{monthGrowData}">        
        <mx:horizontalAxis>
            <mx:CategoryAxis categoryField="xname"/>
        </mx:horizontalAxis>
        <mx:series>
            <mx:LineSeries yField="yname" />
            <mx:LineSeries yField="y2name" />
        </mx:series>
        
        <mx:secondSeries>
            <mx:LineSeries yField="y3name" />
            <mx:LineSeries yField="y4name" />
        </mx:secondSeries>
    </mx:LineChart>

 

如果纵坐标只绑定一列数据的话,可以参考下面的代码(下面转载,收藏下,O(∩_∩)O哈!)

http://justcode.w.blog.163.com/blog/static/11430304820115411233290/

 

 

转载于:https://www.cnblogs.com/Anlycp/archive/2012/07/13/2590652.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值