Making GIF of the Graphs

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Paul

Making GIF of the Graphs

Post by Paul » Wed Aug 22, 2001 7:13 pm

How can I make a GIF image of these graphs?

Thanks in Advance,
Paul

David Gilbert

RE: Making GIF of the Graphs

Post by David Gilbert » Wed Aug 22, 2001 8:10 pm

Paul,

Follow this link to a brief description of how to create a PNG format image with JFreeChart using an open-source PNG encoder:

http://sourceforge.net/docman/display_d ... p_id=15494

You could do something similar if you have a GIF encoder but, to be honest, PNG is a superior format.

Regards,

DG.

rick

RE: Making GIF of the Graphs

Post by rick » Wed Aug 22, 2001 8:16 pm

do browsers understand png?

David Gilbert

RE: Making GIF of the Graphs

Post by David Gilbert » Thu Aug 23, 2001 5:25 am

I think most of them do now. Netscape and IE added support for PNG around version 3 or 4. I use Konqueror which certainly does.

If you can see the demo charts on the JFreeChart web-page, then your own browser supports PNG.

DG

Navin Pathuru

RE: Making GIF of the Graphs

Post by Navin Pathuru » Sun Sep 02, 2001 3:10 am

Paul, I have used the PNG encoder given by David Gilbert, and inorder to produce a gif file what i have done was when saving the graph to a file instance i have given the filename ending with .gif, or .jpg and it saved it as a gif and jpg without any problem. I then used a scroll pane to load the image. Hope this helps.
Regards,
Navin.

Navin Pathuru

RE: Making GIF of the Graphs

Post by Navin Pathuru » Wed Sep 05, 2001 12:44 am

Take a look at this code:

File fileHorizontalBarChart = new File("C:/HBChart");
saveChartAsPNG(chart, fileHorizontalBarChart, 600,600);



Take a look at this one and note the File name is HBChart.gif

File fileHorizontalBarChart = new File("C:/HBChart.gif");
saveChartAsPNG(chart, fileHorizontalBarChart, 600,600);



After compiling and running it will save it as a gif file without any problem.

This is what i mean.

Hope this helps.


Regards,

Navin.

beeblebrox

RE: Making GIF of the Graphs

Post by beeblebrox » Tue Sep 25, 2001 8:48 am

Hi

Well that shouldnt be to difficult:
First of all you need software that allos you to produce gifs, take java resources: I recommend producing png "images": theres no license like on compuserve gifs on that. After all you should have a method like gifencode() or pngencode() which takes a java.awt.Image and then produces an gif of your chart.
You can get this Image by adding your chart to an instance of JFreeChartPanel.
Then you produce a Graphics Object by calling createGraphics() on JFreeChartPanel wich extends java Component. Then call paint("Graphics Object"): At leat you can get your Image with a method like produceImage() or getImage() called on your Graphics: encode Your Image .......... Ready.

Locked