I'm using ILOG Elixir to display a task chart, i took the basic code from Tour 
de Flex and changed the code slightly for me, an XML is generated using my java 
application.

When i use almost exactly the code from Tour de Flex (static file retrieval) 
the code is show just fine, without any problems.
however when i change it to httpService to generate the charts dynamically the 
information is not shown correctly: All tasks no matter if it's a summary or a 
leaf are shown as a leaf (a green thick bar instead of a blue thin bar). Also 
if a summary have only one leaf inside, the summary is shown as if it doesn't 
have any leafs.

i would appreciate any help i could get.

my code looks like this:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute"
    backgroundGradientColors="[0x000000,0x323232]" 
    xmlns:ilog="http://www.ilog.com/2007/ilog/flex"; xmlns:local="*"
    creationComplete="init()" width="100%" height="100%"
    horizontalScrollPolicy="off" verticalScrollPolicy="off"
    backgroundColor="0xffffff"
>
 <mx:HTTPService id="taskService" 
url="http://localhost:8080/MAME/uploadFiles/taskdata.xml";
        result="handleResult(event)" fault="handleFault(event)"/>
        
  <mx:Style>  
    .leafTask {
      background-color : #59B87C; 
      border-color : #59B87C;  
      color : #CECECE;
    }
    .summaryTask {
      background-color : #66A0E5;
      color : #66A0E5;
      end-symbol-color : #66A0E5;
      start-symbol-color : #66A0E5;                
    }        
  </mx:Style>
  
  <mx:Script>
    <![CDATA[
    import mx.collections.ArrayCollection;
    import mx.rpc.events.FaultEvent;
    import mx.rpc.events.ResultEvent;
    import ilog.utils.TimeUnit;
    import mx.collections.HierarchicalData;
    import mx.rpc.*;
           
      [Bindable]  
      private var taskCollection:HierarchicalData;
      
       private function init():void
       {
               taskService.send();
       }
      private function onWheel(e:MouseEvent):void
      {
        e.stopImmediatePropagation();
       (e.delta < 0) ? zoomOut() : zoomIn();
      }
      
      private function zoomOut():void
      {
        var allowed:Boolean = (ganttSheet.visibleTimeRangeStart.time != 
ganttSheet.minVisibleTime.time ||
                  ganttSheet.visibleTimeRangeEnd.time != 
ganttSheet.maxVisibleTime.time);
        if (allowed)          
          ganttSheet.zoom(2, null, true);
      }
      private function zoomIn():void
      {
        ganttSheet.zoom(0.5, null, true);
      }
      
      private function handleResult(evt:ResultEvent):void
     {
         taskCollection = new 
HierarchicalData(evt.result.schedule.activities.activity);
         taskCollection.childrenField = "activity";
     }
    
     private function handleFault(evt:FaultEvent):void
     {
        
     }
      
    ]]>
  </mx:Script>
 
  <ilog:TaskChart id="tc" width="100%" height="100%"
                  taskDataProvider="{taskCollection}"
                  taskStartTimeField="start"
                  taskEndTimeField="end"
                  taskIdField="id">
    <ilog:dataGrid>
      <ilog:GanttDataGrid color="0xCECECE" alternatingItemColors="[0x404040, 
0x464646]"
        indentation="2" width="150" >
        <ilog:columns>
          <mx:AdvancedDataGridColumn dataField="name" headerText="Task" />
        </ilog:columns>
      </ilog:GanttDataGrid>
    </ilog:dataGrid>   
    <ilog:ganttSheet>
      <ilog:GanttSheet alternatingItemColors="[0x404040, 0x464646]" 
id="ganttSheet"
                       nonWorkingAlpha="0.1" nonWorkingColor="0xFFFFFF" 
                       mouseWheel="onWheel(event)"
                       minZoomFactor="1728000" 
                       resizeEnabled="false"
                                   moveEnabled="false"
                       />   
    </ilog:ganttSheet>
    <ilog:timeScale>
      <ilog:TimeScale mouseWheel="onWheel(event)"/>
    </ilog:timeScale>               
  </ilog:TaskChart>
</mx:Application>



and the xml looks like that:

<?xml version="1.0" encoding="utf-8"?>
<schedule>
<activities dateFormat="yyyy-M-d">
<activity id="A0" name="Pre A" start="2010/02/01" end="2010/02/08" 
person="Admin Person">
<activity id="A1" name="aaaaaaa" start="2010/02/01" end="2010/02/07" 
person="Admin Person"/>
</activity>
<activity id="A2" name="Phase A" start="2010/02/09" end="2010/02/25" 
person="Admin Person">
<activity id="A3" name="aaaaaa" start="2010/02/09" end="2010/02/11" 
person="Admin Person"/>
<activity id="A4" name="bbbbbb" start="2010/02/12" end="2010/02/15" 
person="Admin Person"/>
<activity id="A5" name="cccccc" start="2010/02/16" end="2010/02/18" 
person="Admin Person"/>
<activity id="A6" name="dddddd" start="2010/02/19" end="2010/02/22" 
person="Admin Person"/>
<activity id="A7" name="eeeeee" start="2010/02/22" end="2010/02/23" 
person="Admin Person"/>
</activity>
</activities>
</schedule>

Reply via email to