Select to view content in your preferred language

summary statistics chart and datagrid - multiple points instead of polygon?

1099
10
12-28-2010 08:16 AM
TracySchloss
Honored Contributor
I have modified an example from the user forum (version 1.3 of FLEX) that will let the user draw a polygon and get summary statistics and a chart based on their selection.  This works just fine when you have contiguous polygons.  However, what if I wanted to compare 3 or counties that are not next to each other?  I thought I might be able to modify this to add points (or multipoints).  I would then need to have something different as a trigger to know when the user was done adding points (unlike polygon that has a draw end built into it).

If I have multiple points, then I'm assuming I would need to loop through each of my points I'd drawn.  I can't decide whether I am better off using an identify task instead of the query task I have set for the drawn polygon. 

This code works now with just polygons for anyone who wants to have another basic charting/datagrid/summary example.
Tags (2)
0 Kudos
10 Replies
RobertScheitlin__GISP
MVP Emeritus
Tracy,

   Are you still using Flex Builder 3 and some 1.x version of the Flex API? I don't normally develop for those any more, so I didn't want to waste time updating the code to Flash Builder 4 and the 2.2 Flex API if you don't have access to those.
0 Kudos
TracySchloss
Honored Contributor
Yes, I'm still using the older versions.  I don't dare download the evaluation copy of Flash Builder until I know the purchase has at least been approved.  Right now it's a painful and slow process to buy anything.

After messing with my code a bit more, I did have better luck using an Identify task for each of the points and then accumulating those results into an array to populate datagrid and chart.  It's still really sloppy programming, but it is somewhat functional.  I don't know what it is about posting something to the forum that often jogs something in my own mind.

If you don't want to mess with the older code, I understand.  I'm sure I will have lots more questions once I finally do make the switch!

One thing you might be able to answer for me.  I haven't used identifytask much, I've generally used querytask.  The identify task seems to take a little longer and so some of the time I've clicked and the previous task hadn't quite complete (so it basically skipped over it).

In the reference, it says you can set the concurrency on it, but if you set it to multiple you have to manage the event stream yourself.  I was wondering what the code would look like for such a thing.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Tracy,

  I personally don't think the identify task is the way to go. Here is the code you provided fixed and cleaned up with the new ability to use multipoints working. I did use the Flex 1.3 API instead of 1.2.
0 Kudos
TracySchloss
Honored Contributor
Thanks so much!  My FLEX 4 books came in today, so hopefully I'll be upgraded soon.:cool:
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Tracy,

   GOOD NEWS. When you do switch over let me know because I did migrate the same code I just provided you over to FlashBuilder 4 and Flex AGS API 2.2 already.
0 Kudos
TracySchloss
Honored Contributor
I'll leave myself a note.  Who knows when my Flash will finally get here.  How are you managing to develop in both versions?  I assumed I couldn't have both installed.  Is 4 so backwardly compatible that you can use old code and the older API?  I assumed like many upgrades that there was no turning back.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Tracy,

    Nope you can have FlashBuilder4 and FlexBuilder3 on the same machine.

P.s.   I forgot that on the chart mouse out I needed to close the info window so here is that code.

private function onChartItemRollOut( event : ChartItemEvent ) : void
   {
    findGraphicByAttribute(event.hitSet[0].item).symbol = pointSymbol;
    mainMap.infoWindow.hide();
   }
0 Kudos
R__CraigHolmes
Emerging Contributor
Greetings Robert,
I would be interested in your charting code for Flashbuilder 4 , 2.2 API.  I am currently running 2.1 so I may need to upgrade.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Craig,

   The code here is what Tracy modified for her use that someone else wrote, and I just ported to Flex API 2.2 (all that to say this is not my code, just ported by me).

Anyway here it is.
0 Kudos