Flex中如何利用seriesFilters属性,添加/删除LineChart图表曲线阴影

Flex中如何利用seriesFilters属性,添加/删除LineChart图表曲线阴影

分类: flex 

  1. <?xml version="1.0"?>  
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  
  3.         layout="vertical"  
  4.         verticalAlign="middle"  
  5.         backgroundColor="white" viewSourceURL="srcview/index.html">  
  6.   
  7.     <mx:Script>  
  8.         <!--[CDATA[  
  9.             private function init(evt:Event):void {  
  10.                 var chart:LineChart = evt.currentTarget as LineChart;  
  11.                 seriesFilterArr = chart.seriesFilters;  
  12.             }  
  13.   
  14.             private function checkBox_click(evt:MouseEvent):void {  
  15.                 var len:uint = lineChart.seriesFilters.length;  
  16.                 if (len > 0) {  
  17.                     lineChart.seriesFilters = [];  
  18.                 } else {  
  19.                     lineChart.seriesFilters = seriesFilterArr;  
  20.                 }  
  21.             }  
  22.         ]]-->  
  23.     </mx:Script>  
  24.   
  25.     <mx:XMLListCollection id="dp">  
  26.         <mx:source>  
  27.             <mx:XMLList>  
  28.                 <quote date="8/27/2007" open="40.38" close="40.81" />  
  29.                 <quote date="8/24/2007" open="40.5" close="40.41" />  
  30.                 <quote date="8/23/2007" open="40.82" close="40.6" />  
  31.                 <quote date="8/22/2007" open="40.4" close="40.77" />  
  32.                 <quote date="8/21/2007" open="40.41" close="40.13" />  
  33.                 <quote date="8/20/2007" open="40.55" close="40.74" />  
  34.                 <quote date="8/17/2007" open="40.18" close="40.32" />  
  35.                 <quote date="8/16/2007" open="39.83" close="39.96" />  
  36.                 <quote date="8/15/2007" open="40.22" close="40.18" />  
  37.                 <quote date="8/14/2007" open="41.01" close="40.41" />  
  38.                 <quote date="8/13/2007" open="41" close="40.83" />  
  39.                 <quote date="8/10/2007" open="41.3" close="41.06" />  
  40.             </mx:XMLList>  
  41.         </mx:source>  
  42.     </mx:XMLListCollection>  
  43.   
  44.     <mx:Array id="seriesFilterArr" />  
  45.   
  46.     <mx:ApplicationControlBar dock="true">  
  47.         <mx:CheckBox id="checkBox"  
  48.                 label="toggle series filters:"  
  49.                 labelPlacement="left"  
  50.                 click="checkBox_click(event);" />  
  51.     </mx:ApplicationControlBar>  
  52.   
  53.     <mx:LineChart id="lineChart"  
  54.             showDataTips="true"  
  55.             dataProvider="{dp}"  
  56.             width="100%"  
  57.             height="100%"  
  58.             creationComplete="init(event);">  
  59.   
  60.         <!-- vertical axis -->  
  61.         <mx:verticalAxis>  
  62.             <mx:LinearAxis baseAtZero="false" title="Price" />  
  63.         </mx:verticalAxis>  
  64.   
  65.         <!-- horizontal axis -->  
  66.         <mx:horizontalAxis>  
  67.             <mx:CategoryAxis id="ca" categoryField="@date" title="Date" />  
  68.         </mx:horizontalAxis>  
  69.   
  70.         <!-- horizontal axis renderer -->  
  71.         <mx:horizontalAxisRenderers>  
  72.             <mx:AxisRenderer axis="{ca}" canDropLabels="true" />  
  73.         </mx:horizontalAxisRenderers>  
  74.   
  75.         <!-- series -->  
  76.         <mx:series>  
  77.             <mx:LineSeries yField="@close" form="curve" displayName="Close" />  
  78.             <mx:LineSeries yField="@open" form="curve" displayName="Open" />  
  79.         </mx:series>  
  80.   
  81.     </mx:LineChart>  
  82.   
  83. </mx:Application>  

  1. <?xml version="1.0"?>  
  2. <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"  
  3.         layout="vertical"  
  4.         verticalAlign="middle"  
  5.         backgroundColor="white" viewSourceURL="srcview/index.html">  
  6.   
  7.     <mx:Script>  
  8.         <!--[CDATA[  
  9.             private function init(evt:Event):void {  
  10.                 var chart:LineChart = evt.currentTarget as LineChart;  
  11.                 seriesFilterArr = chart.seriesFilters;  
  12.             }  
  13.   
  14.             private function checkBox_click(evt:MouseEvent):void {  
  15.                 var len:uint = lineChart.seriesFilters.length;  
  16.                 if (len > 0) {  
  17.                     lineChart.seriesFilters = [];  
  18.                 } else {  
  19.                     lineChart.seriesFilters = seriesFilterArr;  
  20.                 }  
  21.             }  
  22.         ]]-->  
  23.     </mx:Script>  
  24.   
  25.     <mx:XMLListCollection id="dp">  
  26.         <mx:source>  
  27.             <mx:XMLList>  
  28.                 <quote date="8/27/2007" open="40.38" close="40.81" />  
  29.                 <quote date="8/24/2007" open="40.5" close="40.41" />  
  30.                 <quote date="8/23/2007" open="40.82" close="40.6" />  
  31.                 <quote date="8/22/2007" open="40.4" close="40.77" />  
  32.                 <quote date="8/21/2007" open="40.41" close="40.13" />  
  33.                 <quote date="8/20/2007" open="40.55" close="40.74" />  
  34.                 <quote date="8/17/2007" open="40.18" close="40.32" />  
  35.                 <quote date="8/16/2007" open="39.83" close="39.96" />  
  36.                 <quote date="8/15/2007" open="40.22" close="40.18" />  
  37.                 <quote date="8/14/2007" open="41.01" close="40.41" />  
  38.                 <quote date="8/13/2007" open="41" close="40.83" />  
  39.                 <quote date="8/10/2007" open="41.3" close="41.06" />  
  40.             </mx:XMLList>  
  41.         </mx:source>  
  42.     </mx:XMLListCollection>  
  43.   
  44.     <mx:Array id="seriesFilterArr" />  
  45.   
  46.     <mx:ApplicationControlBar dock="true">  
  47.         <mx:CheckBox id="checkBox"  
  48.                 label="toggle series filters:"  
  49.                 labelPlacement="left"  
  50.                 click="checkBox_click(event);" />  
  51.     </mx:ApplicationControlBar>  
  52.   
  53.     <mx:LineChart id="lineChart"  
  54.             showDataTips="true"  
  55.             dataProvider="{dp}"  
  56.             width="100%"  
  57.             height="100%"  
  58.             creationComplete="init(event);">  
  59.   
  60.         <!-- vertical axis -->  
  61.         <mx:verticalAxis>  
  62.             <mx:LinearAxis baseAtZero="false" title="Price" />  
  63.         </mx:verticalAxis>  
  64.   
  65.         <!-- horizontal axis -->  
  66.         <mx:horizontalAxis>  
  67.             <mx:CategoryAxis id="ca" categoryField="@date" title="Date" />  
  68.         </mx:horizontalAxis>  
  69.   
  70.         <!-- horizontal axis renderer -->  
  71.         <mx:horizontalAxisRenderers>  
  72.             <mx:AxisRenderer axis="{ca}" canDropLabels="true" />  
  73.         </mx:horizontalAxisRenderers>  
  74.   
  75.         <!-- series -->  
  76.         <mx:series>  
  77.             <mx:LineSeries yField="@close" form="curve" displayName="Close" />  
  78.             <mx:LineSeries yField="@open" form="curve" displayName="Open" />  
  79.         </mx:series>  
  80.   
  81.     </mx:LineChart>  
  82.   
  83. </mx:Application>  

猜你喜欢

转载自blog.csdn.net/zoerlife/article/details/17098517
今日推荐