Regarding Gantt chart generation

Regarding Gantt chart generation

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;
import org.jfree.data.category.IntervalCategoryDataset;
import org.jfree.data.gantt.Task;
import org.jfree.data.gantt.TaskSeries;
import org.jfree.data.gantt.TaskSeriesCollection;
import org.jfree.data.time.SimpleTimePeriod;


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

continue..........

TaskSeriesCollection collection = new TaskSeriesCollection();
collection.add(schedule1);
collection.add(schedule2);
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);
frame.setVisible(true);
frame.setSize(400,350);
}
}

Thanks

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
Advertisements
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
ModuleNotFoundError: No module named 'gantt'
ModuleNotFoundError: No module named 'gantt'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'gantt' How to remove the ModuleNotFoundError: No module named 'gantt'
ModuleNotFoundError: No module named 'gantt'
ModuleNotFoundError: No module named 'gantt'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'gantt' How to remove the ModuleNotFoundError: No module named 'gantt'
ModuleNotFoundError: No module named 'minimal-gantt'
ModuleNotFoundError: No module named 'minimal-gantt'  Hi, My... 'minimal-gantt' How to remove the ModuleNotFoundError: No module named 'minimal-gantt' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'minimal-gantt'
ModuleNotFoundError: No module named 'minimal-gantt'  Hi, My... 'minimal-gantt' How to remove the ModuleNotFoundError: No module named 'minimal-gantt' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pyexcel-gantt'
ModuleNotFoundError: No module named 'pyexcel-gantt'  Hi, My... 'pyexcel-gantt' How to remove the ModuleNotFoundError: No module named 'pyexcel-gantt' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'python-gantt'
ModuleNotFoundError: No module named 'python-gantt'  Hi, My Python... 'python-gantt' How to remove the ModuleNotFoundError: No module named 'python-gantt' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'integer-gantt'
ModuleNotFoundError: No module named 'integer-gantt'  Hi, My... 'integer-gantt' How to remove the ModuleNotFoundError: No module named 'integer-gantt' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'openerp-web-gantt'
ModuleNotFoundError: No module named 'openerp-web-gantt'  Hi, My... named 'openerp-web-gantt' How to remove the ModuleNotFoundError: No module named 'openerp-web-gantt' error? Thanks   Hi, In your
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 http://www.roseindia.net/jsp/draw-statistical-chart-jsp.shtml
jfree chart
jfree chart  i need donut chart using jfree
pie chart
pie chart  how to create pie chart using struts2
regarding rev
regarding rev  write a prog. in java that display all the arguments passed at the command line in reverse order
Regarding repository
Regarding repository  How to check in and check out using SVN repository using eclipse
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
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
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
Doubt regarding charts and jsp
Doubt regarding charts and jsp  Hi in the http://www.roseindia.net/chartgraphs/barchart-jsppage.shtml of the code (new StandardEntityCollection..."); ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info); } catch (Exception e
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
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
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
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
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
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
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
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
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
report generation using jsp
report generation using jsp  report generation coding using jsp
Query regarding JSP, JDBC
Query regarding JSP, JDBC  can I get the code for the question asked by me regarding JSP,JDBC
regarding jdbc - JDBC
regarding jdbc  how i can configure java with ms access
ModuleNotFoundError: No module named 'chart'
ModuleNotFoundError: No module named 'chart'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'chart' How to remove the ModuleNotFoundError: No module named 'chart'
Chart & Graphs Tutorials in Java
Chart & Graphs Tutorials in Java  ... in Java. Our Chart and Graphs tutorials will help learn everything you need to learn about chart and graphs programming in Java. We have provided many examples
draw chart in web application
draw chart in web application  how to draw bar chat from the record store in database? i.e. draw the bar chart according to selected record
report generation - EJB
report generation   how to create the report in java
Regarding project - Applet
Regarding project  hi friend , iam doing project in Visual cryptography in Java so i need the Help regarding how to make a share of a original imahe into shares anu
Regarding weblogic portal
Regarding weblogic portal  Hi, My name is Ramanuja.i am working on weblogic portal.if u know any info regarding plz provide the materials or information to me.plz help me. Thanks in advance
Version of be.ceau>chart dependency
List of Version of be.ceau>chart dependency
Version of com.intersult>chart dependency
List of Version of com.intersult>chart dependency
regarding JTable - JDBC
regarding JTable  how to populate a JTable with mysql data after clicking JButton please explain with the example
regarding tags - Struts
regarding tags  What is the difference between html:submit and nested:submit and usage of tags based on the situation
regarding struts 2
regarding struts 2   is it not possible to get values from applicationresources.properties into our application in struts 2
Regarding GUI Applications
Regarding GUI Applications  How to create a save and open jmenu item in java desktop application
Regarding core java
Regarding core java  how do we find reverse of string with out using String functions
chart tutorial - Java3D
chart tutorial  Hi I need a JFree Chart class library in order to design a chart with java  Hi friend, For JFree Chart class library... information,Tutorials and Examples on JFree Chart visit to : http://www.roseindia.net
jaret timebars
containing rows of intervals. The viewer displays the intervals in a Gantt chart...) supports horizontal (classic gantt) and vertical orientation addon package

Ads