Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   Flex (http://www.flasher.ru/forum/forumdisplay.php?f=84)
-   -   PlotChart - как обратиться к обжекту из датаПровайдера (http://www.flasher.ru/forum/showthread.php?t=125347)

BregoXX 22.05.2009 02:37

PlotChart - как обратиться к обжекту из датаПровайдера
 
Код AS3:

<?xml version="1.0"?>
<!-- Simple example to demonstrate the PlotChart control. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        <![CDATA[
        import mx.collections.ArrayCollection;
 
        [Bindable]
        private var expensesAC: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>
 
    <!-- Define custom colors for use as plot point fills. -->
    <mx:SolidColor id="sc1" color="blue" alpha=".3"/>
    <mx:SolidColor id="sc2" color="red" alpha=".3"/>
    <mx:SolidColor id="sc3" color="green" alpha=".3"/>
 
    <!-- Define custom Strokes. -->
    <mx:Stroke id="s1" color="blue" weight="1"/>
    <mx:Stroke id="s2" color="red" weight="1"/>
    <mx:Stroke id="s3" color="green" weight="1"/>
        <mx:Script>
                <![CDATA[
                        import mx.controls.Alert;
                        private function cli(event:MouseEvent):void
                        {
                                //Alert.show((event.currentTarget as PlotSeries).здесь обратиться к свойству обжекта из датаПровайдера, на который мы нажали.
                        }
 
                ]]>
        </mx:Script>
 
 
    <mx:Panel title="PlotChart Control Example" height="100%" width="100%">
        <mx:PlotChart id="plot"
            height="100%"
            width="100%"
            paddingLeft="5"
            paddingRight="5"
            showDataTips="true"
            dataProvider="{expensesAC}"
        >               
            <mx:series>
                <mx:PlotSeries
                        click="cli(event)"
                    xField="Expenses"
                    yField="Profit"
                    displayName="Plot 1"
                    fill="{sc1}"
                    stroke="{s1}"
                />
            </mx:series>
        </mx:PlotChart>
        <mx:Legend dataProvider="{plot}"/>
    </mx:Panel>
</mx:Application>

Такой вот код.
Не догоняю как обратиться к обьекту из датаПровайдера.
Когдо делаю roll мышей то отображает два поля из обьекта. В общем, что-то мыслей совсем нет.

r_r_f_r 22.05.2009 14:22

Вопрос не понятен, но может быть dataTipFunction поможет.


Часовой пояс GMT +4, время: 11:57.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.