0 Replies Latest reply on Jul 12, 2006 11:51 AM by KYAHN

    Charting in Flex with drill down & complex XML

    KYAHN
      Hey guys, ok, whoever has the time and the patience to help me, I will really appreciate it!

      My name is Guillermo Vaccarezza, and I’ve purchased Flex 2 recently to use it for a project I’m developing in my Studio in Argentina. This mail is to make you a consulting on some doubts I have on Flex. Hopefully you will be able to clarify my doubts or at least tell me a good place where to find nice charting tutorials for newbies, specially on the drill down capabilities flex offers and XML data filtering:


      The application I’m working on is a statistics graphs dashboard for hospital use. Summing it up, hospital will use this application to upload data about their ORooms, amount of procedures done by day, doctor who performed the procedure, time taken for each one and so on. All this data is compiled into a PHP based database that then delivers a BIG XML to process in Flex and show, for example, a volume over time bar chart, in which you should be able to drill down in a particular month and then see another graph showing the volume over procedure axis but with the doctors on the X axis.


      There will be many reports, each one with their own peculiarities, but following a similar logic. Also, and most importantly, there will be a filtering tool before visualizing the graphs: a tab-based box where to chose which ORs you want to see, or what doctors, of by what specialy, etc. Once you make your selections, you click an UPDATE button and you visualize your chosen report with the filter applied to it, then you drill into the data as I explained before.


      I’m new to flex, and even thought it seems to be a pretty straightforward tool. And I’m intermediate flash 8 user (my site is idstudio) , I’m still having problem on HOW to access my XML file and take what I want from it (depending on the applied filters), then render only those XML nodes on the graph.


      Let’s go to the first question, this concerns the drill-down capability for my chart:

      For instance, let’s say I have the following XML:
      ------

      <data>
      <month name="Enero" hidden_name="200601" vol="200">
      <procedure name="proc1" vol="50">
      <doctor name="Perez" vol="10" />
      <doctor name="Rodriguez" vol="5" />
      <doctor name="Gonzalez" vol="3" />
      <doctor name="Martinez" vol="1" />
      </procedure>
      <procedure name="proc2" vol="125">
      <doctor name="Perez" vol="4" />
      <doctor name="Gonzalez" vol="5" />
      <doctor name="Martinez" vol="12" />
      </procedure>
      <procedure name="proc3" vol="35">
      <doctor name="Perez" vol="4" />
      <doctor name="Gonzalez" vol="5" />
      <doctor name="Martinez" vol="12" />
      </procedure>
      </month>
      <month name="Febrero" hidden_name="200602" vol="175">
      <procedure name="proc1" >
      <doctor name="Perez" vol="10" />
      <doctor name="Rodriguez" vol="5" />
      <doctor name="Gonzalez" vol="3" />
      <doctor name="Martinez" vol="1" />
      </procedure>
      <procedure name="proc2" >
      <doctor name="Perez" vol="4" />
      <doctor name="Gonzalez" vol="5" />
      <doctor name="Martinez" vol="12" />
      </procedure>
      </month>
      </data>
      -----

      Now, on the first bar chart, I want to show volume over time per month. That I could do pretty easily seeing some examples on the web.

      Now it comes the second graph, which is a drill down on the first: I want to click one month, and then see all the volumes per procedure for that month. On the paper, this seems easy; however, I just can’t find a good tutorial on how to bind data and what actionscript code I should need to use to go from graph 1 to 2 using my XML structure. The help on flex documentation doesn’t give any practical example of data drill down for charts... :(


      The second question is about the filtering tool I want to have the users click on before displaying the graphs

      Let’s take a look at the XML: I want to only see the first procedure on the first month and only 2 of the 4 doctors for that procedure, for instance. Also, suppose that the user clicks on procedure 1, but then clicks on a doctor that doesn’t belong to that procedure, so the data retrieval is not applicable, so I should show a warning or a red flag telling the user that his request is not applicable….

      How exactly can I manipulate my XML in order to retrieve only the data I want to show? I’ve been going crazy looking for an example that helps me on this without getting too difficult on the actionscript part, but I couldn’t find anything helpful...

      -----

      I know this is a long post and you won’t probably have the time to tutorial me on all I asked, but at least some help would be terrific. If you have some tutorial on the internet you can recommend me I would really appreciate it...

      The idea is to have a simple tutorialized example of a bar chart, with a drill down capability, the MXML file and the XML file used for showing the data. On the other hand, having some example of the filtering tool for manipulating what data to be shown would be awesome.

      I found some examples of what I’m looking for on

      http://flexapps.macromedia.com/flex15/chartexplorer/explorer.mxml

      But the drill down example doesn’t show me the XML file, so I can’t know how they have the data structured so to compare it to my XML. Besides, these examples are from FLEX 1.5, and the syntaxes changes when migrating to flex 2, so this MXML files are not behaving really good when I try them on flex 2.

      Ok! That’s all for now, I hope you’ll be able to bless me with some of your knowledge, thank you so much in advance guys!

      -g