2012-04-30 9 views
0

私はpieChartにデータを表示しようとしています。私のdataprovide(例:EmployeeA、EmployeeB..etc)に複数のフィールドがある場合、すべてがうまくいきます。パイは分割され、各部分にテキストが表示されます。Flash Builder:PieChartの問題

ただし、私のデータプロバイダには1つのフィールドしかない(例:EmployeeA)。 pieChartは、pieChart上にテキストを表示しないで、全体の円を表示します。私は、pieChart内にデータテキストを表示する方法があるかどうか疑問に思っていました。どうもありがとう。

コード:

<mx:PieChart id="piechart1" x="254" y="321" width="367" height="367" 
     dataProvider="{getHours.lastResult}"> 
     <mx:series> 
<mx:PieSeries id="pieSeries" labelFunction="pieFunction" 
       explodeRadius="0.05" field="EmployeeOverTime" labelPosition="inside"/> 
      </mx:series> 
</mx:PieChart> 

//EmployeeOverTime data will show on each pie pieces if I have multiple 
//employees in the department but won't show if the department has only one employee. 

答えて

1

それはうちPieSeriesコードのバグだったように見えます。私はこれを動作させるためにチャーティングコードを猿にパッチしなければならなかった。以下は、動作するfxpファイルです。

http://dl.dropbox.com/u/20054635/forever/piechart.fxp

バグがライン3323上で、このコードがあるということです:何nextNeighborのときがありませんでしたので、

var rscale:Number = 1; 
     // find out how much we would have to scale to get to the next neighbor up 
     /* var RXScale:Number = Math.abs(ld.labelX - nextNeighbor.labelX)/(ld.labelWidth/2 + nextNeighbor.labelWidth/2); 

は次にライン3338上で、それは今ゼロである(rscaleに基づいてラベルを削除しますパイチャートの1項目のみです)

if (rscale * Number(labelFormat.size) < insideLabelSizeLimit) 
      { 
       ld.prev.next = ld.next; 
       ld.next.prev = ld.prev; 
       removedLabels.push(ld); 
+0

tyクリント、私はあなたの方法を試しましたが、まだ運がありません。あなたが考えることができる他の方法? +1でも – Rouge

+0

PieSeriesコードのバグのように見える...パッチを作る。 – Clintm

+0

ありがとうございます。 :D – Rouge

関連する問題