1 2 3 4 Previous Next 50 Replies Latest reply: Aug 7, 2007 1:01 AM by Nilesh Agrawal-Oracle RSS

    Graphics on APEX 2.2

    338570
      I attended Oracle Open World. In session "IOUG Oracle Application Express (APEX) Special Interest Group Meeting", one f speaker mention that it can replace Adore Acrobat CVG graphics with other Third party graphics. I was in hurry I didn't ask details. Can somebody help me?
        • 1. Re: Graphics on APEX 2.2
          Jes
          Hi Mary,

          I was sitting on the SIG Panel and I believe you're talking about when Doug Gault was talking about the Flash charting tools he was using, is that right?
          • 2. Re: Graphics on APEX 2.2
            338570
            I think so. Please give me details
            • 3. Re: Graphics on APEX 2.2
              Jes
              The Flash software he was referring to is -

              http://www.maani.us/charts/index.php

              The integration with Apex isn't really so different as integrating it with other programming languages (since it's a solution designed to be used with different programming languages). Doug is probably the best person to talk you through the actual implementation details.
              • 4. Re: Graphics on APEX 2.2
                Doug A. Gault
                John is right, we use XML/SWF Charts from www.maani.us
                'd be happy to answer any questions you have about how we're using it...
                • 5. Re: Graphics on APEX 2.2
                  338570
                  Doug,
                  It will be really helpful, if you sent me exactly steps, I should done to setup it in HTMLDB 2.0 or APEX
                  Thanks MB
                  • 6. Re: Graphics on APEX 2.2
                    Doug A. Gault
                    We've implemented it in a fairly complex way, and created a wizard application around it much like the core APEX functionality around SVG charts. I'm not going to describe all of that here as it would take far to long and be way more complex that it needs to be to be able to get a feel for using XML/SWF charts.

                    What I can do is give you a brief tutorial that will get you started.

                    1. Download the XML/SWF charts Freeware version from http://www.maani.us/xml_charts/index.php?menu=Download

                    2. Unzip the charts and move the charts.swf file and the charts_library directory to the directory on your server that is pointed to by the /i/ virtual directory in your marvel.conf file.

                    3. In the Application Builder of APEX, select a page (or create one) on which you want to test the charts.

                    4. Create a new HTML REGION and in the HTML REGION SOURCE area paste the following :

                    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                         codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
                         WIDTH="400"
                         HEIGHT="250"
                         id="charts"
                         ALIGN="">
                    <PARAM NAME=movie VALUE="/i/charts.swf">
                    <PARAM NAME=quality VALUE=high>
                    <PARAM NAME=bgcolor VALUE=#666666>

                    <EMBED src="/i/charts.swf"
                    quality=high
                    bgcolor=#666666
                    WIDTH="400"
                    HEIGHT="250"
                    NAME="charts"
                    ALIGN=""
                    swLiveConnect="true"
                    TYPE="application/x-shockwave-flash"
                    PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
                    </EMBED>
                    </OBJECT>


                    5. At this point if you test the page, you'll see a charcoal coloured box in the region with a standards Flash style "spinner" rotating.... After a number of seconds (30 I believe) it will time out and turn into an Orange coloured box with a timeout message displayed.

                    If you DON'T get the above, then the charts.swf file is most likely in the wrong place.

                    If you DO get the above then we can go forward to step 6.

                    6. in the same directory where you placed the charts.swf file, create a file called "sample.xml" with the following content.

                    <chart>
                    </chart>

                    This tells the graphing software to draw a "dummy chart" that shows you the functionality is working.

                    7. Now make the following changes to the source of the HTML REGION...

                    Change each occurance of
                    "/i/charts.swf"
                    to
                    "/i/charts.swf?library_path=/i/charts_library&xml_source=/i/sample.xml"

                    This is pointing the chart software to where it's library of charts are, and where to get the "data" to draw the charts.

                    8. save and re-test the page. This time you should get a bar graph that shows data for "region a" and "region b" for 2003, 2004, & 2005...

                    Now that you know you have the graphs working, now you can really go to work and generate "real" graphs.

                    9. Create a procedure/package in the database that (using HTP.P) emits XML that conforms to the standard outlined in the documentation on the XML/SWF chart web site in the "REFERENCE" section.

                    Then change the SOURCE of the HTML area once again tomake the CHARTS.SWF calls look something like this...

                    ...
                    "/i/charts.swf?library_path=/i/charts_library&xml_source=schema.package.procedure"
                    ...

                    If the packaged generates XML conforming to requirements, then you should see a graph that depicts the data you emitted.

                    I know that this is not complete, but it should get you through the hard steps and to the point where you can start experimenting.

                    Happy Charting!

                    Doug
                    • 7. Re: Graphics on APEX 2.2
                      338570
                      Thanks Doug,
                      You are the best.

                      I followed your instruction everything is working perfect.
                      I stopped on step 9.
                      Can you give me example of procedure for using chart_pref from "REFERENCE"?
                      I would be really appreciated

                      MB
                      • 8. Re: Graphics on APEX 2.2
                        Denes Kubicek
                        Doug,

                        Good description. Everything works as described. I am also having no experience generating xml. An examle of a procedure which would deliver a simple sum of emp per dept would do the work.

                        Thanks,

                        Denes
                        • 9. Re: Graphics on APEX 2.2
                          Denes Kubicek
                          O.K.

                          I think I got it. This is a procedure which does the work:
                          CREATE OR REPLACE PACKAGE BODY Chart_Pkg
                          AS
                          /******************************************************************************
                          ******************************************************************************/
                             PROCEDURE chart_pr
                             IS
                                CURSOR emp
                                IS
                                   SELECT   COUNT (empno) employees, deptno
                                       FROM emp
                                   GROUP BY deptno
                                   ORDER BY deptno;
                             BEGIN
                                OWA_UTIL.mime_header ('text/xml', TRUE);
                                HTP.p ('<chart>');
                                HTP.p ('<chart_data>');
                                HTP.p ('<row>');
                                HTP.p ('<null/>');
                                HTP.p ('<string>' || 'emp' || '</string>');
                                HTP.p ('</row>');

                                FOR c IN emp
                                LOOP
                                   HTP.p ('<row>');
                                   HTP.p ('<string>' || c.deptno || '</string>');
                                   HTP.p ('<number>' || c.employees || '</number>');
                                   HTP.p ('</row>');
                                END LOOP;

                                HTP.p ('</chart_data>');
                                HTP.p ('</chart>');
                             END;
                          END Chart_Pkg;
                          The chart renders nicely. Adding these charts and replacing the current SVG would greately enhance ApEx.

                          Denes Kubicek
                          • 10. Re: Graphics on APEX 2.2
                            a.stropp
                            Hi:

                            I'm testing this with XE, but I can only see the orange timeout notice.
                            Everything works correctly up to point 8 in Doug's post.

                            The procedure itself works correctly; I can see the output with SQL Developer's OWA output window.

                            If I change
                            ...
                            "/i/charts.swf?library_path=/i/charts_library&xml_source=schema.package.procedure"
                            ...
                            to a non-existing schema.package.procedure I have the same timeout message...

                            Anyone could make this work with XE edition's Apex?

                            Thanks,
                            Andrea
                            • 11. Re: Graphics on APEX 2.2
                              a.stropp
                              doh!!!!

                              this thread explains all:

                              how to call a procedure from url

                              Thanks to everyone... this way of generating graphs really rocks...

                              Andrea
                              • 12. Re: Graphics on APEX 2.2
                                Doug A. Gault
                                Denes,

                                Thanks for the example.. Was a bit busy so didn't have time to work one up until now... What you have done is spot on.

                                a.stropp,

                                Yep, in XE you have to "allow" the PL/SQL to be used. Not the most clearly documented feature, but works great once you find it.

                                :-)

                                Doug
                                • 13. Re: Graphics on APEX 2.2
                                  Denes Kubicek
                                  Doug,

                                  I like this charting plugin so much, that I decided to create a package, which will replace the current SVG in my application. I have no problem publishing that package once it is complete.

                                  It took me couple of hours to get into the schema - the guys from XML/SWF Charts have a perfectly clean documentation on their product.

                                  There is only one thing I couldn't solve up to now - adding links to charts - they call it link_data. I noticed, if I understand it right, there is a script which generates a link suffix - link_data.php. It adds the following string to the specified link:

                                  &col=1&row=2&value=100&category=2001&series=R

                                  Of course, the link will not be understood by the appache server and it will fail.

                                  Do you have a workarround for this? It is probably only my poor understanding of the program. I may ask the support there as well.

                                  Thanks,

                                  Denes Kubicek
                                  • 14. Re: Graphics on APEX 2.2
                                    Doug A. Gault
                                    The <link_data> problem can be solved. We generate the link_data node in the XML from within the same PL/SQL packages we're using to generate the rest of the XML and it works fine.

                                    Read the documentation carefully.

                                    One thing that we did have to do on several occasions was replace URL tokens such as ?, &, etc with their hex representation equivelants... %3F %3D etc...

                                    This is also documented in the XML/SWF charts reference guide.

                                    Read the reference guide carefully and translate their PHP examples to PL/SQL and you should be fine.

                                    Doug
                                    1 2 3 4 Previous Next