0 Replies Latest reply on Nov 2, 2010 7:13 AM by Sen Imagines

    Problem with Multiple PlotSeries with "0" as its value

    Sen Imagines

      Hi,

       

      I am using a Flex 3 Plot chart. Data for which is sent thru a remote XML file.

       

      PerComp in x-axis & CostHigh / CostLow in the y-axis

       

      I use two plot series: LowSeries which takes "CostLow" parameter value fom the XML for its y axis value and

      "CostHigh" series  which takes "CostHigh" parameter value fom the XML for its y axis value

       

      and the XML node can have either CostHigh (or) CostLow.

      If CostHigh is there, it shuld be added to the HighSeries in the chart

      If CostLow is there, it shuld be added to the LowSeries in the chart

       

      When I give a value of "0", to any of the CostHigh / CostLow XML node, i am getting duplicate plottings / incorrect plottings.

       

      The Sample XML data:

      ---------------------------------

       

      <?xml version="1.0" encoding="utf-8"?>

      <products>

          <product PerComp="10">

              <ProdName>Product1</ProdName>

              <CostHigh>0</CostHigh>

          </product>

         

          <product PerComp="30">

              <ProdName>Product2</ProdName>

              <CostLow>0</CostLow>

          </product>

         

          <product PerComp="50">

              <ProdName>Product3</ProdName>

              <CostLow>3</CostLow>

          </product>

      </products>

       

       

      The Sample Code:

      ------------------------------

      <?xml version="1.0"?>

       

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:local="*" layout="absolute" initialize="init()" creationComplete="srv.send()">

       

      <mx:HTTPService id="srv" url="myChartData.xml" />

       

          <mx:Script>

              <![CDATA[

       

             import mx.charts.renderers.*;

              import flash.events.Event;       

              import mx.rpc.events.FaultEvent;

              import mx.charts.events.ChartItemEvent;

              import mx.charts.HitData;

         

              /* FAULT HANDLER */

              public function myFaultHandler(event:FaultEvent):void

              {

              Alert.show(event.fault.message);

              }

       

             

              public function myDataTipFunction(hd:HitData):String

              {

                   return "<B>"+hd.item.ProdName+"</B>";

              }

          

              ]]>

          </mx:Script>

       

          <!-- Define custom colors for use as plot point fills. -->

          <mx:SolidColor id="lowfill" color="#67ab1f" alpha=".6"/>

          <mx:SolidColor id="highfill" color="#F30707" alpha=".6"/>

         

       

            <mx:VBox width="100%" height="100%" horizontalAlign="center" backgroundColor="#FFFFFF" paddingTop="8">

          <mx:HBox width="98%" horizontalAlign="left" verticalAlign="middle">

              <mx:Legend dataProvider="{myInteractiveChart}" direction="horizontal"/>

          </mx:HBox>

            

              <mx:PlotChart id="myInteractiveChart"

                  height="100%"

                  width="100%"

                  showDataTips="true"

                  dataProvider="{srv.lastResult.products.product}"

                  dataTipFunction="myDataTipFunction" selectionMode="single"

              >               

             

              <mx:verticalAxis>

                 <mx:LinearAxis title="Cost" />

                 </mx:verticalAxis>

             

              <mx:horizontalAxis>

                 <mx:LinearAxis title="% Complete"/>

              </mx:horizontalAxis>

             

                  <mx:series>

                      <mx:PlotSeries id="LowSeries" xField="PerComp" yField="CostLow" displayName="Low Series" radius="8"                   

                          fill="{lowfill}"

                          itemRenderer="mx.charts.renderers.CircleItemRenderer"

                      />

                      <mx:PlotSeries

                      id="HighSeries" xField="PerComp" yField="CostHigh" displayName="Red Series" radius="8"

                          fill="{highfill}"

                          itemRenderer="mx.charts.renderers.CircleItemRenderer"                   

                      />

                  </mx:series>

              </mx:PlotChart>

             

         </mx:VBox>           

      </mx:Application>

       

      -----------------------------------------

      How can I rectify this?

       

      - Sen