My favorites | Sign in
Project Logo
                
Search
for
Updated Nov 11, 2008 by Julien.C.Chastang
Labels: Featured
FAQ  
gchartjava IS NOW charts4j

gchartjava IS NOW charts4j

gchartjava ---> charts4j

Please update your bookmarks

Frequently Asked Questions

General Information

What is gchartjava?

gchartjava is a Java Chart Library that you can use in your Java code to generate all the charts available in the Google Chart API except QR codes. Under the hood, gchartjava leverages the Google Chart API to create cool looking charts.

It is a 100% POJO solution.

What does 100% POJO mean?

POJO stands for Plain Old Java Objects. This means that to use gchartjava, you do not need to download tons of external libraries (e.g. apache, spring, etc.). Nor do you need to run gchartjava inside an application container. Nor do you need special graphics libraries. All you need is the gcharthjava.jar and an Internet connection.

Of course, if you want, you can incorporate gchartjava into your web or enterprise application.

Why do I need an Internet connection to use gchartjava?

Welcome to the world of Service Oriented Architecture (SOA) technology. gchartjava merely makes communicating with the Google Chart API from within your Java code much easier. Once you have defined your GChart Java object, you will call a method that will generate a URL that looks like something this

http://chart.apis.google.com/chart?cht=lc&chs=200x125&chd=s:helloWorld&chxt=x,y&chxl=0:|Mar|Apr|May|June|July|1:||50+Kb

Use the URL to retrieve your PNG image. Or embed the URL in an HTML image tag that can then be displayed in a web page. The best solution is to programmatically incorporate the URLs that are dynamically generated in your web or Internet application with the help of gchartjava, and embed those URLs in your view technology (e.g. JSPs).

Why is gchartjava useful for me?

gchartjava allows you to programmatically generate charts from within your Java code via a simple, intuitive Java API. Moreover, it hides the ugly details of creating the URL parameters that are necessary for communicating with the Google Chart API.

Why does my data have to be between 0 and 100? What do I do about negative numbers, etc.?

This issue is at the heart of every computer graphics library. Users must supply the library data that is in an expected range so that it can be rendered. If your data falls outside the 0 to 100 range it must be scaled which is easy to do. See next item.

How do I scale my data?

See the DataUtil class documentation in the javadocs.

How do I get gchartjava?

Grab the latest jar or check out the source via SVN.

How do I use gchartjava in my Java programs?

Once you have downloaded and included the gchartjava.jar in your classpath, you will have to start writing some code. The best way to learn the gchartjava API is to follow some example code (see chart gallery) and to read the javadocs. Also I will be adding more example code in this FAQ. See below.

Is gchartjava free?

Yes.

What are the licensing terms?

gchartjava is released under the MIT License, the most relaxed, permissive open-source license I could find.

Do I need to give anybody credit if I use gchartjava?

If you wish, as a courtesy you can link back to http://gchartjava.googlecode.com/, but that is voluntary.

Are there any security guarantees?

None.

Once you submit your URL, the data will be transmitted as clear text over the Internet. It is then trivial to intercept and decode your information contained within that URL.

What about long URLs and lots of data?

Good question. There is an interesting discussion on this topic here. If you have large quantities of data (> 2000 points) you want displayed in one chart, you should try to sample your data less frequently. Otherwise, this technology may not be right for you.

Where can I find code examples?

Chart gallery with examples

###


Comment by johncurt...@gmail.com, Dec 11, 2007

Julien,

Congrats on starting this project--though I have not tried to use it, I browsed some of your code and liked what I saw. The overall concept also seems like a great idea to me: unlocking the power of Google's Charting service by providing a more rational interface to it.

I'm the author of a GWT-based, client-side charting utility:

http://gchart.googlecode.com

Based on the experience I gained with that product, I just want to suggest this general idea: a GWT-compatible version/wrapper around your package, designed for use on the client side, might be quite doable and very welcome to the GWT community. Basically, client-side GWT could just be another "platform" within which the specialized Google Charting URL-generation services provided by your package could live. For example, on the client, logic that changes the chart in direct response to user input by changing the URL embedded in a GWT Image object could be easily implemented. If Google's servers responded fast enough (no guarantee of that, by the way, since the service is free) this could feel like a desktop app, refreshing just the chart, not the whole page.

Do you think this is a good idea? If so, let me know if there is anything I can do to help you make it happen (realistically, my time available for this may be very limited but I will try to help as much a possible, if asked). Don't know how much you know about GWT, but your Java code would have to be Java 1.4 compatible, and use a VERY limited subset of the JDK, for this to work, so some changes (but nothing major, I think) to your "core" library code would likely be required if you decided to target GWT client-side as a supported platform for gchartjava.

In any case, good luck with gchartjava.

John Gunther

Comment by Julien.C.Chastang, Dec 13, 2007

John,

My experience with GWT is very limited and I can't really comment on that. However, gchartjava is a 100% POJO solution, so, in theory, it can be incorporated into any web application framework including GWT.

-Julien

Comment by mdaguete, Dec 20, 2007

Hello Julien, I've made a mavenized version of the library, If you want I can send you the code.

Regards.

Comment by justin.delvecchio, Jul 22, 2008

Julien,

Very nice library. To this point I've used it extensively but I have one question. How do you add text to points on an XYLine? I reviewed the ShapeMarker?.ShapeEnum? and it contains all the shapes as in the Google api. However, I do not see support for adding text. This is supported in the Google api.

Any thoughts?


Sign in to add a comment
Hosted by Google Code