Regarding Gantt chart generation



Share on Google+Share on Google+

Regarding Gantt chart generation
3 Answer(s)      8 years ago
Posted in : Java Beginners
View Answers

May 16, 2009 at 3:59 PM

Hi Friend,

To create a simple Gantt chart, try the following code:

import java.awt.Color;
import java.util.Date;
import java.util.Calendar;
import org.jfree.ui.ApplicationFrame;
import org.jfree.ui.RefineryUtilities;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.*;
import org.jfree.chart.JFreeChart;

public class GanttChartExample {
private static Date date( int day, int month, int year) {

Calendar calendar = Calendar.getInstance();
calendar.set(year, month, day);
Date result = calendar.getTime();
return result;
public static void main( String[] args) {

TaskSeries schedule1 = new TaskSeries("Scheduled Tasks");
schedule1.add(new Task("Feasibility Study",
new SimpleTimePeriod(date(1, Calendar.JANUARY, 2008),
date(10, Calendar.JANUARY, 2008))));
schedule1.add(new Task("Requirement Analysis",
new SimpleTimePeriod(date(11, Calendar.JANUARY, 2008),
date(21, Calendar.JANUARY, 2008))));
schedule1.add(new Task("Designing",
new SimpleTimePeriod(date(22, Calendar.FEBRUARY, 2008),
date(21, Calendar.MARCH, 2008))));
schedule1.add(new Task("Coding",
new SimpleTimePeriod(date(22, Calendar.MARCH, 2008),
date(30, Calendar.MAY, 2008))));
schedule1.add(new Task("Testing",
new SimpleTimePeriod(date(2, Calendar.JUNE, 2008),
date(18, Calendar.JUNE, 2008))));
schedule1.add(new Task("Implementation",
new SimpleTimePeriod(date(19, Calendar.JUNE, 2008),
date(31, Calendar.JULY, 2008))));
schedule1.add(new Task("Post Implementation",
new SimpleTimePeriod(date(1, Calendar.AUGUST, 2008),
date(1, Calendar.NOVEMBER, 2008))));

TaskSeries schedule2 = new TaskSeries("Actual Done");
schedule2.add(new Task("Feasibility Study",
new SimpleTimePeriod(date(1, Calendar.JANUARY, 2008),
date(15, Calendar.JANUARY, 2008))));
schedule2.add(new Task("Requirement Analysis",
new SimpleTimePeriod(date(16, Calendar.JANUARY, 2008),
date(29, Calendar.JANUARY, 2008))));
schedule2.add(new Task("Designing",
new SimpleTimePeriod(date(22, Calendar.FEBRUARY, 2008),
date(30, Calendar.MARCH, 2008))));
schedule2.add(new Task("Coding",
new SimpleTimePeriod(date(1, Calendar.APRIL, 2008),
date(20, Calendar.JUNE, 2008))));
schedule2.add(new Task("Testing",
new SimpleTimePeriod(date(21, Calendar.JUNE, 2008),
date(8, Calendar.JULY, 2008))));
schedule2.add(new Task("Implementation",
new SimpleTimePeriod(date(9, Calendar.JULY, 2008),
date(23, Calendar.AUGUST, 2008))));
schedule2.add(new Task("Post Implementation",
new SimpleTimePeriod(date(1, Calendar.SEPTEMBER, 2008),
date(10, Calendar.DECEMBER, 2008))));

May 16, 2009 at 4:00 PM


TaskSeriesCollection collection = new TaskSeriesCollection();
IntervalCategoryDataset dataset= collection;

JFreeChart chart = ChartFactory.createGanttChart(
"Gantt Chart Example", // chart Heading
"Task", // X-axis label
"Date", // Y-axis label
dataset, // dataset
true, // legend
true, // tooltips
false // urls
chart.setBackgroundPaint(new Color(0xff,0xff,0xcc));
ChartFrame frame=new ChartFrame("Gantt Chart",chart);


March 17, 2011 at 4:55 AM

How I can embed the Ganttchart on JSP page ???


Related Tutorials/Questions & Answers:
Regarding Gantt chart generation - Java Beginners
Regarding Gantt chart generation  how to generate a jdbc gantt chart..., To create a simple Gantt chart, try the following code: import...; JFreeChart chart = ChartFactory.createGanttChart( "Gantt Chart
regarding bill generation - JSP-Servlet
regarding bill generation  in this program it is connected with database in mysql.when a customer or user enters he can able to see his payable amount as well as what he paid before as bill
gantt charts - Swing AWT
gantt charts  Hello, i am doing project on project management tool there i need to generate a gantt chart for daily activity done by developer regarding how many hours they have spent for each activity. If the database contains
gantt charts - Java Beginners
gantt charts  Actually while generating the gantt chart it has...( "Gantt Chart Example", "Task", "Date...)); ChartFrame frame=new ChartFrame("Gantt Chart",chart); frame.setVisible
pdf generation.
pdf generation.  i want to generate the data which is stored in mysql data base in pdf format with php. how i will do
report generation
report generation  hi i found some source codes related to barchart and pie chart .when i try to run thise code its showing me the error as :- java.lang.NoSuchMethodError: org.jfree.text.TextBlock.setLineAlignment(Lorg/jfree/ui
Barcode generation
Barcode generation  hi, I am working on a project where there is a alias no. with symbology EAN-13 for generation of barcode... now i have to write the logic for one item no if their are two or more quantities it should
report generation using jsp
report generation using jsp  report generation coding using jsp
pie chart
pie chart  how to create pie chart using struts2
jfree chart
jfree chart  i need donut chart using jfree
Doubt regarding charts and jsp
Doubt regarding charts and jsp  Hi, I successfully executed the bar chart in normal java application. But I want the Bar Chart to be executed...-jsppage.shtml
Pie chart
Pie chart  hi................. In my project i want to create a pie-chart by taking values at run time. As want to display it in pie chart form....   Java Swing PIE Chart
report generation - EJB
report generation   how to create the report in java
bar chart
bar chart  how to create a bar chart from values of the database and the string value should be the entities of the database??plzz help..needed badly
PDF Generation for unicode characters
PDF Generation for unicode characters  Hi, How a PDF file having unicode characters is generated in JSP
Regarding repository
Regarding repository  How to check in and check out using SVN repository using eclipse
regarding rev
regarding rev  write a prog. in java that display all the arguments passed at the command line in reverse order
jaret timebars
containing rows of intervals. The viewer displays the intervals in a Gantt chart... (classic gantt) and vertical orientation addon package supports using
Regarding Project
Regarding Project  sir, i am doing a project in java. my project is CITY GUIDE it is an web application. please give me documentation of my project
Regarding Project
Regarding Project  sir, i am doing a project in java. my project is CITY GUIDE it is an web application. please give me documentation of my project
Regarding Hibernate
Regarding Hibernate  Both JDBC and Hibernate are used to connect to database then whats the need of going to hibernate? What are the main differences? And could you let me know please
barchart generation - Java Beginners
barchart generation  Please suggest me how to generate the bar chart for this type of query. JDBCCategoryDataset dataset=new JDBCCategoryDataset(co,"SELECT rsa,rors,dda from activity where pcode=? and taskname=? and date
Doubt regarding charts and jsp
Doubt regarding charts and jsp  Hi in the of the code (new StandardEntityCollection..."); ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info); } catch (Exception e
Regarding javascript
Regarding javascript  Hi, I want 4 upload buttons in HTML CODE and Among 4 browse buttons user is not selected any one then provide a prompt message like plz select any 1 file among 4 buttons.If user is selected either 1st
regarding jtable...
regarding jtable...  sir, im working with jtables. i wanted to populate a jtable from the database and when i click any row it should add a container below that row itself and show the required details of the row
Regarding Datasource
Regarding Datasource  Hi friend, Good morning,how r u,i want to share 1 information to u,I got a job in VERIZON DATA SERVICES INDIA PVT.LTD,u help a lot when i am in academic project,with that project only i got a job
Table generation error - EJB
Table generation error  Hi friends I am using EJB3.0 with sun java system application server 9.1 with postgresql database. Actually when i make an EJB it gives the following exception and doesnt generate any table
regarding project
regarding project  OBJECTIVES OF THIS PROJECT: -Ability to test the programmer for basic interaction skills to understand the client requirement. -Ability of the programmer to ask the right questions and get the relevant
regarding project
regarding project  OBJECTIVES OF THIS PROJECT: -Ability to test the programmer for basic interaction skills to understand the client requirement. -Ability of the programmer to ask the right questions and get
Hibernate generation Id to postgreSQL
Hibernate generation Id to postgreSQL  Hi, I'm trying to implement a id generator in Hibernate, but I'm having a problem. Hibernate doesn't seems to reset the counting when the id is generated. For example: 1 - In PostgreSQL I
regarding project
regarding project   sir we need help about project. we have idea about his project please guide me sir. OBJECTIVES OF THIS PROJECT: -Ability to test the programmer for basic interaction skills to understand the client
Java Spring Hibernate Struts Training What type of programming language is Java? How do beginners learn about Java? ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017


Advertisement null