0 Replies Latest reply on Jan 11, 2013 1:23 PM by MC1061

    Direction Needed: Storing calculated values from datagrid column in order to call values into graph


      Hi all,


      I am new to Flex/Flash Builder, actionscript, and mxml, so please be kind.


      I have developed a small program that has a component that displays a datagrid fed with information out of a mysql db via a php data services connection. Within that same component (page), I have a graph that charts the dates via a plot chart. I am interested in adding a line series to the graph, but the data I want to use is a calculated field in the datagrid which I used a custom lable function to derive and display. Can someone steer me to the correct method to store such values and how to call them into a chart?



      Some addition information


      Custom label function:


        /* Custom label function for the Delta1 column. Calculates the number of days between the planting date and 10% flower. */

                                    private function calculateTo1stFlower(item:Object, column:GridColumn):String {

                                              var tempDate1:Date = new Date(item.dflower10 - item.dplanting);

                                              return Math.round((tempDate1.time / MS_PER_DAY) + 1).toString();



      /* Number of milliseconds in a day. (1000 milliseconds per second * 60 seconds per minute * 60 minutes per hour * 24 hours per day) */

                                    private const MS_PER_DAY:uint = 1000 * 60 * 60 * 24;


      Within my spark datagrid


      <s:GridColumn width="30" headerText="Δ1" labelFunction="calculateTo1stFlower" ></s:GridColumn>




      I assume I need to store the array of values for this column and then chart the saved values as the xField within the LineSeries. Should I use a class based model?

      The following link seemed like it may be an appropriate path; I am not sure though.



      Thanks in advance for any support,