[flexcoders] Displaying 'No Data Found' message

2007-03-20 Thread Mehul Doshi
Is there a quick way to simply display a 'No Data Found' label on a 
chart?

Thanks.



[flexcoders] Re: ArrayCollection length

2007-02-28 Thread Mehul Doshi
Hey,

This actually doesn't work. Your logic seems to simply count the 
number of elements in the arraycollection. I'm trynig to figure out 
the number of items in the first element of the collection.

Thanks.

--- In flexcoders@yahoogroups.com, iilsley [EMAIL PROTECTED] wrote:

 --- In flexcoders@yahoogroups.com, Mehul Doshi Mehul.Doshi@ 
wrote:
 
  
  If I have my dataprovider in the following manner:
  
  var dataProvider = [{Date: 02-12-2007, Company1: 20, Company2: 
30},
  {Date: 02-09-2007, Company1: 20, Company2: 30},
  {Date: 02-08-2007, Company1: 20, Company2: 30}]
  
  How can I determine programatically:
  
  1. The number of companies.
 I dont't seem to be able to figure out how to find the number 
of 
  items in a particular element of the ArrayCollection.
 
 
 Hi , 
 
 I'm a newbie to Flex2 so there is probably a better way todo this 
but 
 for now this seems to work .. :) .. 
 
 -
 public var con:ArrayCollection = 
   new ArrayCollection([{name: 'Matt', last: 'Matthews'}
   ,{first: 'Matt', last: 'Smith'}
   ,{first: 'Albert', last: 'Jones'}]
   );
 
 public function howManyFirstelements():void
 {
   var fst:int =0;
   for ( x=0 ; x  con.length ; x++ ) 
   {
 if ( con[x].hasOwnProperty(first) == true) 
 {
 fst++;
 }
   }
 Alert.show(There are +fst+ first elements );
  }
 





[flexcoders] Re: Programatically creating LineSeries

2007-02-27 Thread Mehul Doshi

Thanks Tariq. I've looked at that example earlier but it doesn't 
quite work properly to do what I'm trying. The example uses an 
already known ArrayCollection and thus the yField of the different 
series can be set very easily.

In my case, I'm getting an XML and then I'm not sure how to set up 
my yField/xField. Do I need to parse the XML and create an 
ArrayCollection first, or is there a simpler approach? Below is what 
I have done, but the series does not show up.

In my mxml, I have:

[Bindable]
public var _elements:XMLList; 

public function createXMLList(data:String):XMLList
{
var _xml:XML = new XML(data);
_elements = _xml.elements();
return _elements;
}

mx:Panel width=450 height=400 id=panel 
mx:LineChart id=chart height=350 width=300
paddingLeft=5 paddingRight=5 
showDataTips=true visible=false 
dataProvider={_elements}
mx:horizontalAxis
mx:CategoryAxis dataProvider=[EMAIL PROTECTED] /
/mx:horizontalAxis
/mx:LineChart
/mx:Panel

In my html file, I use the XMLHttpRequest to get my xml and do the 
following:

function createChart() { 
if (req.readystate == 4  req.status == 200) { 
var seriesArray = new Array();
var flexApp = FABridge.example.root();
var chart = flexApp.getPanel().getChildByName(chart); 
var s = FABridge.example.create(mx.charts.series.LineSeries); 
flexApp.createXMLList(req.responseText);
s.set(yField, datapoint);
seriesArray.push(s);
chart.setSeries(seriesArray);
chart.setVisible(true);
}
}

My XML file has the following structure:

?xml version=1.0 encoding=utf-8?
result metricDfn=Price
company1 id=1
datapoint date=Jan50/datapoint
datapoint date=Feb60/datapoint
datapoint date=Mar40/datapoint
datapoint date=Apr50/datapoint
datapoint date=May40/datapoint
/company1
/result

Anything obvious that I'm not doing right?

Thanks,
Mehul.


Re: [flexcoders] Re: Programatically creating LineSeries 


1) If you're able to get the XML in a way that you're comfortable, 
I would say don't worry about it. Data Services will be worth 
looking into down the line if you're doing a lot of transactions or 
a lot of data. 

2) Here's an example of how to dynamically create series to a chart:
http://www.cflex.net/showFileDetails.cfm?
ObjectID=489Object=FileChannelID=1


Mehul Doshi wrote: 
Could someone please look at my post below and provide me some help?

Thanks.
--- In flexcoders@yahoogroups.com, Mehul Doshi [EMAIL PROTECTED] 
wrote:

 Hi,
 
 I have a few questions on how I should go about achieving 
something 
 using Flex Charting.
 
 I have a Java servlet/controller that will return XML data. The 
data 
 will consist of multiple datapoints for multiple companies. Let's 
 assume that the xml follows the below structure:
 
 company1 name=ABC
 datapoint date=Jan50/datapoint
 datapoint date=Feb70/datapoint
 /company1
 company2 name=DEF
 datapoint date=Jan70/datapoint
 datapoint date=Feb50/datapoint
 /company2
 
 Using this XML, I need to programatically (using 
 Javascript/Actionscript) create a chart with multiple LineSeries 
and 
 set the dataprovider for each. 
 
 My questions are:
 
 1. How do I obtain the XML data? I'm currently using 
XMLHttpRequest 
 to get it...any better approach? Do I need to use the DataServices 
 feature of Flex?
 2. Using my current approach, I'm not sure how I can set the 
 dataprovider (and xfield,yfield) for each LineSeries (each 
company)?
 
 Thanks,
 Mehul.






[flexcoders] ArrayCollection length

2007-02-27 Thread Mehul Doshi

If I have my dataprovider in the following manner:

var dataProvider = [{Date: 02-12-2007, Company1: 20, Company2: 30},
{Date: 02-09-2007, Company1: 20, Company2: 30},
{Date: 02-08-2007, Company1: 20, Company2: 30}]

How can I determine programatically:

1. The number of companies.
   I dont't seem to be able to figure out how to find the number of 
items in a particular element of the ArrayCollection.

2. Is there a way to structure the dataProvider so that I can also 
include the company names. Thus, I can use those names for my legend.

Thanks.
 




[flexcoders] Re: Quadrant chart

2007-02-26 Thread Mehul Doshi

Yeah, it is quite nice and not complex as I first thought. At least, 
creating those lines is very straight-forward.

--- In flexcoders@yahoogroups.com, Mehul Doshi [EMAIL PROTECTED] 
wrote:

 
 ok...i'll look at it a little more patiently and get back to you 
if 
 i get stuck.
 
 i realize what u've built is quite extensible and powerful...so 
 thanks. I just hope I don't end up spending more time trying to 
 figure it out than I should.
 
 Mehul.
 --- In flexcoders@yahoogroups.com, Ely Greenfield egreenfi@ 
 wrote:
 
   
   
   
  
  For both. It's really not very complex...just a moveTo, 
 lineTo,
  and you're done. This is the easiest way to draw a line at a 
 specific
  location.
   
  Ely.
   
  
  
  
  
  From: flexcoders@yahoogroups.com 
 [mailto:[EMAIL PROTECTED] On
  Behalf Of Mehul Doshi
  Sent: Friday, February 23, 2007 11:39 AM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] Re: Quadrant chart
  
  
  
  Yeah, I've looked at it, but it seems a bit complex (for a 
 beginner) 
  to do something as simple as creating a single vertical or 
  horizontal line for a specified value. Can that not be done 
using 
  just a single horizontal and vertical gridline?
  
  Or, did you refer me to your custom charts example for the label 
  annotations on the chart?
  
  Thanks,
  Mehul.
  
  --- In flexcoders@yahoogroups.com mailto:flexcoders%
 40yahoogroups.com
  , Ely Greenfield egreenfi@ 
  wrote:
  
   
   
   See my post:
   
   http://www.quietlyscheming.com/blog/charts/easy-custom-charts/
  http://www.quietlyscheming.com/blog/charts/easy-custom-charts/ 
   
   Ely.
   
   
   
   
   
   
   From: flexcoders@yahoogroups.com mailto:flexcoders%
 40yahoogroups.com
  
  [mailto:flexcoders@yahoogroups.com mailto:flexcoders%
 40yahoogroups.com
  ] On
   Behalf Of Mehul Doshi
   Sent: Friday, February 23, 2007 11:11 AM
   To: flexcoders@yahoogroups.com mailto:flexcoders%
 40yahoogroups.com 
   Subject: [flexcoders] Quadrant chart
   
   
   
   Hi,
   
   I'm trying to develop a chart that looks similar to the 
 following:
   
   
  
 
http://www.adaptivepath.com/images/publications/essays/prioritization
  
 
http://www.adaptivepath.com/images/publications/essays/prioritizatio
 n 
   
  
 
http://www.adaptivepath.com/images/publications/essays/prioritizatio
  
 
http://www.adaptivepath.com/images/publications/essays/prioritizatio
  
  n 
   _chart.gif
   
   Essentially, have a set of 'A' values and a set of 'B' values, 
  then 
   calculate the average of 'A' values and show that as a 
vertical 
   line, calculate the average of 'B' values and show that as a 
   horizontal line, and then display each combination of [A,B] 
 value 
  as 
   a point on the chart. I've looked at a couple of other posts 
on 
  this 
   forum to see how I can use the gridline to create the average 
   horizontal and vertical lines...but haven't been able to 
really 
 do 
   it. Can someone please post a really small example of how I 
can 
  plot 
   those lines?
   
   Also, (and this is optional) how can I place those label 
  annotations 
   on the chart at specific data points?
   
   Thanks,
   Mehul.
  
 





[flexcoders] Re: Programatically creating LineSeries

2007-02-26 Thread Mehul Doshi
Could someone please look at my post below and provide me some help?

Thanks.
--- In flexcoders@yahoogroups.com, Mehul Doshi [EMAIL PROTECTED] 
wrote:

 Hi,
 
 I have a few questions on how I should go about achieving 
something 
 using Flex Charting.
 
 I have a Java servlet/controller that will return XML data. The 
data 
 will consist of multiple datapoints for multiple companies. Let's 
 assume that the xml follows the below structure:
 
 company1 name=ABC
datapoint date=Jan50/datapoint
datapoint date=Feb70/datapoint
 /company1
 company2 name=DEF
datapoint date=Jan70/datapoint
datapoint date=Feb50/datapoint
 /company2
 
 Using this XML, I need to programatically (using 
 Javascript/Actionscript) create a chart with multiple LineSeries 
and 
 set the dataprovider for each. 
 
 My questions are:
 
 1. How do I obtain the XML data? I'm currently using 
XMLHttpRequest 
 to get it...any better approach? Do I need to use the DataServices 
 feature of Flex?
 2. Using my current approach, I'm not sure how I can set the 
 dataprovider (and xfield,yfield) for each LineSeries (each 
company)?
 
 Thanks,
 Mehul.





[flexcoders] Re: Accessing a Flex Model via JavaScript (FABridge)

2007-02-26 Thread Mehul Doshi
Ralf,

I'm following your approach, but am not getting the chart to 
display...most likely because I'm not creating my series properly.

In my mxml, I have:

[Bindable]
public var _elements:XMLList;  

public function createXMLList(data:String):XMLList
{
var _xml:XML = new XML(data);
_elements = _xml.elements();
return _elements;
}

mx:Panel width=450 height=400 id=panel 
mx:LineChart id=chart height=350 width=300
paddingLeft=5 paddingRight=5 
showDataTips=true visible=false   
dataProvider={_elements}
/mx:LineChart
/mx:Panel

In my html file, I use the XMLHttpRequest to get my xml and do the 
following:

function createChart() {  
if (req.readystate == 4  req.status == 200) { 
var seriesArray = new Array();
var date;
var flexApp = FABridge.example.root();
var chart = flexApp.getPanel().getChildByName
(chart); 
var s = FABridge.example.create
(mx.charts.series.LineSeries); 
flexApp.createXMLList(req.responseText);
s.set(yField, datapoint);
seriesArray.push(s);
chart.setSeries(seriesArray);
chart.setVisible(true);
 }
}

My XML file has the following structure:

?xml version=1.0 encoding=utf-8?
result metricDfn=Price
company1 id=1
datapoint date=Jan50/datapoint
datapoint date=Feb60/datapoint
datapoint date=Mar40/datapoint
datapoint date=Apr50/datapoint
datapoint date=May40/datapoint
/company1
/result

Anything obvious that I'm not doing right?

Thanks,
Mehul.




--- In flexcoders@yahoogroups.com, Ely Greenfield [EMAIL PROTECTED] 
wrote:

  
  
 Mehul -- the problem you're running into is that 'source' is a 
special
 compile time property of XML and Model. It's essentially like an
 'include' statement. So it can't be set at runtime.
  
 Romeo (Private Romeo) -- your approach is fine, and more or less 
what I
 would reccomend.
  
 Ely.
  
  
 
 
 
 
 From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
 Behalf Of Private Romeo
 Sent: Wednesday, February 21, 2007 3:50 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] RE: Accessing a Flex Model via JavaScript
 (FABridge)
 
 
 
 Mehul,
 
 You actually posted to me personally and not back to the list! So I
 reposted...
 
 -Original Message-
 From: Private Romeo [mailto:[EMAIL PROTECTED]
 mailto:freenet%40rottmann.net ] 
 Sent: Donnerstag, 22. Februar 2007 00:37
 To: Mehul Doshi
 Subject: RE: Accessing a Flex Model via JavaScript (FABridge)
 
 Mehul,
 
 It's actually not that straight forward. FABridge relies on
 introspection.
 It identifies the types used in a Flex application and makes them
 available
 to Java. As a Model could be any complex temp depending solely on 
the
 way
 you structure its data, FABridge cannot expose a simple API to
 manipulate
 data provided in an mx:Model (tag).
 
 Let me state that I am pretty new to this, too, and all I am 
saying here
 is
 in the state of as far as I have understood it so far. I am not 
one of
 the
 all-time-Flex-gurus (however I am striving to become one some 
day :-) ).
 
 Basically what I wanted to achieve is to hand over a chunk of data 
from
 within JavaScript to a Flex app in order for the Flex app to bind 
it to
 a
 ColumnChart.
 
 My solution - and again, this might not be the right way of 
doing it -
 involves the following steps:
 
 1. Created a private var _elements of type XMLList in my MXML app:
 
 [Bindable]
 private var _elements:XMLList;
 
 and bound that to the ColumnChart as the dataProvider:
 
 mx:ColumnChart x=10 y=61 id=columnChart1
 dataProvider={_elements} showDataTips=true
 
 2. Implemented a public changeData() method which accepts a string 
and
 converts it into an XML document. In the second step it creates the
 XMLList
 by using the elements() method of the XML instance.
 
 public function updateData(data:String):void
 {
 var _xml:XML = new XML(data);
 _elements = _xml.elements();
 }
 
 This is the method which will be called from within the JavaScript
 through
 FABridge.
 
 3. In the HTML page I have created a JavaScript method (which 
could be
 invoked by a HTML button e.g.) which loads new data to the chart:
 
 function updateData(sampleSet)
 {
 switch (sampleSet)
 {
 case 1:
 var sampleData = 
 items+
 
 itemMonthJan/MonthSales100/SalesPeople50/People/ite
m+
 
 itemMonthFeb/MonthSales200/SalesPeople100/People/it
em+
 
 itemMonthMar/MonthSales300/SalesPeople150/People/it
em+
 /items;
 break;
 case 2:
 var sampleData = 
 items+
 
 itemMonthJan/MonthSales200/SalesPeople100/People/it
em+
 
 itemMonthFeb/MonthSales300/SalesPeople150/People/it
em+
 
 itemMonthMar/MonthSales100/SalesPeople50/People/ite
m+
 /items;
 break; 
 }
 alert(JavaScript is going to pass the following data

[flexcoders] Programatically creating LineSeries

2007-02-25 Thread Mehul Doshi
Hi,

I have a few questions on how I should go about achieving something 
using Flex Charting.

I have a Java servlet/controller that will return XML data. The data 
will consist of multiple datapoints for multiple companies. Let's 
assume that the xml follows the below structure:

company1 name=ABC
   datapoint date=Jan50/datapoint
   datapoint date=Feb70/datapoint
/company1
company2 name=DEF
   datapoint date=Jan70/datapoint
   datapoint date=Feb50/datapoint
/company2

Using this XML, I need to programatically (using 
Javascript/Actionscript) create a chart with multiple LineSeries and 
set the dataprovider for each. 

My questions are:

1. How do I obtain the XML data? I'm currently using XMLHttpRequest 
to get it...any better approach? Do I need to use the DataServices 
feature of Flex?
2. Using my current approach, I'm not sure how I can set the 
dataprovider (and xfield,yfield) for each LineSeries (each company)?

Thanks,
Mehul.





[flexcoders] Quadrant chart

2007-02-23 Thread Mehul Doshi
Hi,

I'm trying to develop a chart that looks similar to the following:

http://www.adaptivepath.com/images/publications/essays/prioritization
_chart.gif

Essentially, have a set of 'A' values and a set of 'B' values, then 
calculate the average of 'A' values and show that as a vertical 
line, calculate the average of 'B' values and show that as a 
horizontal line, and then display each combination of [A,B] value as 
a point on the chart. I've looked at a couple of other posts on this 
forum to see how I can use the gridline to create the average 
horizontal and vertical lines...but haven't been able to really do 
it. Can someone please post a really small example of how I can plot 
those lines?

Also, (and this is optional) how can I place those label annotations 
on the chart at specific data points?

Thanks,
Mehul.



[flexcoders] Re: Quadrant chart

2007-02-23 Thread Mehul Doshi
Yeah, I've looked at it, but it seems a bit complex (for a beginner) 
to do something as simple as creating a single vertical or 
horizontal line for a specified value. Can that not be done using 
just a single horizontal and vertical gridline?

Or, did you refer me to your custom charts example for the label 
annotations on the chart?

Thanks,
Mehul.

--- In flexcoders@yahoogroups.com, Ely Greenfield [EMAIL PROTECTED] 
wrote:

  
  
 See my post:
  
 http://www.quietlyscheming.com/blog/charts/easy-custom-charts/
  
 Ely.
  
  
  
 
 
 
 From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
 Behalf Of Mehul Doshi
 Sent: Friday, February 23, 2007 11:11 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Quadrant chart
 
 
 
 Hi,
 
 I'm trying to develop a chart that looks similar to the following:
 
 
http://www.adaptivepath.com/images/publications/essays/prioritization
 
http://www.adaptivepath.com/images/publications/essays/prioritizatio
n 
 _chart.gif
 
 Essentially, have a set of 'A' values and a set of 'B' values, 
then 
 calculate the average of 'A' values and show that as a vertical 
 line, calculate the average of 'B' values and show that as a 
 horizontal line, and then display each combination of [A,B] value 
as 
 a point on the chart. I've looked at a couple of other posts on 
this 
 forum to see how I can use the gridline to create the average 
 horizontal and vertical lines...but haven't been able to really do 
 it. Can someone please post a really small example of how I can 
plot 
 those lines?
 
 Also, (and this is optional) how can I place those label 
annotations 
 on the chart at specific data points?
 
 Thanks,
 Mehul.





[flexcoders] Re: Quadrant chart

2007-02-23 Thread Mehul Doshi

ok...i'll look at it a little more patiently and get back to you if 
i get stuck.

i realize what u've built is quite extensible and powerful...so 
thanks. I just hope I don't end up spending more time trying to 
figure it out than I should.

Mehul.
--- In flexcoders@yahoogroups.com, Ely Greenfield [EMAIL PROTECTED] 
wrote:

  
  
  
 
   For both. It's really not very complex...just a moveTo, 
lineTo,
 and you're done. This is the easiest way to draw a line at a 
specific
 location.

   Ely.

 
 
 
 
 From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
 Behalf Of Mehul Doshi
 Sent: Friday, February 23, 2007 11:39 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: Quadrant chart
 
 
 
 Yeah, I've looked at it, but it seems a bit complex (for a 
beginner) 
 to do something as simple as creating a single vertical or 
 horizontal line for a specified value. Can that not be done using 
 just a single horizontal and vertical gridline?
 
 Or, did you refer me to your custom charts example for the label 
 annotations on the chart?
 
 Thanks,
 Mehul.
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 , Ely Greenfield egreenfi@ 
 wrote:
 
  
  
  See my post:
  
  http://www.quietlyscheming.com/blog/charts/easy-custom-charts/
 http://www.quietlyscheming.com/blog/charts/easy-custom-charts/ 
  
  Ely.
  
  
  
  
  
  
  From: flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 
 [mailto:flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com
 ] On
  Behalf Of Mehul Doshi
  Sent: Friday, February 23, 2007 11:11 AM
  To: flexcoders@yahoogroups.com mailto:flexcoders%
40yahoogroups.com 
  Subject: [flexcoders] Quadrant chart
  
  
  
  Hi,
  
  I'm trying to develop a chart that looks similar to the 
following:
  
  
 
http://www.adaptivepath.com/images/publications/essays/prioritization
 
http://www.adaptivepath.com/images/publications/essays/prioritizatio
n 
  
 
http://www.adaptivepath.com/images/publications/essays/prioritizatio
 
http://www.adaptivepath.com/images/publications/essays/prioritizatio
 
 n 
  _chart.gif
  
  Essentially, have a set of 'A' values and a set of 'B' values, 
 then 
  calculate the average of 'A' values and show that as a vertical 
  line, calculate the average of 'B' values and show that as a 
  horizontal line, and then display each combination of [A,B] 
value 
 as 
  a point on the chart. I've looked at a couple of other posts on 
 this 
  forum to see how I can use the gridline to create the average 
  horizontal and vertical lines...but haven't been able to really 
do 
  it. Can someone please post a really small example of how I can 
 plot 
  those lines?
  
  Also, (and this is optional) how can I place those label 
 annotations 
  on the chart at specific data points?
  
  Thanks,
  Mehul.
 





[flexcoders] Chart DataProvider ArrayCollection

2007-02-22 Thread Mehul Doshi



When I set my chart's data provider using the following approach, it
seems to work fine.

var col = FABridge.example.create(mx.collections.ArrayCollection);
var a1 = {date:Jan, company1:152, company2:112, company3:122,
company4:132, company5:142};
var a2 = {date:Feb, company1:100, company2:54,company3:380,
company4:45, company5:12};
var a3 = {date:Mar, company1:12, company2:22,company3:12, company4:32,
company5:42};
var a4 = {date:Apr, company1:52, company2:12,company3:12, company4:12,
company5:42};
var a5 = {date:May, company1:57, company2:66,company3:32, company4:82,
company5:49};


col.addItem(a1);
col.addItem(a2);
col.addItem(a3);
col.addItem(a4);
col.addItem(a5);

chart.setSeries...

chart.setDataProvider(col);



But, if I use the following approach, the chart does not show up. My
y-axis actually adjusts properly implying that the data is being fed
into the chart, but the series themselves don't show up. Any idea why?



var coll = FABridge.example.create(mx.collections.ArrayCollection);
for (var i = 0; i  5; i++) {
 var dataArray = FABridge.example.create(Array);

for (var j = 0; j  6; j++) {
 //From an external XML source, I obtain elemName
and elemValue
 dataArray.push(elemName + : + elemValue);
}
coll.addItem(dataArray);
}

chart.setSeries...

chart.setDataProvider(coll);