0

この flashbuilder 4.6 アプリケーションは、ドロップダウン リストから選択した名前に基づいて折れ線グラフに単一の lineSeries を表示し、lineseries データは正常に表示されます。ただし、ツールチップには、ドロップダウンで選択した名前の代わりに [object Playername_returntype] が表示されます。

また、ドロップダウンから選択した同じ名前を lineseries の displayName に動的に割り当てたいのですが、これを達成できませんでした。ツールチップのように、結果に [object Playername_returntype] が表示されます。

どんな助けでも大歓迎です。

ありがとう。

   xmlns:s="library://ns.adobe.com/flex/spark"
           xmlns:mx="library://ns.adobe.com/flex/mx"
           xmlns:pool_ratings_yr1service="services.pool_ratings_yr1service.*"
           xmlns:pool_playerservice="services.pool_playerservice.*"
           minWidth="955" minHeight="600">
<fx:Script>
    <![CDATA[
        import mx.controls.Alert;
        import mx.events.FlexEvent;

        protected function linechart1_creationCompleteHandler(event:FlexEvent):void
        {
            getpool_ratings_yr1Result.token = pool_ratings_yr1Service.getpool_ratings_yr1('Greenleaf');
        }


        protected function dropDownList_creationCompleteHandler(event:FlexEvent):void
        {
            getAllpool_playerResult.token = pool_playerService.getAllpool_player();
        }

        private function comboBoxChange():void
        {
            var selectedName:String = dropDownList.selectedItem.lname;
            getpool_ratings_yr1Result.token = pool_ratings_yr1Service.getpool_ratings_yr1(selectedName);

        }


    ]]>
</fx:Script>
<fx:Declarations>
    <s:CallResponder id="getpool_ratings_yr1Result"/>
    <pool_ratings_yr1service:Pool_ratings_yr1Service id="pool_ratings_yr1Service"
                                                     fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                                     showBusyCursor="true"/>
    <s:CallResponder id="getAllpool_ratings_yr1Result"/>
    <s:CallResponder id="getAllpool_playerResult"/>
    <pool_playerservice:Pool_playerService id="pool_playerService"
                                           fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)"
                                           showBusyCursor="true"/>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:LineChart id="linechart1" x="151" y="88" width="800"
              creationComplete="linechart1_creationCompleteHandler(event)"
              dataProvider="{getpool_ratings_yr1Result.lastResult}" showDataTips="true">
    <mx:verticalAxis>
        <mx:LinearAxis id="v1" minimum="2000" maximum="2500" title="Average Elo Rating" /> 
    </mx:verticalAxis> 
    <mx:series>
        <mx:LineSeries id="lineSeries" displayName="{dropDownList.selectedItem}" yField="avg_rating"/>
    </mx:series>
    <mx:horizontalAxis>
        <mx:CategoryAxis id="categoryAxis" categoryField="yr"/>
    </mx:horizontalAxis>
</mx:LineChart>
<mx:Legend dataProvider="{linechart1}"/>
<s:DropDownList id="dropDownList" x="10" y="88"
                creationComplete="dropDownList_creationCompleteHandler(event)"
                labelField="lname"
                change="comboBoxChange()">
    <s:AsyncListView list="{getAllpool_playerResult.lastResult}"/>
</s:DropDownList>

4

1 に答える 1

0

何を求めているのか完全にはわかりませんが、LineSeries displayNameについては、次のようにしました。

ラインシリーズごとに[Bindable]文字列変数を作成し、データが変更されるたびに、変数に必要な値を割り当てるだけです。あなたの例では:

private function comboBoxChange():void
    {
        var selectedName:String = dropDownList.selectedItem.lname;
        getpool_ratings_yr1Result.token = pool_ratings_yr1Service.getpool_ratings_yr1(selectedName);
        // Private Bindable String variable(myString) assigned earlier
        myString = selectedName;

    }

そして、mxmlで:

displayName="{myString}"

それが十分に明確であることを願っています!

于 2013-01-09T15:53:01.300 に答える