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/

 

 

你可能感兴趣的:(chart)