How to add graphs in Ebase forms and PDFs

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Jignesh
Ebase User
Posts: 12
Joined: Thu Sep 13, 2007 10:24 am

How to add graphs in Ebase forms and PDFs

#1

Postby Jignesh » Wed Oct 10, 2007 2:39 pm

***Please note: This is supplied untested and is unsupported. It is a demo only.***

You can easily add graphs in Ebase forms using a open source chart library “Jfreechart”. I have developed a sample Ebase form to demonstrate this. The following are the steps to add graphing capability to Ebase.
  • 1. Download the Graph_Demo.zip file from http://www.ebaseftp.com/forum/forumfiles/Graph_Demo.zip

    2. Unzip the Graph_Demp.zip into a temporary folder.

    3. Copy the GRAPH_DEMO.xml into <ufs>\UfsServer\transport folder

    4. Import this into your Ebase environment via the Ebase Designer.

    5. Open the GRAPH_Button230_UPDATETABLE_001 script and change ‘C:/Ebase_versions/Ebase_3_4_0_Beta_3/UfsServer/tomcat/webapps/ufs/’ to the correct location of the web-app on your Ebase server.

    6. Copy the Graphing.class file into <ufs>\UfsServer\tomcat\webapps\ufs\WEB-INF\classes\com\ebasetech\ufs\customresources. (Note: If you do not have the folder structure, please create it)

    7. Copy the .jar files inside \lib folder into <ufs>\UfsServer\tomcat\webapps\ufs\WEB-INF\lib folder

    8. Copy the Graphing.properties file into <ufs>\UfsServer\tomcat\webapps\ufs\WEB-INF\classes folder

    9. Create a ‘charts’ folder inside <ufs>\UfsServer\tomcat\webapps\ufs\shared\ folder.

    10. Re-start your Ebase Server, start Designer, navigate to Business Projects -> GRAPHING

    11. Run the GRAPH form inside the GRAPHING Business Project.

    12. Graphing.java file is for your reference. If you make any enhancement to this file please send it back to us so that we can share it with others.:)
The way it works.
1. The form passes the required values to the custom resource 'Graphing'.
2. This custom resource uses the Jfreechart java library to produce the required graph image and creates a .PNG file in the <ufs>\UfsServer\tomcat\webapps\ufs\shared\charts folder.
3. The custom resource returns the unique file name for the .PNG file which is assigned to a Ebase form field “CHART_IMAGE”
4. This value is then used inside a label field to display a image by using HTML
    Note: The sample form also demonstrates adding the graph image to pdf which will only work from Ebase 3.4.x onwards

    Image



    Important Note:
    The gnujaxp.jar file which needs to be added to Ebase for this graphing tool may cause problems with Web Services (see log number 332425 on the Ebase Customer Portal).
    0 x

    User avatar
    nftfi
    Ebase User
    Posts: 26
    Joined: Fri Sep 14, 2007 3:18 pm
    Location: Wales

    #2

    Postby nftfi » Wed Jan 30, 2008 10:58 am

    Initial problems all solved now, this works great.

    Thanks
    Last edited by nftfi on Wed Jan 30, 2008 11:50 am, edited 2 times in total.
    0 x

    User avatar
    Sarah
    Ebase User
    Posts: 63
    Joined: Fri Sep 07, 2007 2:42 pm
    Location: Sandy, UK
    Contact:

    #3

    Postby Sarah » Wed Jan 30, 2008 11:33 am

    Please can you confirm which version of Ebase and which build you are using? Also, which version of Java are your Ebase Designer AND Server using?

    This information can be found in "About Ebase" in the Ebase Designer "Help" menu.
    0 x

    User avatar
    nftfi
    Ebase User
    Posts: 26
    Joined: Fri Sep 14, 2007 3:18 pm
    Location: Wales

    #4

    Postby nftfi » Wed Jan 30, 2008 12:19 pm

    Ok,

    So I thought it was working great, but actually its not creating a chart image at all and all I get is a box with a red cross in it.

    We are on the latest build of ebase version 3.4.0.

    The ebase server is on java version 1.4.2_15 and the designer is on java version 1.3.1_01
    0 x

    User avatar
    Sarah
    Ebase User
    Posts: 63
    Joined: Fri Sep 07, 2007 2:42 pm
    Location: Sandy, UK
    Contact:

    #5

    Postby Sarah » Wed Jan 30, 2008 12:32 pm

    The version of Java needs to be the same for the Ebase Designer and for the Ebase Server.

    We actually recommend Java 1.5 for Ebase version 3.4.0 as there are some incompatibilities with Ebase version 3.4.0 and Java 1.4.2 - therefore, I don't know if this will work on your system.

    To point your Ebase Designer to your Java 1.4.2_15 (in the meantime, until you upgrade to Java 1.5) you can add the Java home setting in your start_ebase_designer.bat to point to your jre folder within your instance of Java 1.4.2.

    e.g: set JAVA_HOME = C:/Program Files/Java142/jre
    0 x

    User avatar
    nftfi
    Ebase User
    Posts: 26
    Joined: Fri Sep 14, 2007 3:18 pm
    Location: Wales

    #6

    Postby nftfi » Mon Feb 04, 2008 11:18 am

    I have upgraded both the server and client to java 1.5 and nothing has changed, I'm still getting a box with a red cross instead of an image.

    I've also checked the folder where the image should be created and its empty.
    0 x

    User avatar
    Sarah
    Ebase User
    Posts: 63
    Joined: Fri Sep 07, 2007 2:42 pm
    Location: Sandy, UK
    Contact:

    #7

    Postby Sarah » Tue Feb 05, 2008 2:51 pm

    I have just set up the Graphing example on my system and I'm having problems getting it working in Firefox, but it is fine in Internet Explorer.

    In Firefox, no image is displayed (not even a box with a red cross) and there is no file in the 'charts' folder.

    If you are running the form in Firefox, can you try running it in Internet Explorer and see if that works?


    If it still doesn't work, can you please double-check the path to the 'charts' folder and ensure it is definitely C:\ebase\UfsServer\tomcat\webapps\ufs\shared\charts.
    0 x

    User avatar
    Sarah
    Ebase User
    Posts: 63
    Joined: Fri Sep 07, 2007 2:42 pm
    Location: Sandy, UK
    Contact:

    #8

    Postby Sarah » Tue Feb 05, 2008 3:49 pm

    I've been looking into this more, and I notice that when the form is run in Internet Explorer, IE shows a box with a red cross in it as soon as the form is displayed, before any calculations are done.

    One thought; are you clicking on the 'Generate Chart' button once the form is displayed in the browser? This button needs to be pressed for the image to display on the right and for the .png file to be created in the charts folder.
    0 x

    User avatar
    nftfi
    Ebase User
    Posts: 26
    Joined: Fri Sep 14, 2007 3:18 pm
    Location: Wales

    #9

    Postby nftfi » Tue Feb 05, 2008 4:15 pm

    I am using IE to run the form although I have also tried it in Firefox and it doesn't work on either. It's even worse in Firefox than IE and just gives the message 'The application has timed out. Press the browser's refresh key to start again.'

    I have clicked the generate chart button and nothing happens.

    I have also double checked the path and it is correct. (its not the same path as above because we're on a Linux server, but it's definately correct)
    0 x

    User avatar
    Sarah
    Ebase User
    Posts: 63
    Joined: Fri Sep 07, 2007 2:42 pm
    Location: Sandy, UK
    Contact:

    #10

    Postby Sarah » Thu Feb 07, 2008 3:59 pm

    I agree about the Firefox problem - I haven't got it working properly with it yet either (If anyone else reading this has any suggestions, please let us know!).

    However, I cannot work out why your sample form isn't working in IE.

    Have you checked your Java versions in the Ebase Designer 'Help' menu since you changed them, just to confirm that they are being used?

    Did you restart your Ebase Server after adding the .class file and the .jar files to your system?

    One more question - what version of Internet Explorer are you using? If you aren't using version 7, is there a way you could try your form in version 7 on another computer? Just to check whether this makes a difference.

    In the meantime, I'll try and set this up on a Linux system - it shouldn't really make a difference, but it's worth a go!
    0 x


    Who is online

    Users browsing this forum: Google [Bot] and 37 guests