----- Original Message ----- 
From: "Rodrigo" <[EMAIL PROTECTED]>
To: <flexcoders@yahoogroups.com>
Sent: Saturday, January 26, 2008 2:44 AM
Subject: [flexcoders] Flex LineSeries and Complex XML!!! Almost 
IMPOSSIBLE!!!


> Hi Flex Masters!!!
>
>
> First of all, thank for your support!!!
>
> One of your Adobe collegues called Swathi Solsi recommended to talk
> to you about Flex, suggesting you are a great master of this art.
>
> I have an issue here and i think you could help me...in fact, i beg
> your help. :-)
>
> I am evaluating how can Flex work with Complex XML Files.
>
> Intention of the application:  To plot a LINESERIES graph Where the
> Y axis is the Price and the X axis is the Time. The idea is to see
> the evolution of the price per product.
> Also in the tooltip the intention is to Show the Month, the model,
> the name, the volume and the price.
>
> Questions:
>
> 1 - Is it needed to work with XMLListCollection when dealing with
> Complex XML mandatory?

No, but it's important for binding.

> 2 - What is the problem in this MXML, because it is plotting the
> repeated values in the X and Y, and not plotting the graph itself.

I don't have time to wade through it all but..

resultFormat="e4x" would help.
specifiying fields as attributes ("@") when they were not, doesn't help.

Good luck.

Paul

BTW  - change the URL back to what it should be first..

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
creationComplete="feedRequest.send()">

<mx:XML id="mlb" source="/data/mydata.xml"/>


  <mx:Style>
     ColumnChart  {
         gutterLeft:50;
        gutterRight:50;
        gutterBottom:50;
        paddingTop:20;

        chartSeriesStyles: PLCSeries1, PLCSeries2, PLCSeries3,
PLCSeries4;
     }
     .PLCSeries1 {
        fill: #0000ff;
     }
     .PLCSeries2 {
        fill: #ff0000;
     }
     .PLCSeries3 {
        fill: #00ff00;
     }
     .PLCSeries4 {
        fill: #999999;
     }

  </mx:Style>

 <mx:HTTPService
   resultFormat="e4x"
        id="feedRequest"
        url="data/mydata.xml"
        useProxy="false" />

  <mx:Model id="results" source="/data/mydata.xml"/>

 <mx:Stroke id="axisStroke"
        color="#e4e4e4"
        weight="6"
        alpha=".75"
        caps="square"
  />



  <mx:Panel title="Line Chart">
     <mx:LineChart id="chart"
dataProvider="{feedRequest.lastResult..product}" showDataTips="true">

        <!-- background elements -->
        <mx:backgroundElements>
            <mx:GridLines direction="both"
                    horizontalTickAligned="true"
                    verticalTickAligned="true">
                <mx:horizontalFill>
                    <mx:SolidColor color="haloBlue" alpha="0.2" />
                </mx:horizontalFill>
                <mx:horizontalAlternateFill>
                    <mx:SolidColor color="haloSilver" alpha="0.2" />
                </mx:horizontalAlternateFill>
                <mx:verticalFill>
                    <mx:SolidColor color="haloBlue" alpha="0.2" />
                </mx:verticalFill>
                <mx:verticalAlternateFill>
                    <mx:SolidColor color="haloSilver" alpha="0.2" />
                </mx:verticalAlternateFill>
            </mx:GridLines>
        </mx:backgroundElements>


        <mx:verticalAxis>
           <mx:CategoryAxis categoryField="price" />
        </mx:verticalAxis>

        <mx:horizontalAxis>
           <mx:CategoryAxis categoryField="period"/>
        </mx:horizontalAxis>

        <mx:series>

           <mx:LineSeries yField="price"  form="curve"
displayName="Orange"
dataProvider="{feedRequest.lastResult..product}"/>

  <!--     <mx:LineSeries yField="apple" form="curve"
displayName="Apple"/>
           <mx:LineSeries  yField=""  form="curve"
displayName="Orange"
dataProvider="{xdata.data.result.product.price}"/>
             <mx:LineSeries yField="@price" form="curve"
displayName="Orange"
dataProvider="feedRequest.lastResult.data.result.inperiod.product" />
           <mx:LineSeries yField="[EMAIL PROTECTED]" form="curve"
displayName="Orange" />
           <mx:LineSeries yField="orange" form="curve"
displayName="Orange"/>
           <mx:LineSeries yField="kiwi" form="curve"
displayName="Kiwi"/>

                <mx:LineChart id="chart"
dataProvider="{feedRequest.lastResult.data.result}"
showDataTips="true">

           FUNCIONOU SEM PAU:
             <mx:LineSeries yField="@product..price" form="curve"
displayName="Orange" />
                        <mx:CategoryAxis categoryField="months"
dataProvider="{feedRequest.lastResult.data.result}"/>
           <mx:Array></mx:Array>

           -->
        </mx:series>
     </mx:LineChart>
     <mx:Legend dataProvider="{chart}"/>

  </mx:Panel>

  <!--
  <mx:Script>
  import mx.collections.ArrayCollection;
  [Bindable]
  public var expenses:ArrayCollection = new ArrayCollection([
     {Month: "Jan", Profit: 2000, Expenses: 1500},
     {Month: "Feb", Profit: 1000, Expenses: 200},
     {Month: "Mar", Profit: 1500, Expenses: 500}
  ]);
  </mx:Script>

    <mx:Panel>
     <mx:ColumnChart id="column" dataProvider="{results.income}">
        <mx:horizontalAxis>
           <mx:CategoryAxis
                dataProvider="{results.income}"
                categoryField="month"
           />
        </mx:horizontalAxis>
        <mx:series>
           <mx:ColumnSeries
                xField="month"
                yField="profit"
                displayName="Profit"
           />
           <mx:ColumnSeries
                xField="month"
                yField="expenses"
                displayName="Expenses"
           />
           <mx:ColumnSeries
                xField="month"
                yField="gross"
                displayName="Gross"
           />
        </mx:series>
     </mx:ColumnChart>
     <mx:Legend dataProvider="{column}" />
  </mx:Panel>
  <mx:List id="list" dataProvider="{results.result}" width="130"
height="100%" dragEnabled="true"/>
-->



</mx:Application> 

Reply via email to