2011-01-12 7 views
0

バブルサイズをスケールするか、またはチャートのサイズが変更されたときにサイズを変更する方法があるのだろうかと思います。バブルが特定のピクセルサイズに設定されている場合は、サイズが設定されているように見えます。したがって、あなたのグラフが大きい場合、バブルはサイズXであり、チャートが小さい場合、バブルはまだサイズXです。Flex BubbleChart - チャートのサイズに関連したバブルサイズを作成しますか?

私は何を意味するのかを示すサンプルアプリケーションです。どんな助けやアイデアもありがたいですか?

ありがとうございます!

<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> 
    <mx:Script> 
     <![CDATA[ 
      import mx.collections.ArrayCollection; 
      [Bindable] 
      private var s1:ArrayCollection = new ArrayCollection([ 
       {"x": 20, "y": 10, "r":10 }, 
       {"x": 40, "y": 5, "r":20 } , 
       {"x": 60, "y": 0, "r":30 }]); 
    ]]> 
    </mx:Script> 

    <!-- Define custom color and line style for the bubbles. --> 
    <mx:SolidColor id="sc1" color="red" alpha=".7"/> 
    <mx:Stroke id="stroke1" color="red" weight="2"/> 

    <mx:BubbleChart id="myChart" showDataTips="true" height="100%" width="100%"> 
     <mx:series> 
      <mx:BubbleSeries 
       dataProvider="{s1}" 
       displayName="series1" 
       xField="x" 
       yField="y" 
       radiusField="r" 
       selectable="true" 
       fill="{sc1}" 
       stroke="{stroke1}" 
      /> 
     </mx:series> 
    </mx:BubbleChart> 

</mx:Application> 

答えて

0

できることは、アプリケーションにサイズ変更イベントを追加することです。プログラムのスクリプト部分で

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" resize="handleMainWindowResize()"> 

は、関数を宣言し、その関数にBubbleSeriesがのプロパティを変更:

<mx:Script> 
     <![CDATA[ 
public function handleMainWindowResize():void 
{ 
    //change values of s1 according to the percentage increase (this is important) 
      for each(series in myChart.series) 
      { 
       var bubbleSeries:BubbleSeries= series as BubbleSeries; 
       bubbleSeries.dataProvider =s1;//Resetting the data provider with the changed values 

      } 
} 
    ]]> 

</mx:Script> 

それとも、常にスケーリング変換を使用することができます。 しかし、これは正しい方法です。

+0

ご返信が遅くなりました。これは非常に役に立ちました。ありがとう! – fortpointuiguy

関連する問題