EasyCharts Basics:

1. What is EasyCharts?
2. What chart types do EasyCharts support?
3. How do I install EasyCharts?
4. What is the licensing policy for EasyCharts?
5. Can EasyCharts be distributed without royaltee fees?
6. Which EasyCharts license(s) do I need?
7. What does EasyCharts cost?
8. How do I purchase an EasyCharts license?
9. How do I receive my purchased software?
10. Do you offer free upgrades?
11. What kind of support do I get?
12. Can I purchase the source code for EasyCharts?
14. Which java versions does EasyCharts support?
15. Which browsers and platforms does EasyCharts support?
16. How do I run examples from the examples directory?

EasyCharts features:

17. Can I use EasyCharts with Swing?
18. Can the charts be used as applets?
19. Can I save the charts as images?
20. Does EasyCharts support combination or overlay charts?
21. Does EasyCharts support multiple y-axis?
22. Does EasyCharts support data binding?
23. How do I load data into the charts?
24. Can the charts be printed?
25. Does EasyCharts support pattern filling for black and white printouts?
26. Does EasyCharts support multiline labels?
27. Does EasyCharts support angled labels?
28. Does EasyCharts support multiple data series?
29. Can I make stacked bar charts or stacked line charts/area charts?
30. Can I make drilldown charts?
31. Can I control the fonts and colors of the charts?
32. Does EasyCharts support Servlets or Java Server Pages?
33. How do I access EasyCharts as a servlet?
34. Can I control the charts using JavaScript?
35. Can I do plotter charts?
36. How do I display floating point data?
37. Does EasyCharts support copy & paste?
38. How do I display tool-tip like labels?
39. How do I avoid flickering of the charts when they repaint?
40. Does the line chart support different line types?
41. How do I associate a URL with a chart sample?
42. How do I associate a URL with a chart sample for the ChartServlet (servlet drilldown)?
43. What is the download time of the chart applets?
45. Can EasyCharts display Japanese characters?

EasyCharts problems and issues:

46. Why do the chart applets have problems repainting when I scroll the web page?
47. Why do I have problems printing the charts in Netscape?
48. Why does Netscape Communicator freeze when accessing a web page with charts?
49. How do I remove the red evaluation button and copyright banner?
51. How do I use EasyCharts on Unix without X-Windows installed?
52. Why does my web server report 404 errors on BeanInfo.class files?

1. What is EasyCharts?

EasyCharts is a Javatm based charting library that enables you to add charts to your java applications and web pages. The library contains AWT based chart components, applets, and a chart servlet.

2. What chart types do EasyCharts support?

EasyCharts supports horizontal and vertical bar charts, stacked bar charts, pie charts, line charts, stacked line charts (area charts), plotter charts, bubble charts, and overlay charts. Most charts can be displayed in 2D or 3D.

3. How do I install EasyCharts?

Unzip the EasyCharts distribution file to your disk. You should now be able to test the chart demos opening the demo files with your web browser.

For applet use, copy the chart.jar file to the web directory where your file containing the applet will be, then set the applet tag to the following:

<applet code=com.objectplanet.chart.ChartApplet
archive=chart.jar width=300 height=200>
<param name="chart" value="bar">
</applet>

For java applications, import the chart.jar file into your development environment, or add the file to your CLASSPATH environment variable.

4. What is the licensing policy for EasyCharts?

You need one license for each developer using EasyCharts. If you have 2 people developing your application and one tester, you need three licenses. You need a source license for each person having access to the source code.

If you are developing an application for a client, you need to purchase a license on behalf of the client.

EasyCharts license agreement

5. Can EasyCharts be distributed without royaltee fees?

Yes! The purchase of a developer kit, includes a license to distribute the chart binaries without royaltee fees as long as they are distributed as an integral part of your end user java or web application installed on a web server or client computer and executed solely on the client machine.

You must purchase valid development licenses for each developer working with EasyCharts.

If any EasyCharts software is executed on a server, you need to purchase a server installation license for each installation in addition to a developers kit that includes the software.

6. Which EasyCharts license(s) do I need?

If you are developing a commercial application using EasyCharts components, you need an EasyCharts Commercial Single-User Developer Kit or an EasyCharts Commercial Site Developer Kit. If your commercial application generates charts on the server side, you also need an EasyCharts Commercial Single-Server/Workd Wide Servlet Deployment license.

If you are developing an in-house application using EasyCharts components, you need an EasyCharts Single-User Developer Kit or an EasyCharts Site Developer Kit. If your in-house corporate application generates charts on the server side, you also need an EasyCharts Servlet Single-Server Deployment license or an EasyCharts Servlet Site Deployment license.

If you need access to the source code, you need the EasyCharts Commercial Source Code license or the EasyCharts Source Code license.

7. What does EasyCharts cost?

See here for detailed pricing info.

8. How do I purchase an EasyCharts license?

You can purchase the software online using a major credit card. Go to our purchase page for purchasing details and options.

9. How do I receive my purchased software?

An email with a download link is automatically sent after payment has been processed. This usually takes a few minutes.

10. Do you offer free upgrades?

Yes. An EasyCharts license comes with 1 year of free upgrades.

11. What kind of support do I get?

You get 1 year free email support. The email requests will usually be answered within a day.

12. Can I purchase the source code for EasyCharts?

Yes.

14. Which java versions does EasyCharts support?

EasyCharts 3.5.1 and earlier (except 3.5) supports java 1.1 or later. EasyCharts 4 requires java 1.2 or later.

15. Which browsers and platforms does EasyCharts support?

EasyCharts works on browsers that supports Java 1.1 or later such as Internet Explorer 3 or later and Netscape 3 or later.

16. How do I run examples from the examples directory?

To run the applet examples, open the index.html file in the examples directory. To run the java examples, call the runexample.bat in the examples/java directory followed with the name of the example. Note: The example name is the same as the name of the java file but without any extension.

17. Can I use EasyCharts with Swing?

Yes. Look here for an example.

18. Can the charts be used as applets?

Yes. Place the chart.jar file on your web server and us an applet tag like the following:

<applet code=com.objectplanet.chart.ChartApplet
archive=chart.jar width=300 height=200>
<param name="chart" value="bar">
</applet>

<applet code=com.objectplanet.chart.ChartApplet
archive=chart.jar width=300 height=200>
<param name="chart" value="pie">
</applet>

<applet code=com.objectplanet.chart.ChartApplet
archive=chart.jar width=300 height=200>
<param name="chart" value="line">
</applet>

Make sure the chart.jar file is in the same directory as the file containing the applet.

19. Can I save the charts as images?

EasyCharts comes with a PngEncoder and JpegEncoder that you can use for saving the charts as images.

The following example shows you have to use the JpegEncoder to generate jpeg images from the charts. SaveJpegChart.java.

20. Does EasyCharts support combination or overlay charts?

Yes. EasyCharts 2.5 or later can combine charts and chart types by laying one chart on top of the other.

simple overlay examples
overlay with double range axis
complex overlay example

21. Does EasyCharts support multiple y-axis?

Yes. EasyCharts version 2.5 or later supports multiple y-axis.

bar chart with multiple y-axis

22. Does EasyCharts support data binding?

No. Data has to be passed into the charts using the applet parameters or the java API. To retrieve data from a database, the data has to be read by a script on the server side, and a web page with the applet tag containing the data has to be dynamically built and then served to the client's web browser. You can also load data into the chart using the data parameter.

23. How do I load data into the charts?

For an applet use the sampleValues_N parameter:

<applet code=com.objectplanet.chart.BarChartApplet
archive=chart.jar width=300 height=200>
<param name=sampleValues_0 value="1,2,3,4,5">
</applet>

In a java application, use the API methods:

BarChart chart = new BarChart();
double[] values = new double[] {1,2,3,4,5};
chart.setSampleCount(values.length);
chart.setSampleValues(0, values);

24. Can the charts be printed?

Use the browsers printing command. Use the printAsBitmap parameter to work around applet printing problems.

To print the charts correctly in a web page, they should be generated as images on the server side. You can use the ChartServlet that comes with EasyCharts 2.5 or later to do this.

To print in a java application, use the printing capabilities of the standard Java API. Here is an example; PrintChart_JDK12.java

25. Does EasyCharts support pattern filling for black and white printouts?

Pattern filling is not supported. EasyCharts 3.0 and later supports various different line styles.

26. Does EasyCharts support multiline labels?

Yes, use \n in the labels where you want a line break.

<param name=chartTitle value="This is\nthe title">
or
chart.setTitle("This is\nthe title");

multiline chart title

27. Does EasyCharts support angled labels?

Yes.

angled bar labels
angled axis labels
angled bar value labels
angled line value labels

28. Does EasyCharts support multiple data series?

Yes. With an applet, use the seriesCount parameter:

<applet code=com.objectplanet.chart.BarChartApplet
archive=chart.jar width=300 height=200>
<param name=seriesCount value=3>
<param name=sampleValues_0 value="1,2,3,4,5">
<param name=sampleValues_1 value="3,4,5,6,7">
<param name=sampleValues_2 value="5,6,7,8,9">
</applet>

In a java application, do the following:

BarChart chart = new BarChart();
chart.setSampleCount(5);
chart.setSeriesCount(3);
double[] values0 = new double[] {1,2,3,4,5};
double[] values1 = new double[] {3,4,5,6,7};
double[] values2 = new double[] {5,6,7,8,9};
chart.setSampleValues(0, values0);
chart.setSampleValues(1, values1);
chart.setSampleValues(2, values2);

bar chart with multiple series
line chart with multiple series
pie chart with multiple series

29. Can I make stacked bar charts or stacked line charts/area charts?

Yes. For a bar chart applet, do the following.

<applet code=com.objectplanet.chart.BarChartApplet
archive=chart.jar width=300 height=200>
<param name=seriesCount value=3>
<param name=sampleValues_0 value="1,2,3,4,5">
<param name=sampleValues_1 value="3,4,5,6,7">
<param name=sampleValues_2 value="5,6,7,8,9">
<param name=barType value=stacked>
</applet>

In java, do the following:

chart.setBarType(BarChart.STACKED_BARS);

stacked bars

For a line chart applet, do the following.

<applet code=com.objectplanet.chart.LineChartApplet
archive=chart.jar width=300 height=200>
<param name=seriesCount value=3>
<param name=sampleValues_0 value="1,2,3,4,5">
<param name=sampleValues_1 value="3,4,5,6,7">
<param name=sampleValues_2 value="5,6,7,8,9">
<param name=stackedOn value=true>
</applet>

In java, do the following:

chart.setStackedOn(true);

stacked lines

30. Can I make drilldown charts?

Yes. You can associate a URL with every sample or series in the chart applets by using the url_N_M and urltarget_N_M parameters. The url can then be pointed to another chart containing the drill down data. See here for details.

31. Can I control the fonts and colors of the charts?

Yes. You can set the font type and font size of all labels, you can set the chart foreground and background colors, and you can set the color of each sample in the chart.

chart color examples
chart label colors

32. Does EasyCharts support Servlets or Java Server Pages?

Yes, EasyCharts 2.5 comes with a generic ChartServlet that generates the charts as jpeg images.

33. How do I access EasyCharts as a servlet?

Install a web server or application server that supports Java(tm) Servlets or JavaServer Pages(tm). You can find the Tomcat server here. Follow the installation instructions that comes with the distribution.

Then add the chartServer.jar file to your CLASSPATH or application server. After added to the path, start your server.

You can now access the servlet using a standard html image tag:

<img src="http://server:8080/servlet/com.objectplanet.chart.ChartServlet?
chart=bar&
width=200&height=100&
rangeStep=10&
sampleValues=32,87,46,29,36,45,92,76,34,59,27,63,45">

34. Can I control the charts using JavaScript?

Yes. Look at this example

35. Can I do plotter charts?

Yes. EasyCharts 3.0 and later supports plotter and bubble charts.

36. How do I display floating point data?

For a bar and line chart applet, use the following two parameters

<param name=sampleDecimalCount value=3>
<param name=rangeDecimalCount value=2>

For a pie chart applet, use the following two parameters

<param name=sampleDecimalCount value=1>
<param name=percentDecimalCount value=1>

Add floating point data using the sampleValues parameter

<param name=sampleValues value="1.242, 4.1224, 5.1212, 6.231">

In a java application, do the following:

chart.setSampleDecimalCount(2);
chart.setRangeDecimalCount(2);

37. Does EasyCharts support copy & paste?

No.

38. How do I display tool-tip like labels?

For the bar chart applet, do the following:

<param name="valueLabelStyle" value="floating">
<param name="sampleLabelStyle" value="floating">

In an java application call the following methods:

setValueLabelStyle(Chart.FLOATING);
setSampleLabelStyle(Chart.FLOATING);

The labels in the pie chart is floating by default.

39. How do I avoid flickering of the charts when they repaint?

In a java application, use the NonFlickerPanel class supplied by EasyCharts.

BarChart chart = new BarChart();
// set the chart data
// ...
// add the chart in the NonFlickerPanel
NonFlickerPanel p = new NonFlickerPanel(new BorderLayout());
p.add("Center", chart);
// display the chart
Frame f = new Frame();
f.add("Center", p);
f.setSize(300,200);
f.show();

40. Does the line chart support different line types?

Yes. EasyCharts 3.0 and later supports various different line styles.

41. How do I associate a URL with a chart sample?

Use the url parameter:

<param name="url_0" value="orange_sales_1999.html">
<param name="url_1" value="apple_sales_1999.html">
<param name="url_2" value="banana_sales_1999.html">
<param name="url_3" value="http://www.objectplanet.com">

Since Java can only call valid URL links, JavaScript functions can not be called using the url parameters. Netscape comes with something called JSObject which can be used. See here for instructions.

42. How do I associate a URL with a chart sample for the ChartServlet (servlet drilldown)?

This can only be done if your application server supports "server-side includes" or if you are using any scripting languages such as JSP. If one of these cunditions in true, than you can use servlet drilldowns by specifieing the url_N parameter.

Let's say that you want to display a chart with three bars with urls assigned to each of them. Then in case with server-side includes the servlet request string should look similar to one we use in applets:

<servlet code=com.objectplanet.chart.ChartServlet>
<param name=chart value=bar>
<param name=sampleValue value=10,20,30>
<param name=url_0 value=page_one.html>
<param name=url_1 value=page_two.html>
<param name=url_2 value=page_three.html>
</servlet>

In the case with JSP it should look like this:

<jsp:include page="http://127.0.0.1:8080/servlet/com.objectplanet.chart.ChartServlet?
chart=bar&sampleValues=10,20,30&url_0=page_one.html&url_1=page_two.html&url_2=page_three.html" flush="true"/>

The returned context is the html text and in our case it is:

<map name=bar8821892062>
<area shape=rect coords=227,10,263,189 href=page_three.html target=_self>
<area shape=rect coords=139,70,174,189 href=page_two.html target=_self>
<area shape=rect coords=51,129,86,189 href=page_one.html target=_self>
<area shape=default nohref>
</map>

<img SRC=/servlet/com.objectplanet.chart.ChartServlet?chart=bar&
sampleValues=10,20,30&
chart=bar&
drilldown=false
border=0 usemap=#bar8821892062>

where the first part is the imagemap which defines the areas in the image that follows and the second part is the ChartServlet request which generates the image itself.

43. What is the download time of the chart applets?

The size of the chart.jar file is approx. 140KB and will take a second or two to download. Then the browser will take a second or two to initialize the applet.

45. Can EasyCharts display Japanese characters?

Yes, see example.

46. Why do the chart applets have problems repainting when I scroll the web page?

Some browsers has problems repainting complex java applets. Use the automaticRefreshTime parameter to work around this problem. This parameter makes the applet repaint itself every n milliseconds:

<param name="automaticRefreshTime" value=1000>

47. Why do I have problems printing the charts in Netscape?

In earlier versions, netscape did not support printing of java applets. In later versions it supports printing, but the applets are always printed relatively larger than they appear on the screen. We have not found a workaround for this other than to use another browser or have the charts generated as images on the server.

48. Why does Netscape Communicator freeze when accessing a web page with charts?

This is a known bug in Netscape Communicator an it may also occure when using other applets. You can find description and solution of the problem here.

49. How do I remove the red evaluation button and copyright banner?

Purchase a valid license from our EasyCharts page, download the registered software, and replace the evaluation version. Then restart your web browser.

If you still have the red button displayed, you might have some old evaluation classes loading from elsewhere on your systems. To check for this, remove the archive=chart.jar tag from your applet tag, close and restart your browser and test again. The applet should not start. If it does, you need to remove any com/objectplanet/chart classes (or chart.jar) files from your CLASSPATH environment variable.

If it still does not work, restart your web server and or client machine. Also try and test with other client machines connecting to your web server (if you are running as an applet).

51. How do I use EasyCharts on Unix without X-Windows installed?

Java's AWT (graphical system) needs an underlaying graphical architecture such as X-Windows to work. A servlet executed on a unix server without X installed or running will throw an exception.

If you want to run ChartServlet on a linux computer without X-Windows, you can use one of the folloing options:
1.Use EasyCharts 3.0 and J2SE 1.4.0 or higher.
2.Install Xvbf - a virtual X server which can run on machines without display or physical graphical devices.
3.Install PJA - Pure Java AWT replacement library.

EasyCharts 3.0 and J2SE 1.4.0
The follow property may be specified at the java command line:
    -Djava.awt.headless=true
It means that the string
    JAVACMD=$JAVA_HOME/bin/java in tomcat.sh file
should look like
    JAVACMD="$JAVA_HOME/bin/java -Djava.awt.headless=true".

Note: If you are not using ChartServlet but your own servlet which gets the chart image from Chart.class then the image should be created in the following way:

    Image image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2D = (Graphics2D)image.getGraphics();
    if (g2D != null) {
        chart.paint(g2D);
    }


and never like:

    Image image = chart.createImage(width, height);

For more info about java headless support look at http://java.sun.com/j2se/1.4.2/docs/guide/awt/AWTChanges.html#headless

XVFB
You can get Xvfb for Linux from ftp.xfree86.org. Distributions for other Unix systems can also be found at ftp.xfree86.org. You can also get Xvfb source at ftp.x.org and compile it.

1. Install Xvfb in a directory on your linux computer
2. Run Xvfb by typing in ./Xvfb :0 where 0 is the X-windows display number.
3. Set the DISPLAY variable to point to localhost:0

The Xvfb should now be installed properly. You can now run graphical servlets such as EasyChart's ChartServlet on a headless Linux server.

For more information about Xvfb check http://www.xfree86.org/4.0.1/Xvfb.1.html

PJA
Persuming your
- Java is installed into: /usr/local/jdk1.2.2
- Tomcat is installed into: /home/user/tomcat
- PJA is installed into: /home/user/pja

1. Run http://server/examples/servlet/com.eteks.servlet.DefaultToolkitTest and PJAToolkitDemo.sh to see if servlets and applications can run on the server. PJAToolkitDemo.sh shoudl look like this:
   java -Xbootclasspath/a:../lib/pja.jar \
       -Dawt.toolkit=com.eteks.awt.PJAToolkit \
       -Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment \
       -Djava2d.font.usePlatformFont=false
       -Djava.awt.fonts=/usr/local/jdk1.2.2/jre/lib/fonts \
       -Duser.home=.. \
       -classpath ../lib/pjatools.jar \
   ToolkitDemo
If you see that 4 gifs were generated, it means that you can use graphic servlets on this server with PJA.

2. In /home/user/tomcat open file tomcat.sh and find string
JAVACMD=$JAVA_HOME/bin/java.
Replace it with
JAVACMD="$JAVA_HOME/bin/java -Xbootclasspath/a:/home/user/pja/lib/pja.jar -Dawt.toolkit=com.eteks.awt.PJAToolkit -Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment -Djava2d.font.usePlatformFont=false -Djava.awt.fonts=/usr/local/java/jre/lib/fonts -Duser.home=home/user/pja"
and next to it add
CLASSPATH=${CLASSPATH}:/path_to_chartServer.jar/chartServer.jar

3. Start Tomcat and enter in your browser: http://server/examples/servlet/com.objectplanet.chart.ChartServlet
A chart image should be returned to your browser now.

For more information about PJA see PJA FAQ which follows with the PJA distribution
http://www.eteks.com/pja/en/

52. Why does my web server report 404 errors on BeanInfo.class files?

See here.



Copyright (C) 1998-2010
ObjectPlanet, Inc.