The Artima Developer Community
Sponsored Link

Java Answers Forum
chart in java

5 replies on 1 page. Most recent reply: Jun 21, 2006 8:41 PM by joe smith

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 5 replies on 1 page
imti chowdhury

Posts: 3
Nickname: imti733
Registered: Dec, 2005

chart in java Posted: Jan 17, 2006 9:44 AM
Reply to this message Reply
Advertisement
hello there

can anyone tell me how to do chart in java i mean graphically

suppose i gave 3 input

5, 7, 9

so the chart will show from ascendind to decending by comparing the value

any suggestion from any1 will be heartly appricated

thx in advance

imti


Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: chart in java Posted: Jan 17, 2006 9:45 PM
Reply to this message Reply
There is a neat little library called JFreeChart, I think
it is licenced under LGPL (if I'm not mistaken). You'll
be able to create Pie Charts, Bar Graphs, line Graphs, etc...

Google it coz I don't remember the site.

imti chowdhury

Posts: 3
Nickname: imti733
Registered: Dec, 2005

Re: chart in java Posted: Jan 18, 2006 4:22 AM
Reply to this message Reply
Dear

thx for ur reply ...i download jfreechart 1.0.0 but how to set the path ??
i will be so gratefull if u tell me the steps or a simple code for any chart

pls help me

thx
imti

Kondwani Mkandawire

Posts: 530
Nickname: spike
Registered: Aug, 2004

Re: chart in java Posted: Jan 18, 2006 7:23 AM
Reply to this message Reply
Using windows; after extraction.

In Console/Dos:

set CLASSPATH=%CLASSPATH%;C:\Place_To_Where_Your_Jchart.jar_is_located

In Linux:

export CLASSPATH=$CLASSPATH:/directory_path/location_of_Jchart_jar.jar

JFreeChart barChart;
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(30, "x/y", "barchart_representation1");
dataset.setValue(20, "x/y", "barchart_representation2");
char = ChartFactory.createBarChart("Title: Just A Bar Chart Example",
    			"Value", "Denotion", dataset,
				PlotOrientation.VERTICAL, false, true, false);
 
JFreeChart pie_chart;
DefaultPieDataset dataset = new DefaultPieDataset();
    	dataset.setValue("potatoes", 60);
    	dataset.setValue("tomatoes", 10);
    	dataset.setValue("pears", 30);
pie_chart = ChartFactory.createPieChart(
    			"Quantity of Farm Products sold",
				dataset,
				true,
				true,
				false);
                                
BufferedImage image = chart.createBufferedImage(500,300);
BufferedImage image2 = pie_chart.createBufferedImage(500,300);
 
//  These JLabels may then be placed in a JPanel and voila!!
//  You have your Bar Graph and Pie Chart
JLabel label1 = new JLabel();
JLabel label2 = new JLabel();
label1.setIcon(image);
label2.setIcon(image2);

joe smith

Posts: 21
Nickname: jetbrains
Registered: Jan, 2006

Re: chart in java Posted: Feb 20, 2006 2:07 AM
Reply to this message Reply
Get a comromchart wich single license as
A benefit for javaresources members
http://www.javaresources.biz/


JAVA email verify
www.wisesoft.biz

joe smith

Posts: 21
Nickname: jetbrains
Registered: Jan, 2006

Re: chart in java Posted: Jun 21, 2006 8:41 PM
Reply to this message Reply
Just take a loot at jfreechart tutorial.


http://www.developerzone.biz/index.php?option=com_content&task=view&id=36&Itemid=36

Flat View: This topic has 5 replies on 1 page
Topic: JDialog doesn't respond Previous Topic   Next Topic Topic: Converting/formatting a date

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use