change the width and color of the lines for line chart

change the width and color of the lines for line chart

Postby haretu » Wed Mar 23, 2011 10:33 am

Adobe flex change the width and color of the lines for each series by using the <mx:lineStroke> tag
Code: Select all
<?xml version="1.0"?>
<!-- charts/BasicLineStroke.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script><![CDATA[
     import mx.collections.ArrayCollection;
     [Bindable]
     public var expenses:ArrayCollection = new ArrayCollection([
        {Month:"Jan", Profit:2000, Expenses:1500, Amount:450},
        {Month:"Feb", Profit:1000, Expenses:200, Amount:600},
        {Month:"Mar", Profit:1500, Expenses:500, Amount:300}
     ]);
  ]]></mx:Script>
  <mx:Panel title="Line Chart With Strokes">
     <mx:LineChart id="myChart"
        dataProvider="{expenses}"
        showDataTips="true"
     >
        <mx:horizontalAxis>
           <mx:CategoryAxis
                dataProvider="{expenses}"
                categoryField="Month"
            />
        </mx:horizontalAxis>
        <mx:series>
           <mx:LineSeries
            yField="Profit"
            displayName="Profit"
           >
            <mx:lineStroke>
                <mx:Stroke
                    color="0x0099FF"
                    weight="20"
                    alpha=".2"
                />
            </mx:lineStroke>               
           </mx:LineSeries>
           <mx:LineSeries
            yField="Expenses"
            displayName="Expenses"
           >
            <mx:lineStroke>
                <mx:Stroke
                    color="0x0044EB"
                    weight="20"
                    alpha=".8"
                />
            </mx:lineStroke>               
           </mx:LineSeries>
        </mx:series>
     </mx:LineChart>
     <mx:Legend dataProvider="{myChart}"/>
  </mx:Panel>
</mx:Application>
Attachments
Screen shot 2011-03-23 at 10.33.24 AM.png
Screen shot 2011-03-23 at 10.33.24 AM.png (41.14 KiB) Viewed 721 times
haretu
 
Posts: 132
Joined: Sat Jan 08, 2011 9:56 pm

Return to Adobe FLEX Flash

Who is online

Users browsing this forum: No registered users and 1 guest

cron