[flexcoders] Re: converting a Java object into a chart dataprovider

2009-03-18 Thread netdeep
Right.  I'd like to basically return an array of arrays, visually organized 
like a spread sheet.  So the xField might point to column 0 (the first array) 
and yField to column 1.  For then next series, xField would still be column 0 
and yField would be column 2, etc.

As far as the actual way to pull this off in java, I'm not sure how to do it in 
a way that flex will recognize as an associative array (like the 
Month:January, Profit:2000, Expenses:1500, Amount:450 from the first example).


--- In flexcoders@yahoogroups.com, Josh McDonald j...@... wrote:

 But what will the objects be that you're sending back? You can't make a
 chart out of a list of numbers, it'd be one-dimensional, not to mention not
 very useful :)
 
 -Josh
 
 2009/3/18 netdeep deep...@...
 
 
  I'll be sending Dates, Strings, and floats.
 
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Josh
  McDonald josh@ wrote:
  
   What kind of objects are in your array?
  
   -Josh
  
   2009/3/17 netdeep deepnet@
 
  
In the flex documentation, it shows how to easily create a chart with
mxml and a static Array:
   
private var expenses:Array = [
{Month:January,Profit:2000,Expenses:1500,Amount:450},
{Month:February,Profit:1000,Expenses:200,Amount:600},
{Month:March,Profit:1500,Expenses:500,Amount:300},
];
mx:ColumnSeries
xField=Month
yField=Profit
displayName=Profit
/
mx:ColumnSeries
xField=Month
yField=Expenses
displayName=Expenses
/
   
But I am reading my data from the database and want to pass the data
  via a
java object. But I don't know the number of fields at runtime. So how
  do I
assign the xFields and yFields since I won't be able to create a
  variable
named Month or Profit? I'll just have an array of floats or dates
  or
whatever. Here's a start put I have no idea how to plug in the missing
pieces or if another route would be preferable.
   
var lineSeries:LineSeries = new LineSeries();
BindingUtils.bindProperty(lineSeries, dataProvider, ser,
  javaArray);
// lineSeries.xField= ???
// lineSeries.yField= ???
   
The data set is often quite large by the way.
   
   
   
  
  
  
   --
   Therefore, send not to know For whom the bell tolls. It tolls for thee.
  
   Josh 'G-Funk' McDonald
   - josh@
   - http://twitter.com/sophistifunk
   - http://flex.joshmcdonald.info/
  
 
   
 
 
 
 
 -- 
 Therefore, send not to know For whom the bell tolls. It tolls for thee.
 
 Josh 'G-Funk' McDonald
   -  j...@...
   -  http://twitter.com/sophistifunk
   -  http://flex.joshmcdonald.info/





[flexcoders] Re: converting a Java object into a chart dataprovider

2009-03-18 Thread netdeep

In the previous implementation, I would send an ArrayList of custom Objects 
containing two values each, variables called point1 (an Object) and point2 (a 
float).  So for each series, I'd assign this ArrayList (converted into an 
ArrayCollection by blazeDS) as the dataProvider for the series and xField = 
point1 and yField = point2.

Obviously if I had many series on the same axis, the xField data would be 
duplicated for each series (very redundant, I realize).  In the new 
implementation, I'd like to just have all the xFields point to a single array 
of dates for example and then each yfield would point to a different array.  
But since I can't create an Object in Java on the fly with variables called 
point1, point2, point3, etc, I'm at a loss as how to get flex to 
recognize where my data is when I assign the dataProvider.

I hope that makes more sense.


--- In flexcoders@yahoogroups.com, Josh McDonald j...@... wrote:

 But what will the objects be that you're sending back? You can't make a
 chart out of a list of numbers, it'd be one-dimensional, not to mention not
 very useful :)
 
 -Josh
 
 2009/3/18 netdeep deep...@...
 
 
  I'll be sending Dates, Strings, and floats.
 
 
  --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Josh
  McDonald josh@ wrote:
  
   What kind of objects are in your array?
  
   -Josh
  
   2009/3/17 netdeep deepnet@
 
  
In the flex documentation, it shows how to easily create a chart with
mxml and a static Array:
   
private var expenses:Array = [
{Month:January,Profit:2000,Expenses:1500,Amount:450},
{Month:February,Profit:1000,Expenses:200,Amount:600},
{Month:March,Profit:1500,Expenses:500,Amount:300},
];
mx:ColumnSeries
xField=Month
yField=Profit
displayName=Profit
/
mx:ColumnSeries
xField=Month
yField=Expenses
displayName=Expenses
/
   
But I am reading my data from the database and want to pass the data
  via a
java object. But I don't know the number of fields at runtime. So how
  do I
assign the xFields and yFields since I won't be able to create a
  variable
named Month or Profit? I'll just have an array of floats or dates
  or
whatever. Here's a start put I have no idea how to plug in the missing
pieces or if another route would be preferable.
   
var lineSeries:LineSeries = new LineSeries();
BindingUtils.bindProperty(lineSeries, dataProvider, ser,
  javaArray);
// lineSeries.xField= ???
// lineSeries.yField= ???
   
The data set is often quite large by the way.
   
   
   
  
  
  
   --
   Therefore, send not to know For whom the bell tolls. It tolls for thee.
  
   Josh 'G-Funk' McDonald
   - josh@
   - http://twitter.com/sophistifunk
   - http://flex.joshmcdonald.info/
  
 
   
 
 
 
 
 -- 
 Therefore, send not to know For whom the bell tolls. It tolls for thee.
 
 Josh 'G-Funk' McDonald
   -  j...@...
   -  http://twitter.com/sophistifunk
   -  http://flex.joshmcdonald.info/





Re: [flexcoders] Re: converting a Java object into a chart dataprovider

2009-03-18 Thread Wesley Acheson
Assuming Blaze or LiveCycle to create an object that is rendered as an
actionscript object with subobjects use a map.  Maps are serialised as
simple objects.

On Wed, Mar 18, 2009 at 3:47 PM, netdeep deep...@chartertn.net wrote:


 In the previous implementation, I would send an ArrayList of custom Objects
 containing two values each, variables called point1 (an Object) and point2
 (a float).  So for each series, I'd assign this ArrayList (converted into an
 ArrayCollection by blazeDS) as the dataProvider for the series and xField =
 point1 and yField = point2.

 Obviously if I had many series on the same axis, the xField data would be
 duplicated for each series (very redundant, I realize).  In the new
 implementation, I'd like to just have all the xFields point to a single
 array of dates for example and then each yfield would point to a different
 array.  But since I can't create an Object in Java on the fly with variables
 called point1, point2, point3, etc, I'm at a loss as how to get flex
 to recognize where my data is when I assign the dataProvider.

 I hope that makes more sense.


 --- In flexcoders@yahoogroups.com, Josh McDonald j...@... wrote:
 
  But what will the objects be that you're sending back? You can't make a
  chart out of a list of numbers, it'd be one-dimensional, not to mention
 not
  very useful :)
 
  -Josh
 
  2009/3/18 netdeep deep...@...
 
  
   I'll be sending Dates, Strings, and floats.
  
  
   --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Josh
   McDonald josh@ wrote:
   
What kind of objects are in your array?
   
-Josh
   
2009/3/17 netdeep deepnet@
  
   
 In the flex documentation, it shows how to easily create a chart
 with
 mxml and a static Array:

 private var expenses:Array = [
 {Month:January,Profit:2000,Expenses:1500,Amount:450},
 {Month:February,Profit:1000,Expenses:200,Amount:600},
 {Month:March,Profit:1500,Expenses:500,Amount:300},
 ];
 mx:ColumnSeries
 xField=Month
 yField=Profit
 displayName=Profit
 /
 mx:ColumnSeries
 xField=Month
 yField=Expenses
 displayName=Expenses
 /

 But I am reading my data from the database and want to pass the
 data
   via a
 java object. But I don't know the number of fields at runtime. So
 how
   do I
 assign the xFields and yFields since I won't be able to create a
   variable
 named Month or Profit? I'll just have an array of floats or
 dates
   or
 whatever. Here's a start put I have no idea how to plug in the
 missing
 pieces or if another route would be preferable.

 var lineSeries:LineSeries = new LineSeries();
 BindingUtils.bindProperty(lineSeries, dataProvider, ser,
   javaArray);
 // lineSeries.xField= ???
 // lineSeries.yField= ???

 The data set is often quite large by the way.



   
   
   
--
Therefore, send not to know For whom the bell tolls. It tolls for
 thee.
   
Josh 'G-Funk' McDonald
- josh@
- http://twitter.com/sophistifunk
- http://flex.joshmcdonald.info/
   
  
  
  
 
 
 
  --
  Therefore, send not to know For whom the bell tolls. It tolls for thee.
 
  Josh 'G-Funk' McDonald
-  j...@...
-  http://twitter.com/sophistifunk
-  http://flex.joshmcdonald.info/
 




 

 --
 Flexcoders Mailing List
 FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
 Alternative FAQ location:
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
 Search Archives:
 http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
 Links






[flexcoders] Re: converting a Java object into a chart dataprovider

2009-03-18 Thread netdeep
Thanks, that sounds like the way to go.  I'll try Maps and see if that works.


--- In flexcoders@yahoogroups.com, Wesley Acheson wesley.ache...@... wrote:

 Assuming Blaze or LiveCycle to create an object that is rendered as an
 actionscript object with subobjects use a map.  Maps are serialised as
 simple objects.
 
 On Wed, Mar 18, 2009 at 3:47 PM, netdeep deep...@... wrote:
 
 
  In the previous implementation, I would send an ArrayList of custom Objects
  containing two values each, variables called point1 (an Object) and point2
  (a float).  So for each series, I'd assign this ArrayList (converted into an
  ArrayCollection by blazeDS) as the dataProvider for the series and xField =
  point1 and yField = point2.
 
  Obviously if I had many series on the same axis, the xField data would be
  duplicated for each series (very redundant, I realize).  In the new
  implementation, I'd like to just have all the xFields point to a single
  array of dates for example and then each yfield would point to a different
  array.  But since I can't create an Object in Java on the fly with variables
  called point1, point2, point3, etc, I'm at a loss as how to get flex
  to recognize where my data is when I assign the dataProvider.
 
  I hope that makes more sense.
 
 
  --- In flexcoders@yahoogroups.com, Josh McDonald josh@ wrote:
  
   But what will the objects be that you're sending back? You can't make a
   chart out of a list of numbers, it'd be one-dimensional, not to mention
  not
   very useful :)
  
   -Josh
  
   2009/3/18 netdeep deepnet@
  
   
I'll be sending Dates, Strings, and floats.
   
   
--- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Josh
McDonald josh@ wrote:

 What kind of objects are in your array?

 -Josh

 2009/3/17 netdeep deepnet@
   

  In the flex documentation, it shows how to easily create a chart
  with
  mxml and a static Array:
 
  private var expenses:Array = [
  {Month:January,Profit:2000,Expenses:1500,Amount:450},
  {Month:February,Profit:1000,Expenses:200,Amount:600},
  {Month:March,Profit:1500,Expenses:500,Amount:300},
  ];
  mx:ColumnSeries
  xField=Month
  yField=Profit
  displayName=Profit
  /
  mx:ColumnSeries
  xField=Month
  yField=Expenses
  displayName=Expenses
  /
 
  But I am reading my data from the database and want to pass the
  data
via a
  java object. But I don't know the number of fields at runtime. So
  how
do I
  assign the xFields and yFields since I won't be able to create a
variable
  named Month or Profit? I'll just have an array of floats or
  dates
or
  whatever. Here's a start put I have no idea how to plug in the
  missing
  pieces or if another route would be preferable.
 
  var lineSeries:LineSeries = new LineSeries();
  BindingUtils.bindProperty(lineSeries, dataProvider, ser,
javaArray);
  // lineSeries.xField= ???
  // lineSeries.yField= ???
 
  The data set is often quite large by the way.
 
 
 



 --
 Therefore, send not to know For whom the bell tolls. It tolls for
  thee.

 Josh 'G-Funk' McDonald
 - josh@
 - http://twitter.com/sophistifunk
 - http://flex.joshmcdonald.info/

   
   
   
  
  
  
   --
   Therefore, send not to know For whom the bell tolls. It tolls for thee.
  
   Josh 'G-Funk' McDonald
 -  josh@
 -  http://twitter.com/sophistifunk
 -  http://flex.joshmcdonald.info/
  
 
 
 
 
  
 
  --
  Flexcoders Mailing List
  FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
  Alternative FAQ location:
  https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
  Search Archives:
  http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
  Links
 
 
 
 





Re: [flexcoders] Re: converting a Java object into a chart dataprovider

2009-03-18 Thread Josh McDonald
The last poster beat me to it, but yes, the answer is an array of Maps in
Java, should come through as a simple assosciative object in ActionScript.

-Josh

2009/3/19 netdeep deep...@chartertn.net

   Thanks, that sounds like the way to go. I'll try Maps and see if that
 works.


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Wesley
 Acheson wesley.ache...@... wrote:
 
  Assuming Blaze or LiveCycle to create an object that is rendered as an
  actionscript object with subobjects use a map. Maps are serialised as
  simple objects.
 
  On Wed, Mar 18, 2009 at 3:47 PM, netdeep deep...@... wrote:
 
  
   In the previous implementation, I would send an ArrayList of custom
 Objects
   containing two values each, variables called point1 (an Object) and
 point2
   (a float). So for each series, I'd assign this ArrayList (converted
 into an
   ArrayCollection by blazeDS) as the dataProvider for the series and
 xField =
   point1 and yField = point2.
  
   Obviously if I had many series on the same axis, the xField data would
 be
   duplicated for each series (very redundant, I realize). In the new
   implementation, I'd like to just have all the xFields point to a single
   array of dates for example and then each yfield would point to a
 different
   array. But since I can't create an Object in Java on the fly with
 variables
   called point1, point2, point3, etc, I'm at a loss as how to get
 flex
   to recognize where my data is when I assign the dataProvider.
  
   I hope that makes more sense.
  
  
   --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Josh
 McDonald josh@ wrote:
   
But what will the objects be that you're sending back? You can't make
 a
chart out of a list of numbers, it'd be one-dimensional, not to
 mention
   not
very useful :)
   
-Josh
   
2009/3/18 netdeep deepnet@
   

 I'll be sending Dates, Strings, and floats.


 --- In flexcoders@yahoogroups.com 
 flexcoders%40yahoogroups.comflexcoders%
 40yahoogroups.com, Josh
 McDonald josh@ wrote:
 
  What kind of objects are in your array?
 
  -Josh
 
  2009/3/17 netdeep deepnet@

 
   In the flex documentation, it shows how to easily create a
 chart
   with
   mxml and a static Array:
  
   private var expenses:Array = [
   {Month:January,Profit:2000,Expenses:1500,Amount:450},
   {Month:February,Profit:1000,Expenses:200,Amount:600},
   {Month:March,Profit:1500,Expenses:500,Amount:300},
   ];
   mx:ColumnSeries
   xField=Month
   yField=Profit
   displayName=Profit
   /
   mx:ColumnSeries
   xField=Month
   yField=Expenses
   displayName=Expenses
   /
  
   But I am reading my data from the database and want to pass the
   data
 via a
   java object. But I don't know the number of fields at runtime.
 So
   how
 do I
   assign the xFields and yFields since I won't be able to create
 a
 variable
   named Month or Profit? I'll just have an array of floats or
   dates
 or
   whatever. Here's a start put I have no idea how to plug in the
   missing
   pieces or if another route would be preferable.
  
   var lineSeries:LineSeries = new LineSeries();
   BindingUtils.bindProperty(lineSeries, dataProvider, ser,
 javaArray);
   // lineSeries.xField= ???
   // lineSeries.yField= ???
  
   The data set is often quite large by the way.
  
  
  
 
 
 
  --
  Therefore, send not to know For whom the bell tolls. It tolls
 for
   thee.
 
  Josh 'G-Funk' McDonald
  - josh@
  - http://twitter.com/sophistifunk
  - http://flex.joshmcdonald.info/
 



   
   
   
--
Therefore, send not to know For whom the bell tolls. It tolls for
 thee.
   
Josh 'G-Funk' McDonald
- josh@
- http://twitter.com/sophistifunk
- http://flex.joshmcdonald.info/
   
  
  
  
  
   
  
   --
   Flexcoders Mailing List
   FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
   Alternative FAQ location:
  
 https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
   Search Archives:
   http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
   Links
  
  
  
  
 

  




-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

Josh 'G-Funk' McDonald
  -  j...@joshmcdonald.info
  -  http://twitter.com/sophistifunk
  -  http://flex.joshmcdonald.info/


[flexcoders] Re: converting a Java object into a chart dataprovider

2009-03-17 Thread netdeep

I'll be sending Dates, Strings, and floats.


--- In flexcoders@yahoogroups.com, Josh McDonald j...@... wrote:

 What kind of objects are in your array?
 
 -Josh
 
 2009/3/17 netdeep deep...@...
 
In the flex documentation, it shows how to easily create a chart with
  mxml and a static Array:
 
  private var expenses:Array = [
  {Month:January,Profit:2000,Expenses:1500,Amount:450},
  {Month:February,Profit:1000,Expenses:200,Amount:600},
  {Month:March,Profit:1500,Expenses:500,Amount:300},
  ];
  mx:ColumnSeries
  xField=Month
  yField=Profit
  displayName=Profit
  /
  mx:ColumnSeries
  xField=Month
  yField=Expenses
  displayName=Expenses
  /
 
  But I am reading my data from the database and want to pass the data via a
  java object. But I don't know the number of fields at runtime. So how do I
  assign the xFields and yFields since I won't be able to create a variable
  named Month or Profit? I'll just have an array of floats or dates or
  whatever. Here's a start put I have no idea how to plug in the missing
  pieces or if another route would be preferable.
 
  var lineSeries:LineSeries = new LineSeries();
  BindingUtils.bindProperty(lineSeries, dataProvider, ser, javaArray);
  // lineSeries.xField= ???
  // lineSeries.yField= ???
 
  The data set is often quite large by the way.
 
   
 
 
 
 
 -- 
 Therefore, send not to know For whom the bell tolls. It tolls for thee.
 
 Josh 'G-Funk' McDonald
   -  j...@...
   -  http://twitter.com/sophistifunk
   -  http://flex.joshmcdonald.info/





Re: [flexcoders] Re: converting a Java object into a chart dataprovider

2009-03-17 Thread Josh McDonald
But what will the objects be that you're sending back? You can't make a
chart out of a list of numbers, it'd be one-dimensional, not to mention not
very useful :)

-Josh

2009/3/18 netdeep deep...@chartertn.net


 I'll be sending Dates, Strings, and floats.


 --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Josh
 McDonald j...@... wrote:
 
  What kind of objects are in your array?
 
  -Josh
 
  2009/3/17 netdeep deep...@...

 
   In the flex documentation, it shows how to easily create a chart with
   mxml and a static Array:
  
   private var expenses:Array = [
   {Month:January,Profit:2000,Expenses:1500,Amount:450},
   {Month:February,Profit:1000,Expenses:200,Amount:600},
   {Month:March,Profit:1500,Expenses:500,Amount:300},
   ];
   mx:ColumnSeries
   xField=Month
   yField=Profit
   displayName=Profit
   /
   mx:ColumnSeries
   xField=Month
   yField=Expenses
   displayName=Expenses
   /
  
   But I am reading my data from the database and want to pass the data
 via a
   java object. But I don't know the number of fields at runtime. So how
 do I
   assign the xFields and yFields since I won't be able to create a
 variable
   named Month or Profit? I'll just have an array of floats or dates
 or
   whatever. Here's a start put I have no idea how to plug in the missing
   pieces or if another route would be preferable.
  
   var lineSeries:LineSeries = new LineSeries();
   BindingUtils.bindProperty(lineSeries, dataProvider, ser,
 javaArray);
   // lineSeries.xField= ???
   // lineSeries.yField= ???
  
   The data set is often quite large by the way.
  
  
  
 
 
 
  --
  Therefore, send not to know For whom the bell tolls. It tolls for thee.
 
  Josh 'G-Funk' McDonald
  - j...@...
  - http://twitter.com/sophistifunk
  - http://flex.joshmcdonald.info/
 

  




-- 
Therefore, send not to know For whom the bell tolls. It tolls for thee.

Josh 'G-Funk' McDonald
  -  j...@joshmcdonald.info
  -  http://twitter.com/sophistifunk
  -  http://flex.joshmcdonald.info/