Thank Matt.
I have a better control about the building of my chart with the method creationComplete() which you advise me to use.
Indeed I could optimize my chart! For example, the LinearAxis generates by default the property autoAdjust to true. It was problematic to watch a Date in this format 11.8...
Thank you again for all people who participates actively to this forum, it's a great experience!
Have a good day.
David


De : flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] De la part de Matt Chotin
Envoyé : samedi 30 juillet 2005 02:29
À : flexcoders@yahoogroups.com
Objet : RE: [flexcoders] COLUMNCHART + REPEATER

I think we might have a known bug on charts being used within Repeaters where the various fill objects may not assign correctly.  Rather than assign in the repeater maybe you’ll need to use the creationComplete event of the chart to go ahead and assign those values.  In your event handler use event.target.repeaterIndices[0] to get the index (I think).

 

Matt

 


From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of david_gal-reyniez
Sent: Thursday, July 28, 2005 9:59 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] COLUMNCHART + REPEATER

 

Hi everybody,

 

I try to generate 4 charts thanks to the REPEATER object but I partially success.

Can you help me to success totally...

The chart contains the good values, the legend generates the good labels et the defined colors.

The problem is to get the value for the both axis (in this case : day and resources) et to have the same color for the chart and its corresponding label.

 

Thanks very much for your help!

 

// METHOD : Create the data for the Chart


public function setOverviewThree():Array
{
 var tempArray:Array = new Array();
 
 var arrDay:Array = new Array();
 arrDay = setTheLastThirtyDays(30);               // Call a methode which gives the last 30 days from today
 
 for (var i:Number=0; i<30; i++)
 {
  var resources_i:Number = Math.ceil(20*Math.random());
  
  var o:Object = new Object();
  o.day = arrDay[i];
  o.resources = resources_i;
  tempArray.push(o);
  
 }
 
 tempArray.sort(0, 2);
 return tempArray;
}

 

 

// METHOD : Create the data for the 4 charts

 

public function createChart():Array
{
 var tempArray:Array = new Array();
 
 var arrTitle:Array = new Array();
 arrTitle = ["NAME1", "NAME2", "NAME3", "NAME4"];
  
 var arrData:Array = new Array();
 arrData = [setOverviewThree(), setOverviewThree(), setOverviewThree(), setOverviewThree()];
 
 var arrColors:Array = new Array();
 arrColors = [0xCCCC99, 0x99CCCC, 0x669966, 0xCC99FF];
 
 var arrLabels:Array = new Array();
 arrLabels = ["name1", "name2", "name3", "name4"];
 
 for (var i:Number=0; i<arrTitle.length; i++)
 {
  var o:Object = new Object();
  
  o.title = arrTitle[i];
  
  o.chartData = arrData[i];
  
  var labels:String = arrLabels[i];
  var fill:SolidColor = new SolidColor(arrColors[i]);
  var stroke:Stroke = new Stroke(0x000000);
  
  o.legend=[{ label:labels, fill:fill, stroke:stroke}];
  
  tempArray.push(o);
 }
 
 return tempArray;
}

 

 

 

// MXML FILE

<mx:Repeater id="rpCharts"
              dataProvider="{ arrCharts }" >
              
              <cp:CustomizedText  id="txtChart"
                    styleName="text"
                    text="{ arrCharts[rpCharts.currentIndex].title }"
                    width="100%" />
                    
              <mx:Spacer    height="6" />
              
              <!-- CHART WITH ONE DATA COLUMN -->
              
              <cp:CustomizedHBox  id="chbxChartOneColumn"
                    visible="true"
                    width="100%"
                    height="100%"
                    verticalAlign="middle"
                    horizontalGap="0">
                         
                    <mx:ColumnChart id="ccChartOneColumn"
                        styleName="chart"
                        x="20"
                        height="160"
                        width="100%"
                      &! nbsp;&nb sp;minWidth="500"
                        visible="true"
                        dataProvider="{ arrCharts[rpCharts.currentIndex].chartData }"            // <<<--------------------Here is the dataProvider [it works]
                        mouseClickData="{ setDashboard( event ) }"
                        showDataTips="true">
                       
                        <!--<mx:horizontalAxis>
                          <mx:CategoryAxis name="day"
                               dataProvider="{ arrCharts[rpCharts.currentIndex].chartData.day }"            // <<<--------------------Here is the dataProvider [it doesn't work]
                               categoryField="day" />
                        </mx:horizontalAxis>-->
                     
                        <mx:horizontalAxisRenderer>
                        
                         <mx:AxisRenderer title="date"
                              styleName="chart"
                              labelGap="4" />
                         
                        </mx:horizontalAxisRenderer>
                        
                        <!--<mx:verticalAxis>
                          <mx:CategoryAxis name="resources"
                               dataProvider="{ arrCharts[rpCharts.currentIndex].chartData.resources }"            // <<<--------------------Here is the dataProvider [it doesn't work]
                               categoryField="resources" />
                        
                        </mx:verticalAxis>-->
                     
                        <mx:verticalAxisRenderer>
                        
                         <mx:AxisRenderer title="date"
                              styleName="chart"
                              labelGap="8" />
                         
                        </mx:verticalAxisRenderer>
                          
                        <mx:series>
                          <mx:Array>
                            <mx:ColumnSeries yField="resources"
                                 styleName="chart"
                                 showDataEffect="Fade"
                                 xField="day"
                                 name="resources">
                                   
                                 <mx:fill>
                                  <mx:SolidColor color="{ arrCharts[rpCharts.currentIndex].legend }" />            // <<<--------------------Here is the colum color definition [it doesn't work]
                                 </mx:fill>
          
                            </mx:ColumnSeries>
                            <mx:LineSeries  yField="resources"
                                 styleName="chart"
                                 showDataEffect="Fade"
                                 xField="day"
                                 name="resources" />
                          </mx:Array>
                        </mx:series>
                          
                    </mx:ColumnChart>
                         
                    <mx:Legend  dataProvider="{ arrCharts[rpCharts.currentIndex].legend  }"            // <<<--------------------Here is the legen color definition [it works]
                        width="140"
                        height="120"
                        styleName="legend"
                        direction="vertical">

 

                    </mx:Legend>
                        
              </cp:CustomizedHBox>

 

</mx:Repeater >

**********************************************************************

Coface facilite les echanges entre les entreprises partout dans le monde. Pour cela, elle offre a toutes les entreprises des solutions pour gerer, financer et proteger leur poste client, en leur permettant d'externaliser tout ou partie de la gestion et des risques lies a leurs relations commerciales. Coface est notee AA par Fitch Ratings et Aa3 par Moody's.

Pour en savoir plus, http://www.coface.fr

Coface facilitates business-to-business commerce worldwide. It offers all size companies an array of solutions to manage, finance, and protect their accounts receivables affording them the option of fully or partly outsourcing trade relationship management and attendant risks. Coface is rated AA by Fitch ratings and Aa3 by Moody's.

More about Coface, http://www.coface.com

WARNING :

- Soyez conscient que notre systeme Anti-Spam peut parfois rejeter des messages, soit parce que certains mots et types de fichiers ne sont pas acceptes, ou bien parce que le mail n'a pas ete identifie correctement.

- Be aware that from time to time our Anti-Spam system may reject mails either because some words and types of files are not allowed or because mails are misidentified.

**********************************************************************


**********************************************************************

Coface facilite les echanges entre les entreprises partout dans le monde. Pour cela, elle offre a toutes les entreprises des solutions pour gerer, financer et proteger leur poste client, en leur permettant d'externaliser tout ou partie de la gestion et des risques lies a leurs relations commerciales. Coface est notee AA par Fitch Ratings et Aa3 par Moody's.

Pour en savoir plus, http://www.coface.fr

Coface facilitates business-to-business commerce worldwide. It offers all size companies an array of solutions to manage, finance, and protect their accounts receivables affording them the option of fully or partly outsourcing trade relationship management and attendant risks. Coface is rated AA by Fitch ratings and Aa3 by Moody's.

More about Coface, http://www.coface.com

WARNING :

- Soyez conscient que notre systeme Anti-Spam peut parfois rejeter des messages, soit parce que certains mots et types de fichiers ne sont pas acceptes, ou bien parce que le mail n'a pas ete identifie correctement.

- Be aware that from time to time our Anti-Spam system may reject mails either because some words and types of files are not allowed or because mails are misidentified.

**********************************************************************



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Computer software testing Macromedia flex Development
Software developer


YAHOO! GROUPS LINKS




Reply via email to